brighterscript 1.0.0-alpha.23 → 1.0.0-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +585 -218
- package/README.md +45 -139
- package/bsconfig.schema.json +41 -0
- package/dist/ActionPipeline.d.ts +10 -0
- package/dist/ActionPipeline.js +40 -0
- package/dist/ActionPipeline.js.map +1 -0
- package/dist/AstValidationSegmenter.d.ts +25 -0
- package/dist/AstValidationSegmenter.js +152 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +39 -4
- package/dist/BusyStatusTracker.d.ts +31 -0
- package/dist/BusyStatusTracker.js +83 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.js +3 -3
- package/dist/Cache.js.map +1 -1
- package/dist/CacheVerifier.d.ts +7 -0
- package/dist/CacheVerifier.js +20 -0
- package/dist/CacheVerifier.js.map +1 -0
- package/dist/CodeActionUtil.d.ts +3 -3
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +3 -2
- package/dist/CommentFlagProcessor.js +5 -4
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/DependencyGraph.d.ts +3 -2
- package/dist/DependencyGraph.js +11 -10
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.js +9 -5
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +1 -0
- package/dist/DiagnosticFilterer.js +5 -3
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +79 -15
- package/dist/DiagnosticMessages.js +134 -21
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
- package/dist/DiagnosticSeverityAdjuster.js +41 -0
- package/dist/DiagnosticSeverityAdjuster.js.map +1 -0
- package/dist/FunctionScope.d.ts +28 -0
- package/dist/FunctionScope.js +52 -0
- package/dist/FunctionScope.js.map +1 -0
- package/dist/KeyedThrottler.d.ts +3 -3
- package/dist/KeyedThrottler.js +3 -3
- package/dist/KeyedThrottler.js.map +1 -1
- package/dist/LanguageServer.d.ts +23 -11
- package/dist/LanguageServer.js +222 -87
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +3 -2
- package/dist/Logger.js +11 -3
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +21 -3
- package/dist/PluginInterface.js +74 -6
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +162 -81
- package/dist/Program.js +903 -732
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +22 -12
- package/dist/ProgramBuilder.js +132 -104
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +95 -134
- package/dist/Scope.js +477 -551
- package/dist/Scope.js.map +1 -1
- package/dist/Stopwatch.js +1 -1
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +95 -29
- package/dist/SymbolTable.js +256 -102
- package/dist/SymbolTable.js.map +1 -1
- package/dist/Throttler.d.ts +12 -0
- package/dist/Throttler.js +39 -0
- package/dist/Throttler.js.map +1 -1
- package/dist/Watcher.d.ts +0 -3
- package/dist/Watcher.js +0 -3
- package/dist/Watcher.js.map +1 -1
- package/dist/XmlScope.d.ts +4 -6
- package/dist/XmlScope.js +74 -68
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +48 -0
- package/dist/astUtils/CachedLookups.js +323 -0
- package/dist/astUtils/CachedLookups.js.map +1 -0
- package/dist/astUtils/{AstEditor.d.ts → Editor.d.ts} +9 -5
- package/dist/astUtils/{AstEditor.js → Editor.js} +10 -4
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/{AstEditor.spec.js → Editor.spec.js} +68 -64
- package/dist/astUtils/Editor.spec.js.map +1 -0
- package/dist/astUtils/creators.d.ts +10 -10
- package/dist/astUtils/creators.js +26 -16
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/creators.spec.js +5 -5
- package/dist/astUtils/creators.spec.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +132 -100
- package/dist/astUtils/reflection.js +225 -166
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/reflection.spec.js +208 -126
- package/dist/astUtils/reflection.spec.js.map +1 -1
- package/dist/astUtils/stackedVisitor.spec.js +12 -12
- package/dist/astUtils/stackedVisitor.spec.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +54 -35
- package/dist/astUtils/visitors.js +29 -3
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +178 -33
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -9
- package/dist/astUtils/xml.js +9 -9
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +12 -2
- package/dist/bscPlugin/BscPlugin.js +41 -3
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +131 -0
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
- package/dist/bscPlugin/FileWriter.d.ts +6 -0
- package/dist/bscPlugin/FileWriter.js +24 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
- package/dist/bscPlugin/SignatureHelpUtil.js +135 -0
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +21 -12
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +86 -12
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +57 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +544 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js +1909 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/fileProviders/FileProvider.d.ts +9 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js +51 -0
- package/dist/bscPlugin/fileProviders/FileProvider.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.d.ts +17 -0
- package/dist/bscPlugin/hover/HoverProcessor.js +188 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js +513 -0
- package/dist/bscPlugin/hover/HoverProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +3 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +102 -29
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +167 -6
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/bscPlugin/serialize/BslibInjector.spec.d.ts +1 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js +19 -0
- package/dist/bscPlugin/serialize/BslibInjector.spec.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +9 -0
- package/dist/bscPlugin/serialize/BslibManager.js +40 -0
- package/dist/bscPlugin/serialize/BslibManager.js.map +1 -0
- package/dist/bscPlugin/serialize/FileSerializer.d.ts +9 -0
- package/dist/bscPlugin/serialize/FileSerializer.js +72 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +16 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +123 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.d.ts +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js +41 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.spec.js.map +1 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.d.ts +12 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js +99 -0
- package/dist/bscPlugin/transpile/XmlFilePreTranspileProcessor.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +22 -1
- package/dist/bscPlugin/validation/BrsFileValidator.js +316 -29
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js +264 -0
- package/dist/bscPlugin/validation/BrsFileValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +10 -0
- package/dist/bscPlugin/validation/ProgramValidator.js +32 -0
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +56 -8
- package/dist/bscPlugin/validation/ScopeValidator.js +514 -116
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.spec.d.ts +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js +2454 -0
- package/dist/bscPlugin/validation/ScopeValidator.spec.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +44 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +107 -8
- package/dist/cli.js.map +1 -1
- package/dist/deferred.d.ts +3 -3
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +8 -2
- package/dist/diagnosticUtils.js +47 -17
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.js +8 -10
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +26 -0
- package/dist/files/AssetFile.js +26 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.Class.spec.js +529 -486
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +124 -112
- package/dist/files/BrsFile.js +819 -1131
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +1869 -1277
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/BscFile.d.ts +104 -0
- package/dist/files/BscFile.js +16 -0
- package/dist/files/BscFile.js.map +1 -0
- package/dist/files/Factory.d.ts +25 -0
- package/dist/files/Factory.js +22 -0
- package/dist/files/Factory.js.map +1 -0
- package/dist/files/LazyFileData.d.ts +20 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/LazyFileData.spec.d.ts +1 -0
- package/dist/files/LazyFileData.spec.js +27 -0
- package/dist/files/LazyFileData.spec.js.map +1 -0
- package/dist/files/XmlFile.d.ts +70 -32
- package/dist/files/XmlFile.js +106 -117
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/files/XmlFile.spec.js +325 -262
- package/dist/files/XmlFile.spec.js.map +1 -1
- package/dist/files/tests/imports.spec.js +49 -41
- package/dist/files/tests/imports.spec.js.map +1 -1
- package/dist/files/tests/optionalChaning.spec.js +104 -40
- package/dist/files/tests/optionalChaning.spec.js.map +1 -1
- package/dist/globalCallables.js +16 -18
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +13 -2
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +440 -150
- package/dist/interfaces.js +27 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Character.spec.js +5 -5
- package/dist/lexer/Character.spec.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +12 -5
- package/dist/lexer/Lexer.js +28 -13
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Lexer.spec.js +187 -134
- package/dist/lexer/Lexer.spec.js.map +1 -1
- package/dist/lexer/Token.d.ts +9 -1
- package/dist/lexer/Token.js +9 -1
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +9 -0
- package/dist/lexer/TokenKind.js +30 -5
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/parser/AstNode.d.ts +162 -0
- package/dist/parser/AstNode.js +225 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/AstNode.spec.d.ts +1 -0
- package/dist/parser/AstNode.spec.js +165 -0
- package/dist/parser/AstNode.spec.js.map +1 -0
- package/dist/parser/BrsTranspileState.d.ts +4 -7
- package/dist/parser/BrsTranspileState.js +4 -12
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +126 -167
- package/dist/parser/Expression.js +524 -394
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js +152 -146
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +45 -196
- package/dist/parser/Parser.js +470 -926
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Parser.spec.d.ts +3 -1
- package/dist/parser/Parser.spec.js +1034 -805
- package/dist/parser/Parser.spec.js.map +1 -1
- package/dist/parser/SGParser.d.ts +9 -8
- package/dist/parser/SGParser.js +10 -8
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGParser.spec.js +27 -38
- package/dist/parser/SGParser.spec.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +98 -35
- package/dist/parser/SGTypes.js +169 -99
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +208 -122
- package/dist/parser/Statement.js +599 -364
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/Statement.spec.js +45 -21
- package/dist/parser/Statement.spec.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +1 -1
- package/dist/parser/TranspileState.js +7 -12
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/parser/tests/Parser.spec.js +3 -2
- package/dist/parser/tests/Parser.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/For.spec.js +33 -23
- package/dist/parser/tests/controlFlow/For.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +25 -20
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/If.spec.js +96 -94
- package/dist/parser/tests/controlFlow/If.spec.js.map +1 -1
- package/dist/parser/tests/controlFlow/While.spec.js +22 -16
- package/dist/parser/tests/controlFlow/While.spec.js.map +1 -1
- package/dist/parser/tests/expression/Additive.spec.js +8 -8
- package/dist/parser/tests/expression/Additive.spec.js.map +1 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +58 -21
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +61 -20
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +1 -1
- package/dist/parser/tests/expression/Boolean.spec.js +8 -8
- package/dist/parser/tests/expression/Boolean.spec.js.map +1 -1
- package/dist/parser/tests/expression/Call.spec.js +129 -21
- package/dist/parser/tests/expression/Call.spec.js.map +1 -1
- package/dist/parser/tests/expression/Exponential.spec.js +5 -5
- package/dist/parser/tests/expression/Exponential.spec.js.map +1 -1
- package/dist/parser/tests/expression/Function.spec.js +36 -36
- package/dist/parser/tests/expression/Function.spec.js.map +1 -1
- package/dist/parser/tests/expression/Indexing.spec.js +67 -22
- package/dist/parser/tests/expression/Indexing.spec.js.map +1 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +9 -9
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +1 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +123 -81
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +12 -12
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +1 -1
- package/dist/parser/tests/expression/Primary.spec.js +12 -12
- package/dist/parser/tests/expression/Primary.spec.js.map +1 -1
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js +10 -10
- package/dist/parser/tests/expression/RegexLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/Relational.spec.js +13 -13
- package/dist/parser/tests/expression/Relational.spec.js.map +1 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +24 -24
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +221 -81
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +287 -105
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +1 -1
- package/dist/parser/tests/expression/TypeExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js +127 -0
- package/dist/parser/tests/expression/TypeExpression.spec.js.map +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.d.ts +1 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js +52 -0
- package/dist/parser/tests/expression/UnaryExpression.spec.js.map +1 -0
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +15 -15
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +1 -1
- package/dist/parser/tests/statement/ConstStatement.spec.d.ts +1 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js +262 -0
- package/dist/parser/tests/statement/ConstStatement.spec.js.map +1 -0
- package/dist/parser/tests/statement/Continue.spec.d.ts +1 -0
- package/dist/parser/tests/statement/Continue.spec.js +119 -0
- package/dist/parser/tests/statement/Continue.spec.js.map +1 -0
- package/dist/parser/tests/statement/Declaration.spec.js +19 -19
- package/dist/parser/tests/statement/Declaration.spec.js.map +1 -1
- package/dist/parser/tests/statement/Dim.spec.js +22 -22
- package/dist/parser/tests/statement/Dim.spec.js.map +1 -1
- package/dist/parser/tests/statement/Enum.spec.js +111 -300
- package/dist/parser/tests/statement/Enum.spec.js.map +1 -1
- package/dist/parser/tests/statement/For.spec.js +9 -10
- package/dist/parser/tests/statement/For.spec.js.map +1 -1
- package/dist/parser/tests/statement/ForEach.spec.js +8 -9
- package/dist/parser/tests/statement/ForEach.spec.js.map +1 -1
- package/dist/parser/tests/statement/Function.spec.js +44 -35
- package/dist/parser/tests/statement/Function.spec.js.map +1 -1
- package/dist/parser/tests/statement/Goto.spec.js +5 -5
- package/dist/parser/tests/statement/Goto.spec.js.map +1 -1
- package/dist/parser/tests/statement/Increment.spec.js +20 -20
- package/dist/parser/tests/statement/Increment.spec.js.map +1 -1
- package/dist/parser/tests/statement/InterfaceStatement.spec.js +30 -196
- package/dist/parser/tests/statement/InterfaceStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.js +11 -11
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Misc.spec.js +16 -78
- package/dist/parser/tests/statement/Misc.spec.js.map +1 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +107 -90
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +14 -12
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +1 -1
- package/dist/parser/tests/statement/Set.spec.js +48 -35
- package/dist/parser/tests/statement/Set.spec.js.map +1 -1
- package/dist/parser/tests/statement/Stop.spec.js +6 -6
- package/dist/parser/tests/statement/Stop.spec.js.map +1 -1
- package/dist/parser/tests/statement/Throw.spec.js +6 -6
- package/dist/parser/tests/statement/Throw.spec.js.map +1 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +18 -16
- package/dist/parser/tests/statement/TryCatch.spec.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +1 -1
- package/dist/preprocessor/Manifest.js +3 -3
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/preprocessor/Manifest.spec.js +8 -8
- package/dist/preprocessor/Manifest.spec.js.map +1 -1
- package/dist/preprocessor/Preprocessor.d.ts +5 -6
- package/dist/preprocessor/Preprocessor.js +15 -11
- package/dist/preprocessor/Preprocessor.js.map +1 -1
- package/dist/preprocessor/Preprocessor.spec.js +25 -25
- package/dist/preprocessor/Preprocessor.spec.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.d.ts +1 -1
- package/dist/preprocessor/PreprocessorParser.js +7 -1
- package/dist/preprocessor/PreprocessorParser.js.map +1 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +13 -13
- package/dist/preprocessor/PreprocessorParser.spec.js.map +1 -1
- package/dist/roku-types/data.json +6544 -10519
- package/dist/roku-types/index.d.ts +662 -1934
- package/dist/types/ArrayType.d.ts +10 -9
- package/dist/types/ArrayType.js +65 -60
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/ArrayType.spec.js +36 -68
- package/dist/types/ArrayType.spec.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +11 -0
- package/dist/types/AssociativeArrayType.js +52 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +9 -0
- package/dist/types/BaseFunctionType.js +25 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +8 -5
- package/dist/types/BooleanType.js +14 -7
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BooleanType.spec.js +10 -6
- package/dist/types/BooleanType.spec.js.map +1 -1
- package/dist/types/BscType.d.ts +32 -21
- package/dist/types/BscType.js +118 -21
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +25 -0
- package/dist/types/BscTypeKind.js +30 -0
- package/dist/types/BscTypeKind.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.d.ts +23 -0
- package/dist/types/BuiltInInterfaceAdder.js +164 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.d.ts +1 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js +116 -0
- package/dist/types/BuiltInInterfaceAdder.spec.js.map +1 -0
- package/dist/types/ClassType.d.ts +17 -0
- package/dist/types/ClassType.js +58 -0
- package/dist/types/ClassType.js.map +1 -0
- package/dist/types/ClassType.spec.d.ts +1 -0
- package/dist/types/ClassType.spec.js +77 -0
- package/dist/types/ClassType.spec.js.map +1 -0
- package/dist/types/ComponentType.d.ts +26 -0
- package/dist/types/ComponentType.js +83 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +8 -5
- package/dist/types/DoubleType.js +18 -16
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DoubleType.spec.js +12 -6
- package/dist/types/DoubleType.spec.js.map +1 -1
- package/dist/types/DynamicType.d.ts +10 -5
- package/dist/types/DynamicType.js +16 -4
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/DynamicType.spec.js +16 -5
- package/dist/types/DynamicType.spec.js.map +1 -1
- package/dist/types/EnumType.d.ts +30 -12
- package/dist/types/EnumType.js +43 -17
- package/dist/types/EnumType.js.map +1 -1
- package/dist/types/EnumType.spec.d.ts +1 -0
- package/dist/types/EnumType.spec.js +33 -0
- package/dist/types/EnumType.spec.js.map +1 -0
- package/dist/types/FloatType.d.ts +8 -5
- package/dist/types/FloatType.js +18 -16
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FloatType.spec.js +4 -6
- package/dist/types/FloatType.spec.js.map +1 -1
- package/dist/types/FunctionType.d.ts +13 -8
- package/dist/types/FunctionType.js +30 -14
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +28 -0
- package/dist/types/InheritableType.js +152 -0
- package/dist/types/InheritableType.js.map +1 -0
- package/dist/types/IntegerType.d.ts +8 -5
- package/dist/types/IntegerType.js +18 -16
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/IntegerType.spec.js +8 -6
- package/dist/types/IntegerType.spec.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +12 -13
- package/dist/types/InterfaceType.js +20 -48
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/InterfaceType.spec.js +90 -56
- package/dist/types/InterfaceType.spec.js.map +1 -1
- package/dist/types/InvalidType.d.ts +7 -5
- package/dist/types/InvalidType.js +13 -7
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/InvalidType.spec.js +8 -6
- package/dist/types/InvalidType.spec.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +8 -5
- package/dist/types/LongIntegerType.js +17 -15
- package/dist/types/LongIntegerType.js.map +1 -1
- package/dist/types/LongIntegerType.spec.js +10 -6
- package/dist/types/LongIntegerType.spec.js.map +1 -1
- package/dist/types/NamespaceType.d.ts +12 -0
- package/dist/types/NamespaceType.js +28 -0
- package/dist/types/NamespaceType.js.map +1 -0
- package/dist/types/ObjectType.d.ts +9 -8
- package/dist/types/ObjectType.js +21 -11
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ObjectType.spec.js +3 -3
- package/dist/types/ObjectType.spec.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +63 -0
- package/dist/types/ReferenceType.js +423 -0
- package/dist/types/ReferenceType.js.map +1 -0
- package/dist/types/ReferenceType.spec.d.ts +1 -0
- package/dist/types/ReferenceType.spec.js +137 -0
- package/dist/types/ReferenceType.spec.js.map +1 -0
- package/dist/types/StringType.d.ts +11 -5
- package/dist/types/StringType.js +18 -7
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/StringType.spec.js +3 -5
- package/dist/types/StringType.spec.js.map +1 -1
- package/dist/types/TypedFunctionType.d.ts +22 -17
- package/dist/types/TypedFunctionType.js +78 -60
- package/dist/types/TypedFunctionType.js.map +1 -1
- package/dist/types/TypedFunctionType.spec.js +105 -20
- package/dist/types/TypedFunctionType.spec.js.map +1 -1
- package/dist/types/UninitializedType.d.ts +8 -6
- package/dist/types/UninitializedType.js +13 -7
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +20 -0
- package/dist/types/UnionType.js +123 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/UnionType.spec.d.ts +1 -0
- package/dist/types/UnionType.spec.js +130 -0
- package/dist/types/UnionType.spec.js.map +1 -0
- package/dist/types/VoidType.d.ts +8 -5
- package/dist/types/VoidType.js +14 -7
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/VoidType.spec.js +3 -3
- package/dist/types/VoidType.spec.js.map +1 -1
- package/dist/types/helper.spec.d.ts +1 -0
- package/dist/types/helper.spec.js +145 -0
- package/dist/types/helper.spec.js.map +1 -0
- package/dist/types/helpers.d.ts +19 -37
- package/dist/types/helpers.js +159 -99
- package/dist/types/helpers.js.map +1 -1
- package/dist/types/index.d.ts +22 -0
- package/dist/types/index.js +39 -0
- package/dist/types/index.js.map +1 -0
- package/dist/util.d.ts +167 -131
- package/dist/util.js +890 -350
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +7 -25
- package/dist/validators/ClassValidator.js +103 -194
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +165 -149
- package/dist/astUtils/AstEditor.js.map +0 -1
- package/dist/astUtils/AstEditor.spec.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.d.ts +0 -8
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js +0 -40
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +0 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js +0 -32
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.spec.js.map +0 -1
- package/dist/parser/SGTypes.spec.js +0 -351
- package/dist/parser/SGTypes.spec.js.map +0 -1
- package/dist/types/CustomType.d.ts +0 -12
- package/dist/types/CustomType.js +0 -44
- package/dist/types/CustomType.js.map +0 -1
- package/dist/types/LazyType.d.ts +0 -16
- package/dist/types/LazyType.js +0 -44
- package/dist/types/LazyType.js.map +0 -1
- /package/dist/astUtils/{AstEditor.spec.d.ts → Editor.spec.d.ts} +0 -0
- /package/dist/bscPlugin/{transpile/BrsFilePreTranspileProcessor.spec.d.ts → completions/CompletionsProcessor.spec.d.ts} +0 -0
- /package/dist/{parser/SGTypes.spec.d.ts → bscPlugin/hover/HoverProcessor.spec.d.ts} +0 -0
package/dist/LanguageServer.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.CustomCommands = exports.LanguageServer = void 0;
|
|
9
|
+
exports.NotificationName = exports.CustomCommands = exports.LanguageServer = void 0;
|
|
10
10
|
require("array-flat-polyfill");
|
|
11
11
|
const fastGlob = require("fast-glob");
|
|
12
12
|
const path = require("path");
|
|
@@ -24,6 +24,7 @@ const KeyedThrottler_1 = require("./KeyedThrottler");
|
|
|
24
24
|
const DiagnosticCollection_1 = require("./DiagnosticCollection");
|
|
25
25
|
const reflection_1 = require("./astUtils/reflection");
|
|
26
26
|
const SemanticTokenUtils_1 = require("./SemanticTokenUtils");
|
|
27
|
+
const BusyStatusTracker_1 = require("./BusyStatusTracker");
|
|
27
28
|
class LanguageServer {
|
|
28
29
|
constructor() {
|
|
29
30
|
this.connection = undefined;
|
|
@@ -53,6 +54,12 @@ class LanguageServer {
|
|
|
53
54
|
this.validateThrottler = new Throttler_1.Throttler(0);
|
|
54
55
|
this.sendDiagnosticsThrottler = new Throttler_1.Throttler(0);
|
|
55
56
|
this.boundValidateAll = this.validateAll.bind(this);
|
|
57
|
+
this.busyStatusTracker = new BusyStatusTracker_1.BusyStatusTracker();
|
|
58
|
+
this.busyStatusIndex = -1;
|
|
59
|
+
/**
|
|
60
|
+
* A unique project counter to help distinguish log entries in lsp mode
|
|
61
|
+
*/
|
|
62
|
+
this.projectCounter = 0;
|
|
56
63
|
this.diagnosticCollection = new DiagnosticCollection_1.DiagnosticCollection();
|
|
57
64
|
}
|
|
58
65
|
createConnection() {
|
|
@@ -66,6 +73,10 @@ class LanguageServer {
|
|
|
66
73
|
// Create a connection for the server. The connection uses Node's IPC as a transport.
|
|
67
74
|
// Also include all preview / proposed LSP features.
|
|
68
75
|
this.connection = this.createConnection();
|
|
76
|
+
// Send the current status of the busyStatusTracker anytime it changes
|
|
77
|
+
this.busyStatusTracker.on('change', (status) => {
|
|
78
|
+
this.sendBusyStatus(status);
|
|
79
|
+
});
|
|
69
80
|
//listen to all of the output log events and pipe them into the debug channel in the extension
|
|
70
81
|
this.loggerSubscription = Logger_1.Logger.subscribe((text) => {
|
|
71
82
|
this.connection.tracer.log(text);
|
|
@@ -120,9 +131,17 @@ class LanguageServer {
|
|
|
120
131
|
// Listen on the connection
|
|
121
132
|
this.connection.listen();
|
|
122
133
|
}
|
|
134
|
+
sendBusyStatus(status) {
|
|
135
|
+
this.busyStatusIndex = ++this.busyStatusIndex <= 0 ? 0 : this.busyStatusIndex;
|
|
136
|
+
this.connection.sendNotification(NotificationName.busyStatus, {
|
|
137
|
+
status: status,
|
|
138
|
+
timestamp: Date.now(),
|
|
139
|
+
index: this.busyStatusIndex,
|
|
140
|
+
activeRuns: [...this.busyStatusTracker.activeRuns]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
123
143
|
/**
|
|
124
144
|
* Called when the client starts initialization
|
|
125
|
-
* @param params
|
|
126
145
|
*/
|
|
127
146
|
onInitialize(params) {
|
|
128
147
|
let clientCapabilities = params.capabilities;
|
|
@@ -169,11 +188,17 @@ class LanguageServer {
|
|
|
169
188
|
*/
|
|
170
189
|
async getWorkspaceExcludeGlobs(workspaceFolder) {
|
|
171
190
|
var _a;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
191
|
+
let config = {
|
|
192
|
+
exclude: {}
|
|
193
|
+
};
|
|
194
|
+
//if supported, ask vscode for the `files.exclude` configuration
|
|
195
|
+
if (this.hasConfigurationCapability) {
|
|
196
|
+
//get any `files.exclude` globs to use to filter
|
|
197
|
+
config = await this.connection.workspace.getConfiguration({
|
|
198
|
+
scopeUri: workspaceFolder,
|
|
199
|
+
section: 'files'
|
|
200
|
+
});
|
|
201
|
+
}
|
|
177
202
|
return Object
|
|
178
203
|
.keys((_a = config === null || config === void 0 ? void 0 : config.exclude) !== null && _a !== void 0 ? _a : {})
|
|
179
204
|
.filter(x => { var _a; return (_a = config === null || config === void 0 ? void 0 : config.exclude) === null || _a === void 0 ? void 0 : _a[x]; })
|
|
@@ -206,10 +231,30 @@ class LanguageServer {
|
|
|
206
231
|
if (files.length > 0) {
|
|
207
232
|
return files.map(file => (0, util_1.standardizePath) `${path.dirname(file.src)}`);
|
|
208
233
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
234
|
+
//look for roku project folders
|
|
235
|
+
const rokuLikeDirs = (await Promise.all(
|
|
236
|
+
//find all folders containing a `manifest` file
|
|
237
|
+
(await roku_deploy_1.rokuDeploy.getFilePaths([
|
|
238
|
+
'**/manifest',
|
|
239
|
+
...excludes
|
|
240
|
+
//is there at least one .bs|.brs file under the `/source` folder?
|
|
241
|
+
], workspaceFolder)).map(async (manifestEntry) => {
|
|
242
|
+
const manifestDir = path.dirname(manifestEntry.src);
|
|
243
|
+
const files = await roku_deploy_1.rokuDeploy.getFilePaths([
|
|
244
|
+
'source/**/*.{brs,bs}',
|
|
245
|
+
...excludes
|
|
246
|
+
], manifestDir);
|
|
247
|
+
if (files.length > 0) {
|
|
248
|
+
return manifestDir;
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
//throw out nulls
|
|
252
|
+
)).filter(x => !!x);
|
|
253
|
+
if (rokuLikeDirs.length > 0) {
|
|
254
|
+
return rokuLikeDirs;
|
|
212
255
|
}
|
|
256
|
+
//treat the workspace folder as a brightscript project itself
|
|
257
|
+
return [workspaceFolder];
|
|
213
258
|
}
|
|
214
259
|
/**
|
|
215
260
|
* Find all folders with bsconfig.json files in them, and treat each as a project.
|
|
@@ -258,7 +303,6 @@ class LanguageServer {
|
|
|
258
303
|
}
|
|
259
304
|
/**
|
|
260
305
|
* Called when the client has finished initializing
|
|
261
|
-
* @param params
|
|
262
306
|
*/
|
|
263
307
|
async onInitialized() {
|
|
264
308
|
let projectCreatedDeferred = new deferred_1.Deferred();
|
|
@@ -298,7 +342,6 @@ class LanguageServer {
|
|
|
298
342
|
if (waitForFirstProject) {
|
|
299
343
|
await this.initialProjectsCreated;
|
|
300
344
|
}
|
|
301
|
-
let status;
|
|
302
345
|
for (let project of this.getProjects()) {
|
|
303
346
|
try {
|
|
304
347
|
await project.firstRunPromise;
|
|
@@ -311,7 +354,6 @@ class LanguageServer {
|
|
|
311
354
|
this.sendCriticalFailure(`BrighterScript language server failed to start: \n${e.message}`);
|
|
312
355
|
}
|
|
313
356
|
}
|
|
314
|
-
this.connection.sendNotification('build-status', status ? status : 'success');
|
|
315
357
|
}
|
|
316
358
|
/**
|
|
317
359
|
* Event handler for when the program wants to load file contents.
|
|
@@ -332,11 +374,16 @@ class LanguageServer {
|
|
|
332
374
|
else {
|
|
333
375
|
scopeUri = vscode_uri_1.URI.file(workspacePath).toString();
|
|
334
376
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
377
|
+
let config = {
|
|
378
|
+
configFile: undefined
|
|
379
|
+
};
|
|
380
|
+
//if the client supports configuration, look for config group called "brightscript"
|
|
381
|
+
if (this.hasConfigurationCapability) {
|
|
382
|
+
config = await this.connection.workspace.getConfiguration({
|
|
383
|
+
scopeUri: scopeUri,
|
|
384
|
+
section: 'brightscript'
|
|
385
|
+
});
|
|
386
|
+
}
|
|
340
387
|
let configFilePath;
|
|
341
388
|
//if there's a setting, we need to find the file or show error if it can't be found
|
|
342
389
|
if (config === null || config === void 0 ? void 0 : config.configFile) {
|
|
@@ -361,7 +408,12 @@ class LanguageServer {
|
|
|
361
408
|
//no config file could be found
|
|
362
409
|
return undefined;
|
|
363
410
|
}
|
|
364
|
-
|
|
411
|
+
/**
|
|
412
|
+
* @param projectPath path to the project
|
|
413
|
+
* @param workspacePath path to the workspace in which all project should reside or are referenced by
|
|
414
|
+
* @param projectNumber an optional project number to assign to the project. Used when reloading projects that should keep the same number
|
|
415
|
+
*/
|
|
416
|
+
async createProject(projectPath, workspacePath = projectPath, projectNumber) {
|
|
365
417
|
workspacePath !== null && workspacePath !== void 0 ? workspacePath : (workspacePath = projectPath);
|
|
366
418
|
let project = this.projects.find((x) => x.projectPath === projectPath);
|
|
367
419
|
//skip this project if we already have it
|
|
@@ -369,6 +421,9 @@ class LanguageServer {
|
|
|
369
421
|
return;
|
|
370
422
|
}
|
|
371
423
|
let builder = new ProgramBuilder_1.ProgramBuilder();
|
|
424
|
+
projectNumber !== null && projectNumber !== void 0 ? projectNumber : (projectNumber = this.projectCounter++);
|
|
425
|
+
builder.logger.prefix = `[prj${projectNumber}]`;
|
|
426
|
+
builder.logger.log(`Created project #${projectNumber} for: "${projectPath}"`);
|
|
372
427
|
//flush diagnostics every time the program finishes validating
|
|
373
428
|
builder.plugins.add({
|
|
374
429
|
name: 'bsc-language-server',
|
|
@@ -390,21 +445,11 @@ class LanguageServer {
|
|
|
390
445
|
//config file doesn't exist...let `brighterscript` resolve the default way
|
|
391
446
|
configFilePath = undefined;
|
|
392
447
|
}
|
|
393
|
-
|
|
394
|
-
cwd: cwd,
|
|
395
|
-
project: configFilePath,
|
|
396
|
-
watch: false,
|
|
397
|
-
createPackage: false,
|
|
398
|
-
deploy: false,
|
|
399
|
-
copyToStaging: false,
|
|
400
|
-
showDiagnosticsInConsole: false
|
|
401
|
-
});
|
|
402
|
-
firstRunPromise.catch((err) => {
|
|
403
|
-
console.error(err);
|
|
404
|
-
});
|
|
448
|
+
const firstRunDeferred = new deferred_1.Deferred();
|
|
405
449
|
let newProject = {
|
|
450
|
+
projectNumber: projectNumber,
|
|
406
451
|
builder: builder,
|
|
407
|
-
firstRunPromise:
|
|
452
|
+
firstRunPromise: firstRunDeferred.promise,
|
|
408
453
|
projectPath: projectPath,
|
|
409
454
|
workspacePath: workspacePath,
|
|
410
455
|
isFirstRunComplete: false,
|
|
@@ -413,19 +458,31 @@ class LanguageServer {
|
|
|
413
458
|
isStandaloneFileProject: false
|
|
414
459
|
};
|
|
415
460
|
this.projects.push(newProject);
|
|
416
|
-
|
|
461
|
+
try {
|
|
462
|
+
await builder.run({
|
|
463
|
+
cwd: cwd,
|
|
464
|
+
project: configFilePath,
|
|
465
|
+
watch: false,
|
|
466
|
+
createPackage: false,
|
|
467
|
+
deploy: false,
|
|
468
|
+
copyToStaging: false,
|
|
469
|
+
showDiagnosticsInConsole: false
|
|
470
|
+
});
|
|
417
471
|
newProject.isFirstRunComplete = true;
|
|
418
472
|
newProject.isFirstRunSuccessful = true;
|
|
419
|
-
|
|
473
|
+
firstRunDeferred.resolve();
|
|
474
|
+
}
|
|
475
|
+
catch (e) {
|
|
476
|
+
builder.logger.error(e);
|
|
477
|
+
firstRunDeferred.reject(e);
|
|
420
478
|
newProject.isFirstRunComplete = true;
|
|
421
479
|
newProject.isFirstRunSuccessful = false;
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
});
|
|
480
|
+
}
|
|
481
|
+
//if we found a deprecated brsconfig.json, add a diagnostic warning the user
|
|
482
|
+
if (configFilePath && path.basename(configFilePath) === 'brsconfig.json') {
|
|
483
|
+
builder.addDiagnostic(configFilePath, Object.assign(Object.assign({}, DiagnosticMessages_1.DiagnosticMessages.brsConfigJsonIsDeprecated()), { range: util_1.util.createRange(0, 0, 0, 0) }));
|
|
484
|
+
return this.sendDiagnostics();
|
|
485
|
+
}
|
|
429
486
|
}
|
|
430
487
|
async createStandaloneFileProject(srcPath) {
|
|
431
488
|
//skip this workspace if we already have it
|
|
@@ -458,6 +515,7 @@ class LanguageServer {
|
|
|
458
515
|
console.error(err);
|
|
459
516
|
});
|
|
460
517
|
let newProject = {
|
|
518
|
+
projectNumber: this.projectCounter++,
|
|
461
519
|
builder: builder,
|
|
462
520
|
firstRunPromise: firstRunPromise,
|
|
463
521
|
projectPath: srcPath,
|
|
@@ -486,7 +544,6 @@ class LanguageServer {
|
|
|
486
544
|
}
|
|
487
545
|
/**
|
|
488
546
|
* Provide a list of completion items based on the current cursor position
|
|
489
|
-
* @param textDocumentPosition
|
|
490
547
|
*/
|
|
491
548
|
async onCompletion(params) {
|
|
492
549
|
//ensure programs are initialized
|
|
@@ -494,17 +551,24 @@ class LanguageServer {
|
|
|
494
551
|
let filePath = util_1.util.uriToPath(params.textDocument.uri);
|
|
495
552
|
//wait until the file has settled
|
|
496
553
|
await this.keyedThrottler.onIdleOnce(filePath, true);
|
|
554
|
+
// make sure validation is complete
|
|
555
|
+
await this.validateAllThrottled();
|
|
556
|
+
//wait for the validation cycle to settle
|
|
557
|
+
await this.onValidateSettled();
|
|
497
558
|
let completions = this
|
|
498
559
|
.getProjects()
|
|
499
560
|
.flatMap(workspace => workspace.builder.program.getCompletions(filePath, params.position));
|
|
561
|
+
//only send one completion if name and type are the same
|
|
562
|
+
let completionsMap = new Map();
|
|
500
563
|
for (let completion of completions) {
|
|
501
564
|
completion.commitCharacters = ['.'];
|
|
565
|
+
let key = `${completion.sortText}-${completion.label}-${completion.kind}`;
|
|
566
|
+
completionsMap.set(key, completion);
|
|
502
567
|
}
|
|
503
|
-
return
|
|
568
|
+
return [...completionsMap.values()];
|
|
504
569
|
}
|
|
505
570
|
/**
|
|
506
571
|
* Provide a full completion item from the selection
|
|
507
|
-
* @param item
|
|
508
572
|
*/
|
|
509
573
|
onCompletionResolve(item) {
|
|
510
574
|
if (item.data === 1) {
|
|
@@ -518,6 +582,7 @@ class LanguageServer {
|
|
|
518
582
|
return item;
|
|
519
583
|
}
|
|
520
584
|
async onCodeAction(params) {
|
|
585
|
+
var _a;
|
|
521
586
|
//ensure programs are initialized
|
|
522
587
|
await this.waitAllProjectFirstRuns();
|
|
523
588
|
let srcPath = util_1.util.uriToPath(params.textDocument.uri);
|
|
@@ -531,7 +596,7 @@ class LanguageServer {
|
|
|
531
596
|
//clone the diagnostics for each code action, since certain diagnostics can have circular reference properties that kill the language server if serialized
|
|
532
597
|
for (const codeAction of codeActions) {
|
|
533
598
|
if (codeAction.diagnostics) {
|
|
534
|
-
codeAction.diagnostics = codeAction.diagnostics.map(x => util_1.util.toDiagnostic(x));
|
|
599
|
+
codeAction.diagnostics = (_a = codeAction.diagnostics) === null || _a === void 0 ? void 0 : _a.map(x => util_1.util.toDiagnostic(x, params.textDocument.uri));
|
|
535
600
|
}
|
|
536
601
|
}
|
|
537
602
|
return codeActions;
|
|
@@ -561,7 +626,7 @@ class LanguageServer {
|
|
|
561
626
|
if (project.isStandaloneFileProject === false) {
|
|
562
627
|
this.removeProject(project);
|
|
563
628
|
//create a new workspace/brs program
|
|
564
|
-
await this.createProject(project.projectPath, project.workspacePath);
|
|
629
|
+
await this.createProject(project.projectPath, project.workspacePath, project.projectNumber);
|
|
565
630
|
//handle temp workspace
|
|
566
631
|
}
|
|
567
632
|
else {
|
|
@@ -638,12 +703,10 @@ class LanguageServer {
|
|
|
638
703
|
* The CLIENT is in charge of what files to watch, so all client
|
|
639
704
|
* implementations should ensure that all valid project
|
|
640
705
|
* file types are watched (.brs,.bs,.xml,manifest, and any json/text/image files)
|
|
641
|
-
* @param params
|
|
642
706
|
*/
|
|
643
707
|
async onDidChangeWatchedFiles(params) {
|
|
644
708
|
//ensure programs are initialized
|
|
645
709
|
await this.waitAllProjectFirstRuns();
|
|
646
|
-
this.connection.sendNotification('build-status', 'building');
|
|
647
710
|
let projects = this.getProjects();
|
|
648
711
|
//convert all file paths to absolute paths
|
|
649
712
|
let changes = params.changes.map(x => {
|
|
@@ -712,37 +775,33 @@ class LanguageServer {
|
|
|
712
775
|
//give every workspace the chance to handle file changes
|
|
713
776
|
await Promise.all(projects.map((project) => this.handleFileChanges(project, changes)));
|
|
714
777
|
}
|
|
715
|
-
this.connection.sendNotification('build-status', 'success');
|
|
716
778
|
}
|
|
717
779
|
/**
|
|
718
780
|
* This only operates on files that match the specified files globs, so it is safe to throw
|
|
719
781
|
* any file changes you receive with no unexpected side-effects
|
|
720
|
-
* @param changes
|
|
721
782
|
*/
|
|
722
783
|
async handleFileChanges(project, changes) {
|
|
723
784
|
//this loop assumes paths are both file paths and folder paths, which eliminates the need to detect.
|
|
724
785
|
//All functions below can handle being given a file path AND a folder path, and will only operate on the one they are looking for
|
|
725
|
-
let consumeCount = 0;
|
|
726
786
|
await Promise.all(changes.map(async (change) => {
|
|
727
787
|
await this.keyedThrottler.run(change.srcPath, async () => {
|
|
728
|
-
|
|
788
|
+
if (await this.handleFileChange(project, change)) {
|
|
789
|
+
await this.validateAllThrottled();
|
|
790
|
+
}
|
|
729
791
|
});
|
|
730
792
|
}));
|
|
731
|
-
if (consumeCount > 0) {
|
|
732
|
-
await this.validateAllThrottled();
|
|
733
|
-
}
|
|
734
793
|
}
|
|
735
794
|
/**
|
|
736
795
|
* This only operates on files that match the specified files globs, so it is safe to throw
|
|
737
796
|
* any file changes you receive with no unexpected side-effects
|
|
738
|
-
* @
|
|
797
|
+
* @returns true if the file was handled by this project, false if it was not
|
|
739
798
|
*/
|
|
740
799
|
async handleFileChange(project, change) {
|
|
741
800
|
const { program, options, rootDir } = project.builder;
|
|
742
801
|
//deleted
|
|
743
802
|
if (change.type === node_1.FileChangeType.Deleted) {
|
|
744
803
|
//try to act on this path as a directory
|
|
745
|
-
project.builder.
|
|
804
|
+
project.builder.removeFilesInFolder(change.srcPath);
|
|
746
805
|
//if this is a file loaded in the program, remove it
|
|
747
806
|
if (program.hasFile(change.srcPath)) {
|
|
748
807
|
program.removeFile(change.srcPath);
|
|
@@ -787,14 +846,36 @@ class LanguageServer {
|
|
|
787
846
|
}
|
|
788
847
|
}
|
|
789
848
|
async onHover(params) {
|
|
849
|
+
var _a;
|
|
790
850
|
//ensure programs are initialized
|
|
791
851
|
await this.waitAllProjectFirstRuns();
|
|
792
852
|
const srcPath = util_1.util.uriToPath(params.textDocument.uri);
|
|
793
853
|
let projects = this.getProjects();
|
|
794
|
-
let hovers =
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
854
|
+
let hovers = projects
|
|
855
|
+
//get hovers from all projects
|
|
856
|
+
.map((x) => x.builder.program.getHover(srcPath, params.position))
|
|
857
|
+
//flatten to a single list
|
|
858
|
+
.flat();
|
|
859
|
+
const contents = [
|
|
860
|
+
...(hovers !== null && hovers !== void 0 ? hovers : [])
|
|
861
|
+
//pull all hover contents out into a flag array of strings
|
|
862
|
+
.map(x => {
|
|
863
|
+
return Array.isArray(x === null || x === void 0 ? void 0 : x.contents) ? x === null || x === void 0 ? void 0 : x.contents : [x === null || x === void 0 ? void 0 : x.contents];
|
|
864
|
+
}).flat()
|
|
865
|
+
//remove nulls
|
|
866
|
+
.filter(x => !!x)
|
|
867
|
+
//dedupe hovers across all projects
|
|
868
|
+
.reduce((set, content) => set.add(content), new Set()).values()
|
|
869
|
+
];
|
|
870
|
+
if (contents.length > 0) {
|
|
871
|
+
let hover = {
|
|
872
|
+
//use the range from the first hover
|
|
873
|
+
range: (_a = hovers[0]) === null || _a === void 0 ? void 0 : _a.range,
|
|
874
|
+
//the contents of all hovers
|
|
875
|
+
contents: contents
|
|
876
|
+
};
|
|
877
|
+
return hover;
|
|
878
|
+
}
|
|
798
879
|
}
|
|
799
880
|
async onDocumentClose(event) {
|
|
800
881
|
const { document } = event;
|
|
@@ -817,7 +898,6 @@ class LanguageServer {
|
|
|
817
898
|
//throttle file processing. first call is run immediately, and then the last call is processed.
|
|
818
899
|
await this.keyedThrottler.run(filePath, () => {
|
|
819
900
|
var _a;
|
|
820
|
-
this.connection.sendNotification('build-status', 'building');
|
|
821
901
|
let documentText = document.getText();
|
|
822
902
|
for (const project of this.getProjects()) {
|
|
823
903
|
//only add or replace existing files. All of the files in the project should
|
|
@@ -836,7 +916,7 @@ class LanguageServer {
|
|
|
836
916
|
await this.validateAllThrottled();
|
|
837
917
|
}
|
|
838
918
|
catch (e) {
|
|
839
|
-
this.sendCriticalFailure(`Critical error parsing
|
|
919
|
+
this.sendCriticalFailure(`Critical error parsing/validating ${filePath}: ${e.message}`);
|
|
840
920
|
}
|
|
841
921
|
}
|
|
842
922
|
async validateAll() {
|
|
@@ -846,13 +926,15 @@ class LanguageServer {
|
|
|
846
926
|
await this.synchronizeStandaloneProjects();
|
|
847
927
|
let projects = this.getProjects();
|
|
848
928
|
//validate all programs
|
|
849
|
-
await Promise.all(projects.map((
|
|
929
|
+
await Promise.all(projects.map((project) => {
|
|
930
|
+
project.builder.program.validate();
|
|
931
|
+
return project;
|
|
932
|
+
}));
|
|
850
933
|
}
|
|
851
934
|
catch (e) {
|
|
852
935
|
this.connection.console.error(e);
|
|
853
936
|
this.sendCriticalFailure(`Critical error validating project: ${e.message}${(_a = e.stack) !== null && _a !== void 0 ? _a : ''}`);
|
|
854
937
|
}
|
|
855
|
-
this.connection.sendNotification('build-status', 'success');
|
|
856
938
|
}
|
|
857
939
|
async onWorkspaceSymbol(params) {
|
|
858
940
|
await this.waitAllProjectFirstRuns();
|
|
@@ -894,7 +976,7 @@ class LanguageServer {
|
|
|
894
976
|
try {
|
|
895
977
|
const signatures = util_1.util.flatMap(await Promise.all(this.getProjects().map(project => project.builder.program.getSignatureHelp(filepath, params.position))), c => c);
|
|
896
978
|
const activeSignature = signatures.length > 0 ? 0 : null;
|
|
897
|
-
const activeParameter = activeSignature
|
|
979
|
+
const activeParameter = activeSignature !== null ? (_a = signatures[activeSignature]) === null || _a === void 0 ? void 0 : _a.index : null;
|
|
898
980
|
let results = {
|
|
899
981
|
signatures: signatures.map((s) => s.signature),
|
|
900
982
|
activeSignature: activeSignature,
|
|
@@ -917,20 +999,35 @@ class LanguageServer {
|
|
|
917
999
|
const srcPath = util_1.util.uriToPath(params.textDocument.uri);
|
|
918
1000
|
const results = util_1.util.flatMap(await Promise.all(this.getProjects().map(project => {
|
|
919
1001
|
return project.builder.program.getReferences(srcPath, position);
|
|
920
|
-
})), c => c);
|
|
1002
|
+
})), c => c !== null && c !== void 0 ? c : []);
|
|
921
1003
|
return results.filter((r) => r);
|
|
922
1004
|
}
|
|
1005
|
+
onValidateSettled() {
|
|
1006
|
+
return Promise.all([
|
|
1007
|
+
//wait for the validator to start running (or timeout if it never did)
|
|
1008
|
+
this.validateThrottler.onRunOnce(100),
|
|
1009
|
+
//wait for the validator to stop running (or resolve immediately if it's already idle)
|
|
1010
|
+
this.validateThrottler.onIdleOnce(true)
|
|
1011
|
+
]);
|
|
1012
|
+
}
|
|
923
1013
|
async onFullSemanticTokens(params) {
|
|
924
1014
|
await this.waitAllProjectFirstRuns();
|
|
1015
|
+
//wait for the file to settle (in case there are multiple file changes in quick succession)
|
|
925
1016
|
await this.keyedThrottler.onIdleOnce(util_1.util.uriToPath(params.textDocument.uri), true);
|
|
1017
|
+
// make sure validation is complete
|
|
1018
|
+
await this.validateAllThrottled();
|
|
1019
|
+
//wait for the validation cycle to settle
|
|
1020
|
+
await this.onValidateSettled();
|
|
926
1021
|
const srcPath = util_1.util.uriToPath(params.textDocument.uri);
|
|
927
1022
|
for (const project of this.projects) {
|
|
928
1023
|
//find the first program that has this file, since it would be incredibly inefficient to generate semantic tokens for the same file multiple times.
|
|
929
1024
|
if (project.builder.program.hasFile(srcPath)) {
|
|
930
1025
|
let semanticTokens = project.builder.program.getSemanticTokens(srcPath);
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
1026
|
+
if (semanticTokens !== undefined) {
|
|
1027
|
+
return {
|
|
1028
|
+
data: (0, SemanticTokenUtils_1.encodeSemanticTokens)(semanticTokens)
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
934
1031
|
}
|
|
935
1032
|
}
|
|
936
1033
|
}
|
|
@@ -941,9 +1038,10 @@ class LanguageServer {
|
|
|
941
1038
|
//Get only the changes to diagnostics since the last time we sent them to the client
|
|
942
1039
|
const patch = this.diagnosticCollection.getPatch(this.projects);
|
|
943
1040
|
for (let filePath in patch) {
|
|
944
|
-
const
|
|
1041
|
+
const uri = vscode_uri_1.URI.file(filePath).toString();
|
|
1042
|
+
const diagnostics = patch[filePath].map(d => util_1.util.toDiagnostic(d, uri));
|
|
945
1043
|
this.connection.sendDiagnostics({
|
|
946
|
-
uri:
|
|
1044
|
+
uri: uri,
|
|
947
1045
|
diagnostics: diagnostics
|
|
948
1046
|
});
|
|
949
1047
|
}
|
|
@@ -958,9 +1056,6 @@ class LanguageServer {
|
|
|
958
1056
|
return result;
|
|
959
1057
|
}
|
|
960
1058
|
}
|
|
961
|
-
/**
|
|
962
|
-
* @param srcPath The absolute path to the source file on disk
|
|
963
|
-
*/
|
|
964
1059
|
async transpileFile(srcPath) {
|
|
965
1060
|
//wait all program first runs
|
|
966
1061
|
await this.waitAllProjectFirstRuns();
|
|
@@ -981,22 +1076,35 @@ __decorate([
|
|
|
981
1076
|
AddStackToErrorMessage
|
|
982
1077
|
], LanguageServer.prototype, "onInitialize", null);
|
|
983
1078
|
__decorate([
|
|
984
|
-
|
|
1079
|
+
TrackBusyStatus
|
|
1080
|
+
], LanguageServer.prototype, "getProjectPaths", null);
|
|
1081
|
+
__decorate([
|
|
1082
|
+
TrackBusyStatus
|
|
1083
|
+
], LanguageServer.prototype, "syncProjects", null);
|
|
1084
|
+
__decorate([
|
|
1085
|
+
AddStackToErrorMessage,
|
|
1086
|
+
TrackBusyStatus
|
|
985
1087
|
], LanguageServer.prototype, "onInitialized", null);
|
|
986
1088
|
__decorate([
|
|
987
|
-
|
|
1089
|
+
TrackBusyStatus
|
|
1090
|
+
], LanguageServer.prototype, "createProject", null);
|
|
1091
|
+
__decorate([
|
|
1092
|
+
AddStackToErrorMessage,
|
|
1093
|
+
TrackBusyStatus
|
|
988
1094
|
], LanguageServer.prototype, "onCompletion", null);
|
|
989
1095
|
__decorate([
|
|
990
1096
|
AddStackToErrorMessage
|
|
991
1097
|
], LanguageServer.prototype, "onCompletionResolve", null);
|
|
992
1098
|
__decorate([
|
|
993
|
-
AddStackToErrorMessage
|
|
1099
|
+
AddStackToErrorMessage,
|
|
1100
|
+
TrackBusyStatus
|
|
994
1101
|
], LanguageServer.prototype, "onCodeAction", null);
|
|
995
1102
|
__decorate([
|
|
996
1103
|
AddStackToErrorMessage
|
|
997
1104
|
], LanguageServer.prototype, "onDidChangeConfiguration", null);
|
|
998
1105
|
__decorate([
|
|
999
|
-
AddStackToErrorMessage
|
|
1106
|
+
AddStackToErrorMessage,
|
|
1107
|
+
TrackBusyStatus
|
|
1000
1108
|
], LanguageServer.prototype, "onDidChangeWatchedFiles", null);
|
|
1001
1109
|
__decorate([
|
|
1002
1110
|
AddStackToErrorMessage
|
|
@@ -1005,34 +1113,49 @@ __decorate([
|
|
|
1005
1113
|
AddStackToErrorMessage
|
|
1006
1114
|
], LanguageServer.prototype, "onDocumentClose", null);
|
|
1007
1115
|
__decorate([
|
|
1008
|
-
AddStackToErrorMessage
|
|
1116
|
+
AddStackToErrorMessage,
|
|
1117
|
+
TrackBusyStatus
|
|
1009
1118
|
], LanguageServer.prototype, "validateTextDocument", null);
|
|
1010
1119
|
__decorate([
|
|
1011
|
-
|
|
1120
|
+
TrackBusyStatus
|
|
1121
|
+
], LanguageServer.prototype, "validateAll", null);
|
|
1122
|
+
__decorate([
|
|
1123
|
+
AddStackToErrorMessage,
|
|
1124
|
+
TrackBusyStatus
|
|
1012
1125
|
], LanguageServer.prototype, "onWorkspaceSymbol", null);
|
|
1013
1126
|
__decorate([
|
|
1014
|
-
AddStackToErrorMessage
|
|
1127
|
+
AddStackToErrorMessage,
|
|
1128
|
+
TrackBusyStatus
|
|
1015
1129
|
], LanguageServer.prototype, "onDocumentSymbol", null);
|
|
1016
1130
|
__decorate([
|
|
1017
|
-
AddStackToErrorMessage
|
|
1131
|
+
AddStackToErrorMessage,
|
|
1132
|
+
TrackBusyStatus
|
|
1018
1133
|
], LanguageServer.prototype, "onDefinition", null);
|
|
1019
1134
|
__decorate([
|
|
1020
|
-
AddStackToErrorMessage
|
|
1135
|
+
AddStackToErrorMessage,
|
|
1136
|
+
TrackBusyStatus
|
|
1021
1137
|
], LanguageServer.prototype, "onSignatureHelp", null);
|
|
1022
1138
|
__decorate([
|
|
1023
|
-
AddStackToErrorMessage
|
|
1139
|
+
AddStackToErrorMessage,
|
|
1140
|
+
TrackBusyStatus
|
|
1024
1141
|
], LanguageServer.prototype, "onReferences", null);
|
|
1025
1142
|
__decorate([
|
|
1026
|
-
AddStackToErrorMessage
|
|
1143
|
+
AddStackToErrorMessage,
|
|
1144
|
+
TrackBusyStatus
|
|
1027
1145
|
], LanguageServer.prototype, "onFullSemanticTokens", null);
|
|
1028
1146
|
__decorate([
|
|
1029
|
-
AddStackToErrorMessage
|
|
1147
|
+
AddStackToErrorMessage,
|
|
1148
|
+
TrackBusyStatus
|
|
1030
1149
|
], LanguageServer.prototype, "onExecuteCommand", null);
|
|
1031
1150
|
exports.LanguageServer = LanguageServer;
|
|
1032
1151
|
var CustomCommands;
|
|
1033
1152
|
(function (CustomCommands) {
|
|
1034
1153
|
CustomCommands["TranspileFile"] = "TranspileFile";
|
|
1035
1154
|
})(CustomCommands = exports.CustomCommands || (exports.CustomCommands = {}));
|
|
1155
|
+
var NotificationName;
|
|
1156
|
+
(function (NotificationName) {
|
|
1157
|
+
NotificationName["busyStatus"] = "busyStatus";
|
|
1158
|
+
})(NotificationName = exports.NotificationName || (exports.NotificationName = {}));
|
|
1036
1159
|
/**
|
|
1037
1160
|
* Wraps a method. If there's an error (either sync or via a promise),
|
|
1038
1161
|
* this appends the error's stack trace at the end of the error message so that the connection will
|
|
@@ -1064,4 +1187,16 @@ function AddStackToErrorMessage(target, propertyKey, descriptor) {
|
|
|
1064
1187
|
}
|
|
1065
1188
|
};
|
|
1066
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* An annotation used to wrap the method in a busyStatus tracking call
|
|
1192
|
+
*/
|
|
1193
|
+
function TrackBusyStatus(target, propertyKey, descriptor) {
|
|
1194
|
+
let originalMethod = descriptor.value;
|
|
1195
|
+
//wrapping the original method
|
|
1196
|
+
descriptor.value = function value(...args) {
|
|
1197
|
+
return this.busyStatusTracker.run(() => {
|
|
1198
|
+
return originalMethod.apply(this, args);
|
|
1199
|
+
}, originalMethod.name);
|
|
1200
|
+
};
|
|
1201
|
+
}
|
|
1067
1202
|
//# sourceMappingURL=LanguageServer.js.map
|