brighterscript 1.0.0-alpha.5 → 1.0.0-alpha.51
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/README.md +79 -138
- package/bsconfig.schema.json +196 -5
- 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 +45 -0
- package/dist/AstValidationSegmenter.js +322 -0
- package/dist/AstValidationSegmenter.js.map +1 -0
- package/dist/BsConfig.d.ts +161 -43
- package/dist/BusyStatusTracker.d.ts +61 -0
- package/dist/BusyStatusTracker.js +148 -0
- package/dist/BusyStatusTracker.js.map +1 -0
- package/dist/Cache.d.ts +3 -8
- package/dist/Cache.js +9 -14
- 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 +29 -4
- package/dist/CodeActionUtil.js +22 -5
- package/dist/CodeActionUtil.js.map +1 -1
- package/dist/CommentFlagProcessor.d.ts +20 -15
- package/dist/CommentFlagProcessor.js +143 -58
- package/dist/CommentFlagProcessor.js.map +1 -1
- package/dist/CrossScopeValidator.d.ts +68 -0
- package/dist/CrossScopeValidator.js +650 -0
- package/dist/CrossScopeValidator.js.map +1 -0
- package/dist/DependencyGraph.d.ts +8 -3
- package/dist/DependencyGraph.js +49 -16
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +21 -5
- package/dist/DiagnosticCollection.js +77 -24
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.d.ts +27 -6
- package/dist/DiagnosticFilterer.js +273 -60
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/DiagnosticManager.d.ts +83 -0
- package/dist/DiagnosticManager.js +422 -0
- package/dist/DiagnosticManager.js.map +1 -0
- package/dist/DiagnosticMessages.d.ts +602 -196
- package/dist/DiagnosticMessages.js +926 -342
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/DiagnosticSeverityAdjuster.d.ts +7 -0
- package/dist/DiagnosticSeverityAdjuster.js +45 -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 +136 -104
- package/dist/LanguageServer.js +577 -741
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +17 -13
- package/dist/Logger.js +64 -34
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +32 -10
- package/dist/PluginInterface.js +117 -7
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +302 -98
- package/dist/Program.js +1613 -726
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +39 -22
- package/dist/ProgramBuilder.js +245 -179
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.d.ts +227 -106
- package/dist/Scope.js +609 -557
- package/dist/Scope.js.map +1 -1
- package/dist/ScopeNamespaceLookup.d.ts +73 -0
- package/dist/ScopeNamespaceLookup.js +242 -0
- package/dist/ScopeNamespaceLookup.js.map +1 -0
- package/dist/SemanticTokenUtils.js +5 -1
- package/dist/SemanticTokenUtils.js.map +1 -1
- package/dist/Stopwatch.d.ts +4 -0
- package/dist/Stopwatch.js +8 -1
- package/dist/Stopwatch.js.map +1 -1
- package/dist/SymbolTable.d.ts +145 -26
- package/dist/SymbolTable.js +575 -64
- package/dist/SymbolTable.js.map +1 -1
- package/dist/SymbolTypeFlag.d.ts +9 -0
- package/dist/SymbolTypeFlag.js +14 -0
- package/dist/SymbolTypeFlag.js.map +1 -0
- 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 +5 -15
- package/dist/XmlScope.js +34 -90
- package/dist/XmlScope.js.map +1 -1
- package/dist/astUtils/CachedLookups.d.ts +50 -0
- package/dist/astUtils/CachedLookups.js +337 -0
- package/dist/astUtils/CachedLookups.js.map +1 -0
- package/dist/astUtils/Editor.d.ts +69 -0
- package/dist/astUtils/Editor.js +245 -0
- package/dist/astUtils/Editor.js.map +1 -0
- package/dist/astUtils/creators.d.ts +54 -19
- package/dist/astUtils/creators.js +242 -42
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +199 -85
- package/dist/astUtils/reflection.js +518 -145
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/stackedVisitor.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +117 -53
- package/dist/astUtils/visitors.js +95 -15
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/xml.d.ts +9 -8
- package/dist/astUtils/xml.js +12 -7
- package/dist/astUtils/xml.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.d.ts +26 -4
- package/dist/bscPlugin/BscPlugin.js +96 -4
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.d.ts +36 -0
- package/dist/bscPlugin/CallExpressionInfo.js +142 -0
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -0
- package/dist/bscPlugin/FileWriter.d.ts +19 -0
- package/dist/bscPlugin/FileWriter.js +79 -0
- package/dist/bscPlugin/FileWriter.js.map +1 -0
- package/dist/bscPlugin/SignatureHelpUtil.d.ts +10 -0
- package/dist/bscPlugin/SignatureHelpUtil.js +137 -0
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -0
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.d.ts +109 -7
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +676 -26
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.d.ts +17 -0
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.js +66 -0
- package/dist/bscPlugin/codeActions/FixAllCodeActionsProcessor.js.map +1 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.d.ts +18 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.js +31 -0
- package/dist/bscPlugin/codeActions/codeActionHelpers.js.map +1 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.d.ts +65 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js +633 -0
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -0
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +13 -0
- package/dist/bscPlugin/definition/DefinitionProvider.js +220 -0
- package/dist/bscPlugin/definition/DefinitionProvider.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 +18 -0
- package/dist/bscPlugin/hover/HoverProcessor.js +238 -0
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -0
- package/dist/bscPlugin/references/ReferencesProvider.d.ts +12 -0
- package/dist/bscPlugin/references/ReferencesProvider.js +57 -0
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.d.ts +7 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.js +77 -0
- package/dist/bscPlugin/selectionRanges/SelectionRangesProcessor.js.map +1 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.d.ts +14 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +164 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -0
- package/dist/bscPlugin/serialize/BslibManager.d.ts +12 -0
- package/dist/bscPlugin/serialize/BslibManager.js +46 -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 +80 -0
- package/dist/bscPlugin/serialize/FileSerializer.js.map +1 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js +22 -0
- package/dist/bscPlugin/symbols/DocumentSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.d.ts +7 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js +26 -0
- package/dist/bscPlugin/symbols/WorkspaceSymbolProcessor.js.map +1 -0
- package/dist/bscPlugin/symbols/symbolUtils.d.ts +5 -0
- package/dist/bscPlugin/symbols/symbolUtils.js +141 -0
- package/dist/bscPlugin/symbols/symbolUtils.js.map +1 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.d.ts +34 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.js +504 -0
- package/dist/bscPlugin/transpile/BrsFileTranspileProcessor.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/BrsFileAfterValidator.d.ts +7 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js +18 -0
- package/dist/bscPlugin/validation/BrsFileAfterValidator.js.map +1 -0
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +51 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +714 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ProgramValidator.d.ts +11 -0
- package/dist/bscPlugin/validation/ProgramValidator.js +33 -0
- package/dist/bscPlugin/validation/ProgramValidator.js.map +1 -0
- package/dist/bscPlugin/validation/ScopeValidator.d.ts +158 -0
- package/dist/bscPlugin/validation/ScopeValidator.js +1481 -0
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -0
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +8 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +50 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -0
- package/dist/cli.js +140 -28
- package/dist/cli.js.map +1 -1
- package/dist/common/Sequencer.d.ts +53 -0
- package/dist/common/Sequencer.js +233 -0
- package/dist/common/Sequencer.js.map +1 -0
- package/dist/deferred.d.ts +5 -3
- package/dist/deferred.js +10 -0
- package/dist/deferred.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +61 -4
- package/dist/diagnosticUtils.js +285 -25
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/examples/plugins/removePrint.d.ts +2 -2
- package/dist/examples/plugins/removePrint.js +8 -12
- package/dist/examples/plugins/removePrint.js.map +1 -1
- package/dist/files/AssetFile.d.ts +24 -0
- package/dist/files/AssetFile.js +25 -0
- package/dist/files/AssetFile.js.map +1 -0
- package/dist/files/BrsFile.d.ts +161 -87
- package/dist/files/BrsFile.js +919 -936
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BscFile.d.ts +102 -0
- package/dist/files/BscFile.js +15 -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 +21 -0
- package/dist/files/LazyFileData.js +54 -0
- package/dist/files/LazyFileData.js.map +1 -0
- package/dist/files/XmlFile.d.ts +80 -41
- package/dist/files/XmlFile.js +162 -137
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/globalCallables.d.ts +3 -1
- package/dist/globalCallables.js +424 -184
- package/dist/globalCallables.js.map +1 -1
- package/dist/index.d.ts +32 -4
- package/dist/index.js +54 -7
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +987 -125
- package/dist/interfaces.js +21 -0
- package/dist/interfaces.js.map +1 -1
- package/dist/lexer/Lexer.d.ts +51 -12
- package/dist/lexer/Lexer.js +214 -65
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/Token.d.ts +27 -11
- package/dist/lexer/Token.js +10 -2
- package/dist/lexer/Token.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +48 -2
- package/dist/lexer/TokenKind.js +167 -10
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/logging.d.ts +14 -0
- package/dist/logging.js +29 -0
- package/dist/logging.js.map +1 -0
- package/dist/lsp/ActionQueue.d.ts +35 -0
- package/dist/lsp/ActionQueue.js +115 -0
- package/dist/lsp/ActionQueue.js.map +1 -0
- package/dist/lsp/DocumentManager.d.ts +63 -0
- package/dist/lsp/DocumentManager.js +122 -0
- package/dist/lsp/DocumentManager.js.map +1 -0
- package/dist/lsp/LspProject.d.ts +287 -0
- package/dist/lsp/LspProject.js +3 -0
- package/dist/lsp/LspProject.js.map +1 -0
- package/dist/lsp/PathFilterer.d.ts +75 -0
- package/dist/lsp/PathFilterer.js +196 -0
- package/dist/lsp/PathFilterer.js.map +1 -0
- package/dist/lsp/Project.d.ts +200 -0
- package/dist/lsp/Project.js +562 -0
- package/dist/lsp/Project.js.map +1 -0
- package/dist/lsp/ProjectManager.d.ts +288 -0
- package/dist/lsp/ProjectManager.js +967 -0
- package/dist/lsp/ProjectManager.js.map +1 -0
- package/dist/lsp/ReaderWriterManager.d.ts +21 -0
- package/dist/lsp/ReaderWriterManager.js +60 -0
- package/dist/lsp/ReaderWriterManager.js.map +1 -0
- package/dist/lsp/worker/MessageHandler.d.ts +99 -0
- package/dist/lsp/worker/MessageHandler.js +138 -0
- package/dist/lsp/worker/MessageHandler.js.map +1 -0
- package/dist/lsp/worker/WorkerPool.d.ts +38 -0
- package/dist/lsp/worker/WorkerPool.js +78 -0
- package/dist/lsp/worker/WorkerPool.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.d.ts +168 -0
- package/dist/lsp/worker/WorkerThreadProject.js +205 -0
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.d.ts +15 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js +58 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -0
- package/dist/lsp/worker/run.js +14 -0
- package/dist/lsp/worker/run.js.map +1 -0
- package/dist/parser/AstNode.d.ts +205 -0
- package/dist/parser/AstNode.js +305 -0
- package/dist/parser/AstNode.js.map +1 -0
- package/dist/parser/BrightScriptDocParser.d.ts +56 -0
- package/dist/parser/BrightScriptDocParser.js +294 -0
- package/dist/parser/BrightScriptDocParser.js.map +1 -0
- package/dist/parser/BrsTranspileState.d.ts +22 -3
- package/dist/parser/BrsTranspileState.js +19 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +601 -220
- package/dist/parser/Expression.js +1516 -502
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.d.ts +137 -121
- package/dist/parser/Parser.js +1808 -982
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/SGParser.d.ts +30 -13
- package/dist/parser/SGParser.js +94 -56
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +134 -46
- package/dist/parser/SGTypes.js +206 -115
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +854 -267
- package/dist/parser/Statement.js +2416 -621
- package/dist/parser/Statement.js.map +1 -1
- package/dist/parser/TranspileState.d.ts +30 -14
- package/dist/parser/TranspileState.js +124 -27
- package/dist/parser/TranspileState.js.map +1 -1
- package/dist/preprocessor/Manifest.d.ts +6 -6
- package/dist/preprocessor/Manifest.js +17 -38
- package/dist/preprocessor/Manifest.js.map +1 -1
- package/dist/roku-types/data.json +20554 -0
- package/dist/roku-types/index.d.ts +5726 -0
- package/dist/roku-types/index.js +11 -0
- package/dist/roku-types/index.js.map +1 -0
- package/dist/types/ArrayType.d.ts +12 -5
- package/dist/types/ArrayType.js +95 -25
- package/dist/types/ArrayType.js.map +1 -1
- package/dist/types/AssociativeArrayType.d.ts +15 -0
- package/dist/types/AssociativeArrayType.js +64 -0
- package/dist/types/AssociativeArrayType.js.map +1 -0
- package/dist/types/BaseFunctionType.d.ts +10 -0
- package/dist/types/BaseFunctionType.js +26 -0
- package/dist/types/BaseFunctionType.js.map +1 -0
- package/dist/types/BooleanType.d.ts +9 -5
- package/dist/types/BooleanType.js +19 -8
- package/dist/types/BooleanType.js.map +1 -1
- package/dist/types/BscType.d.ts +41 -3
- package/dist/types/BscType.js +152 -0
- package/dist/types/BscType.js.map +1 -1
- package/dist/types/BscTypeKind.d.ts +28 -0
- package/dist/types/BscTypeKind.js +33 -0
- package/dist/types/BscTypeKind.js.map +1 -0
- package/dist/types/BuiltInInterfaceAdder.d.ts +28 -0
- package/dist/types/BuiltInInterfaceAdder.js +212 -0
- package/dist/types/BuiltInInterfaceAdder.js.map +1 -0
- package/dist/types/CallFuncableType.d.ts +24 -0
- package/dist/types/CallFuncableType.js +91 -0
- package/dist/types/CallFuncableType.js.map +1 -0
- package/dist/types/ClassType.d.ts +17 -0
- package/dist/types/ClassType.js +63 -0
- package/dist/types/ClassType.js.map +1 -0
- package/dist/types/ComponentType.d.ts +22 -0
- package/dist/types/ComponentType.js +110 -0
- package/dist/types/ComponentType.js.map +1 -0
- package/dist/types/DoubleType.d.ts +10 -5
- package/dist/types/DoubleType.js +21 -17
- package/dist/types/DoubleType.js.map +1 -1
- package/dist/types/DynamicType.d.ts +13 -5
- package/dist/types/DynamicType.js +26 -5
- package/dist/types/DynamicType.js.map +1 -1
- package/dist/types/EnumType.d.ts +42 -0
- package/dist/types/EnumType.js +101 -0
- package/dist/types/EnumType.js.map +1 -0
- package/dist/types/FloatType.d.ts +10 -5
- package/dist/types/FloatType.js +21 -17
- package/dist/types/FloatType.js.map +1 -1
- package/dist/types/FunctionType.d.ts +8 -22
- package/dist/types/FunctionType.js +25 -63
- package/dist/types/FunctionType.js.map +1 -1
- package/dist/types/InheritableType.d.ts +29 -0
- package/dist/types/InheritableType.js +173 -0
- package/dist/types/InheritableType.js.map +1 -0
- package/dist/types/InlineInterfaceType.d.ts +5 -0
- package/dist/types/InlineInterfaceType.js +17 -0
- package/dist/types/InlineInterfaceType.js.map +1 -0
- package/dist/types/IntegerType.d.ts +10 -5
- package/dist/types/IntegerType.js +21 -17
- package/dist/types/IntegerType.js.map +1 -1
- package/dist/types/InterfaceType.d.ts +14 -6
- package/dist/types/InterfaceType.js +30 -15
- package/dist/types/InterfaceType.js.map +1 -1
- package/dist/types/IntersectionType.d.ts +29 -0
- package/dist/types/IntersectionType.js +256 -0
- package/dist/types/IntersectionType.js.map +1 -0
- package/dist/types/InvalidType.d.ts +10 -5
- package/dist/types/InvalidType.js +21 -9
- package/dist/types/InvalidType.js.map +1 -1
- package/dist/types/LongIntegerType.d.ts +10 -5
- package/dist/types/LongIntegerType.js +21 -17
- package/dist/types/LongIntegerType.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 +12 -5
- package/dist/types/ObjectType.js +25 -8
- package/dist/types/ObjectType.js.map +1 -1
- package/dist/types/ReferenceType.d.ts +123 -0
- package/dist/types/ReferenceType.js +726 -0
- package/dist/types/ReferenceType.js.map +1 -0
- package/dist/types/StringType.d.ts +12 -5
- package/dist/types/StringType.js +23 -8
- package/dist/types/StringType.js.map +1 -1
- package/dist/types/TypeStatementType.d.ts +19 -0
- package/dist/types/TypeStatementType.js +56 -0
- package/dist/types/TypeStatementType.js.map +1 -0
- package/dist/types/TypedFunctionType.d.ts +34 -0
- package/dist/types/TypedFunctionType.js +157 -0
- package/dist/types/TypedFunctionType.js.map +1 -0
- package/dist/types/UninitializedType.d.ts +11 -6
- package/dist/types/UninitializedType.js +20 -11
- package/dist/types/UninitializedType.js.map +1 -1
- package/dist/types/UnionType.d.ts +27 -0
- package/dist/types/UnionType.js +196 -0
- package/dist/types/UnionType.js.map +1 -0
- package/dist/types/VoidType.d.ts +11 -5
- package/dist/types/VoidType.js +22 -8
- package/dist/types/VoidType.js.map +1 -1
- package/dist/types/helpers.d.ts +51 -0
- package/dist/types/helpers.js +329 -0
- package/dist/types/helpers.js.map +1 -0
- 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/types/roFunctionType.d.ts +11 -0
- package/dist/types/roFunctionType.js +37 -0
- package/dist/types/roFunctionType.js.map +1 -0
- package/dist/util.d.ts +325 -185
- package/dist/util.js +2135 -568
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +9 -15
- package/dist/validators/ClassValidator.js +93 -138
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +183 -138
- package/CHANGELOG.md +0 -1188
- package/dist/astUtils/creators.spec.js +0 -21
- package/dist/astUtils/creators.spec.js.map +0 -1
- package/dist/astUtils/index.d.ts +0 -7
- package/dist/astUtils/index.js +0 -26
- package/dist/astUtils/index.js.map +0 -1
- package/dist/astUtils/reflection.spec.d.ts +0 -1
- package/dist/astUtils/reflection.spec.js +0 -292
- package/dist/astUtils/reflection.spec.js.map +0 -1
- package/dist/astUtils/stackedVisitor.spec.d.ts +0 -1
- package/dist/astUtils/stackedVisitor.spec.js +0 -79
- package/dist/astUtils/stackedVisitor.spec.js.map +0 -1
- package/dist/astUtils/visitors.spec.d.ts +0 -1
- package/dist/astUtils/visitors.spec.js +0 -854
- package/dist/astUtils/visitors.spec.js.map +0 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.d.ts +0 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js +0 -194
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.spec.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.d.ts +0 -7
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js +0 -63
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.js.map +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.d.ts +0 -1
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js +0 -45
- package/dist/bscPlugin/semanticTokens/SemanticTokensProcessor.spec.js.map +0 -1
- package/dist/files/BrsFile.Class.spec.d.ts +0 -1
- package/dist/files/BrsFile.Class.spec.js +0 -1081
- package/dist/files/BrsFile.Class.spec.js.map +0 -1
- package/dist/files/BrsFile.spec.d.ts +0 -1
- package/dist/files/BrsFile.spec.js +0 -2524
- package/dist/files/BrsFile.spec.js.map +0 -1
- package/dist/files/XmlFile.spec.d.ts +0 -1
- package/dist/files/XmlFile.spec.js +0 -1065
- package/dist/files/XmlFile.spec.js.map +0 -1
- package/dist/files/tests/imports.spec.d.ts +0 -1
- package/dist/files/tests/imports.spec.js +0 -241
- package/dist/files/tests/imports.spec.js.map +0 -1
- package/dist/lexer/Character.spec.d.ts +0 -1
- package/dist/lexer/Character.spec.js +0 -27
- package/dist/lexer/Character.spec.js.map +0 -1
- package/dist/lexer/Lexer.spec.d.ts +0 -1
- package/dist/lexer/Lexer.spec.js +0 -1101
- package/dist/lexer/Lexer.spec.js.map +0 -1
- package/dist/lexer/index.d.ts +0 -3
- package/dist/lexer/index.js +0 -17
- package/dist/lexer/index.js.map +0 -1
- package/dist/parser/Parser.Class.spec.d.ts +0 -1
- package/dist/parser/Parser.Class.spec.js +0 -390
- package/dist/parser/Parser.Class.spec.js.map +0 -1
- package/dist/parser/Parser.spec.d.ts +0 -4
- package/dist/parser/Parser.spec.js +0 -1216
- package/dist/parser/Parser.spec.js.map +0 -1
- package/dist/parser/SGParser.spec.d.ts +0 -1
- package/dist/parser/SGParser.spec.js +0 -145
- package/dist/parser/SGParser.spec.js.map +0 -1
- package/dist/parser/SGTypes.spec.d.ts +0 -1
- package/dist/parser/SGTypes.spec.js +0 -351
- package/dist/parser/SGTypes.spec.js.map +0 -1
- package/dist/parser/Statement.spec.d.ts +0 -1
- package/dist/parser/Statement.spec.js +0 -94
- package/dist/parser/Statement.spec.js.map +0 -1
- package/dist/parser/index.d.ts +0 -3
- package/dist/parser/index.js +0 -16
- package/dist/parser/index.js.map +0 -1
- package/dist/parser/tests/Parser.spec.d.ts +0 -18
- package/dist/parser/tests/Parser.spec.js +0 -35
- package/dist/parser/tests/Parser.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/For.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/For.spec.js +0 -161
- package/dist/parser/tests/controlFlow/For.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/ForEach.spec.js +0 -106
- package/dist/parser/tests/controlFlow/ForEach.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/If.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/If.spec.js +0 -551
- package/dist/parser/tests/controlFlow/If.spec.js.map +0 -1
- package/dist/parser/tests/controlFlow/While.spec.d.ts +0 -1
- package/dist/parser/tests/controlFlow/While.spec.js +0 -107
- package/dist/parser/tests/controlFlow/While.spec.js.map +0 -1
- package/dist/parser/tests/expression/Additive.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Additive.spec.js +0 -99
- package/dist/parser/tests/expression/Additive.spec.js.map +0 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.d.ts +0 -1
- package/dist/parser/tests/expression/ArrayLiterals.spec.js +0 -254
- package/dist/parser/tests/expression/ArrayLiterals.spec.js.map +0 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.d.ts +0 -1
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js +0 -266
- package/dist/parser/tests/expression/AssociativeArrayLiterals.spec.js.map +0 -1
- package/dist/parser/tests/expression/Boolean.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Boolean.spec.js +0 -83
- package/dist/parser/tests/expression/Boolean.spec.js.map +0 -1
- package/dist/parser/tests/expression/Call.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Call.spec.js +0 -134
- package/dist/parser/tests/expression/Call.spec.js.map +0 -1
- package/dist/parser/tests/expression/Exponential.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Exponential.spec.js +0 -37
- package/dist/parser/tests/expression/Exponential.spec.js.map +0 -1
- package/dist/parser/tests/expression/Function.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Function.spec.js +0 -403
- package/dist/parser/tests/expression/Function.spec.js.map +0 -1
- package/dist/parser/tests/expression/Indexing.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Indexing.spec.js +0 -219
- package/dist/parser/tests/expression/Indexing.spec.js.map +0 -1
- package/dist/parser/tests/expression/Multiplicative.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Multiplicative.spec.js +0 -67
- package/dist/parser/tests/expression/Multiplicative.spec.js.map +0 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js +0 -201
- package/dist/parser/tests/expression/NullCoalescenceExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.d.ts +0 -1
- package/dist/parser/tests/expression/PrefixUnary.spec.js +0 -105
- package/dist/parser/tests/expression/PrefixUnary.spec.js.map +0 -1
- package/dist/parser/tests/expression/Primary.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Primary.spec.js +0 -149
- package/dist/parser/tests/expression/Primary.spec.js.map +0 -1
- package/dist/parser/tests/expression/Relational.spec.d.ts +0 -1
- package/dist/parser/tests/expression/Relational.spec.js +0 -83
- package/dist/parser/tests/expression/Relational.spec.js.map +0 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js +0 -201
- package/dist/parser/tests/expression/SourceLiteralExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js +0 -202
- package/dist/parser/tests/expression/TemplateStringExpression.spec.js.map +0 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.d.ts +0 -1
- package/dist/parser/tests/expression/TernaryExpression.spec.js +0 -323
- package/dist/parser/tests/expression/TernaryExpression.spec.js.map +0 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.d.ts +0 -1
- package/dist/parser/tests/statement/AssignmentOperators.spec.js +0 -79
- package/dist/parser/tests/statement/AssignmentOperators.spec.js.map +0 -1
- package/dist/parser/tests/statement/Declaration.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Declaration.spec.js +0 -108
- package/dist/parser/tests/statement/Declaration.spec.js.map +0 -1
- package/dist/parser/tests/statement/Dim.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Dim.spec.js +0 -73
- package/dist/parser/tests/statement/Dim.spec.js.map +0 -1
- package/dist/parser/tests/statement/Function.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Function.spec.js +0 -332
- package/dist/parser/tests/statement/Function.spec.js.map +0 -1
- package/dist/parser/tests/statement/Goto.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Goto.spec.js +0 -50
- package/dist/parser/tests/statement/Goto.spec.js.map +0 -1
- package/dist/parser/tests/statement/Increment.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Increment.spec.js +0 -117
- package/dist/parser/tests/statement/Increment.spec.js.map +0 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/LibraryStatement.spec.js +0 -74
- package/dist/parser/tests/statement/LibraryStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/Misc.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Misc.spec.js +0 -333
- package/dist/parser/tests/statement/Misc.spec.js.map +0 -1
- package/dist/parser/tests/statement/PrintStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/PrintStatement.spec.js +0 -181
- package/dist/parser/tests/statement/PrintStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.d.ts +0 -1
- package/dist/parser/tests/statement/ReturnStatement.spec.js +0 -94
- package/dist/parser/tests/statement/ReturnStatement.spec.js.map +0 -1
- package/dist/parser/tests/statement/Set.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Set.spec.js +0 -218
- package/dist/parser/tests/statement/Set.spec.js.map +0 -1
- package/dist/parser/tests/statement/Stop.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Stop.spec.js +0 -37
- package/dist/parser/tests/statement/Stop.spec.js.map +0 -1
- package/dist/parser/tests/statement/Throw.spec.d.ts +0 -1
- package/dist/parser/tests/statement/Throw.spec.js +0 -35
- package/dist/parser/tests/statement/Throw.spec.js.map +0 -1
- package/dist/parser/tests/statement/TryCatch.spec.d.ts +0 -1
- package/dist/parser/tests/statement/TryCatch.spec.js +0 -140
- package/dist/parser/tests/statement/TryCatch.spec.js.map +0 -1
- package/dist/preprocessor/Chunk.d.ts +0 -82
- package/dist/preprocessor/Chunk.js +0 -77
- package/dist/preprocessor/Chunk.js.map +0 -1
- package/dist/preprocessor/Manifest.spec.d.ts +0 -0
- package/dist/preprocessor/Manifest.spec.js +0 -105
- package/dist/preprocessor/Manifest.spec.js.map +0 -1
- package/dist/preprocessor/Preprocessor.d.ts +0 -60
- package/dist/preprocessor/Preprocessor.js +0 -156
- package/dist/preprocessor/Preprocessor.js.map +0 -1
- package/dist/preprocessor/Preprocessor.spec.d.ts +0 -1
- package/dist/preprocessor/Preprocessor.spec.js +0 -152
- package/dist/preprocessor/Preprocessor.spec.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.d.ts +0 -61
- package/dist/preprocessor/PreprocessorParser.js +0 -194
- package/dist/preprocessor/PreprocessorParser.js.map +0 -1
- package/dist/preprocessor/PreprocessorParser.spec.d.ts +0 -1
- package/dist/preprocessor/PreprocessorParser.spec.js +0 -116
- package/dist/preprocessor/PreprocessorParser.spec.js.map +0 -1
- package/dist/preprocessor/index.d.ts +0 -3
- package/dist/preprocessor/index.js +0 -16
- package/dist/preprocessor/index.js.map +0 -1
- package/dist/types/ArrayType.spec.d.ts +0 -1
- package/dist/types/ArrayType.spec.js +0 -30
- package/dist/types/ArrayType.spec.js.map +0 -1
- package/dist/types/BooleanType.spec.d.ts +0 -1
- package/dist/types/BooleanType.spec.js +0 -12
- package/dist/types/BooleanType.spec.js.map +0 -1
- package/dist/types/CustomType.d.ts +0 -10
- package/dist/types/CustomType.js +0 -35
- package/dist/types/CustomType.js.map +0 -1
- package/dist/types/DoubleType.spec.d.ts +0 -1
- package/dist/types/DoubleType.spec.js +0 -12
- package/dist/types/DoubleType.spec.js.map +0 -1
- package/dist/types/DynamicType.spec.d.ts +0 -1
- package/dist/types/DynamicType.spec.js +0 -12
- package/dist/types/DynamicType.spec.js.map +0 -1
- package/dist/types/FloatType.spec.d.ts +0 -1
- package/dist/types/FloatType.spec.js +0 -12
- package/dist/types/FloatType.spec.js.map +0 -1
- package/dist/types/FunctionType.spec.d.ts +0 -1
- package/dist/types/FunctionType.spec.js +0 -29
- package/dist/types/FunctionType.spec.js.map +0 -1
- package/dist/types/IntegerType.spec.d.ts +0 -1
- package/dist/types/IntegerType.spec.js +0 -12
- package/dist/types/IntegerType.spec.js.map +0 -1
- package/dist/types/InvalidType.spec.d.ts +0 -1
- package/dist/types/InvalidType.spec.js +0 -12
- package/dist/types/InvalidType.spec.js.map +0 -1
- package/dist/types/LazyType.d.ts +0 -15
- package/dist/types/LazyType.js +0 -32
- package/dist/types/LazyType.js.map +0 -1
- package/dist/types/LongIntegerType.spec.d.ts +0 -1
- package/dist/types/LongIntegerType.spec.js +0 -12
- package/dist/types/LongIntegerType.spec.js.map +0 -1
- package/dist/types/ObjectType.spec.d.ts +0 -1
- package/dist/types/ObjectType.spec.js +0 -12
- package/dist/types/ObjectType.spec.js.map +0 -1
- package/dist/types/StringType.spec.d.ts +0 -1
- package/dist/types/StringType.spec.js +0 -12
- package/dist/types/StringType.spec.js.map +0 -1
- package/dist/types/VoidType.spec.d.ts +0 -1
- package/dist/types/VoidType.spec.js +0 -12
- package/dist/types/VoidType.spec.js.map +0 -1
- /package/dist/{astUtils/creators.spec.d.ts → lsp/worker/run.d.ts} +0 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CancellationToken } from 'vscode-languageserver-protocol';
|
|
2
|
+
export declare class ActionQueue {
|
|
3
|
+
constructor(options?: ActionQueueOptions);
|
|
4
|
+
options: ActionQueueOptions;
|
|
5
|
+
private queue;
|
|
6
|
+
/**
|
|
7
|
+
* Run an action. This will run after all previous actions have completed
|
|
8
|
+
* @param action action to be run
|
|
9
|
+
*/
|
|
10
|
+
run<T = any>(action: Action<T>, data?: T): Promise<void>;
|
|
11
|
+
private isRunning;
|
|
12
|
+
/**
|
|
13
|
+
* Process the next pending action. Safe to call even if another action is running, we will only run one action at a time
|
|
14
|
+
*/
|
|
15
|
+
private process;
|
|
16
|
+
private stringifyJson;
|
|
17
|
+
get isIdle(): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Get a promise that resolves when the queue is empty
|
|
20
|
+
*/
|
|
21
|
+
onIdle(): Promise<void>;
|
|
22
|
+
once(eventname: 'idle'): Promise<void>;
|
|
23
|
+
on(eventName: 'idle', handler: () => any): any;
|
|
24
|
+
private emit;
|
|
25
|
+
private emitter;
|
|
26
|
+
dispose(): void;
|
|
27
|
+
}
|
|
28
|
+
export declare type Action<T = any> = (data: T, cancellationToken?: CancellationToken) => any;
|
|
29
|
+
export interface ActionQueueOptions {
|
|
30
|
+
/**
|
|
31
|
+
* Max milliseconds an individual action may run before it's cancelled. This is the amount of time the action actually runs,
|
|
32
|
+
* and does not count the time it waits in the queue
|
|
33
|
+
*/
|
|
34
|
+
maxActionDuration: number;
|
|
35
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ActionQueue = void 0;
|
|
4
|
+
const vscode_languageserver_protocol_1 = require("vscode-languageserver-protocol");
|
|
5
|
+
const deferred_1 = require("../deferred");
|
|
6
|
+
const safeJsonStringify = require("safe-json-stringify");
|
|
7
|
+
const eventemitter3_1 = require("eventemitter3");
|
|
8
|
+
const util_1 = require("../util");
|
|
9
|
+
class ActionQueue {
|
|
10
|
+
constructor(options) {
|
|
11
|
+
var _a;
|
|
12
|
+
var _b;
|
|
13
|
+
this.queue = [];
|
|
14
|
+
this.isRunning = false;
|
|
15
|
+
this.emitter = new eventemitter3_1.EventEmitter();
|
|
16
|
+
this.options = options !== null && options !== void 0 ? options : {};
|
|
17
|
+
(_a = (_b = this.options).maxActionDuration) !== null && _a !== void 0 ? _a : (_b.maxActionDuration = 2147483647);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Run an action. This will run after all previous actions have completed
|
|
21
|
+
* @param action action to be run
|
|
22
|
+
*/
|
|
23
|
+
run(action, data) {
|
|
24
|
+
const deferred = new deferred_1.Deferred();
|
|
25
|
+
this.queue.push({
|
|
26
|
+
action: action,
|
|
27
|
+
data: data,
|
|
28
|
+
deferred: deferred
|
|
29
|
+
});
|
|
30
|
+
void this.process();
|
|
31
|
+
return deferred.promise;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Process the next pending action. Safe to call even if another action is running, we will only run one action at a time
|
|
35
|
+
*/
|
|
36
|
+
async process() {
|
|
37
|
+
if (this.isRunning) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (this.queue.length === 0) {
|
|
41
|
+
this.emit('idle');
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
this.isRunning = true;
|
|
45
|
+
//run the action and resolve the deferred if it succeeds
|
|
46
|
+
const queueItem = this.queue.shift();
|
|
47
|
+
const cancellationTokenSource = new vscode_languageserver_protocol_1.CancellationTokenSource();
|
|
48
|
+
//process the action next tick to allow the event loop to catch up
|
|
49
|
+
let actionPromise = Promise.resolve().then(() => {
|
|
50
|
+
return queueItem.action(queueItem.data, cancellationTokenSource.token);
|
|
51
|
+
}).then((result) => {
|
|
52
|
+
queueItem.deferred.resolve(result);
|
|
53
|
+
});
|
|
54
|
+
//register a timeout that will reject if the action takes too long
|
|
55
|
+
let timeoutId;
|
|
56
|
+
const timeoutPromise = new Promise((resolve, reject) => {
|
|
57
|
+
timeoutId = setTimeout(() => {
|
|
58
|
+
cancellationTokenSource.cancel();
|
|
59
|
+
reject(new Error(`Action took longer than ${this.options.maxActionDuration}ms to complete. Data: ${this.stringifyJson(queueItem.data)}`));
|
|
60
|
+
}, this.options.maxActionDuration);
|
|
61
|
+
});
|
|
62
|
+
//wait for the action to finish or the timeout to trigger
|
|
63
|
+
await Promise.race([timeoutPromise, actionPromise]).catch((error) => {
|
|
64
|
+
//if we have an error, reject the deferred
|
|
65
|
+
queueItem.deferred.tryReject(error);
|
|
66
|
+
});
|
|
67
|
+
clearTimeout(timeoutId);
|
|
68
|
+
//small delay to allow the event loop to catch up
|
|
69
|
+
await util_1.default.sleep(1);
|
|
70
|
+
this.isRunning = false;
|
|
71
|
+
//at this point, we've properly handled the action, so try and handle the next one
|
|
72
|
+
await this.process();
|
|
73
|
+
}
|
|
74
|
+
stringifyJson(data) {
|
|
75
|
+
return safeJsonStringify(data, (_, value) => {
|
|
76
|
+
return typeof value === 'bigint' ? value.toString() : value;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
get isIdle() {
|
|
80
|
+
return this.queue.length === 0 && !this.isRunning;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Get a promise that resolves when the queue is empty
|
|
84
|
+
*/
|
|
85
|
+
onIdle() {
|
|
86
|
+
if (!this.isIdle) {
|
|
87
|
+
return this.once('idle');
|
|
88
|
+
}
|
|
89
|
+
return Promise.resolve();
|
|
90
|
+
}
|
|
91
|
+
once(eventName) {
|
|
92
|
+
return new Promise((resolve) => {
|
|
93
|
+
const disconnect = this.on(eventName, (...args) => {
|
|
94
|
+
disconnect();
|
|
95
|
+
resolve(args);
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
on(eventName, handler) {
|
|
100
|
+
this.emitter.on(eventName, handler);
|
|
101
|
+
return () => {
|
|
102
|
+
this.emitter.removeListener(eventName, handler);
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async emit(eventName, data) {
|
|
106
|
+
//emit these events on next tick, otherwise they will be processed immediately which could cause issues
|
|
107
|
+
await util_1.default.sleep(0);
|
|
108
|
+
this.emitter.emit(eventName, data);
|
|
109
|
+
}
|
|
110
|
+
dispose() {
|
|
111
|
+
this.emitter.removeAllListeners();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
exports.ActionQueue = ActionQueue;
|
|
115
|
+
//# sourceMappingURL=ActionQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionQueue.js","sourceRoot":"","sources":["../../src/lsp/ActionQueue.ts"],"names":[],"mappings":";;;AACA,mFAAyE;AACzE,0CAAuC;AACvC,yDAAyD;AACzD,iDAA6C;AAC7C,kCAA2B;AAE3B,MAAa,WAAW;IAEpB,YACI,OAA4B;;;QAQxB,UAAK,GAcR,EAAE,CAAC;QAiBA,cAAS,GAAG,KAAK,CAAC;QAqGlB,YAAO,GAAG,IAAI,4BAAY,EAAE,CAAC;QA1IjC,IAAI,CAAC,OAAO,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAS,CAAC;QACpC,YAAA,IAAI,CAAC,OAAO,EAAC,iBAAiB,uCAAjB,iBAAiB,GAAK,UAAa,EAAC;IACrD,CAAC;IAoBD;;;OAGG;IACI,GAAG,CAAU,MAAiB,EAAE,IAA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OAAO,IAAI,OAAO,CAAM,CAAC,OAAO,EAAE,EAAE;YAChC,MAAM,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC,SAA6C,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE;gBAClF,UAAU,EAAE,CAAC;gBACb,OAAO,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;IAGM,EAAE,CAAC,SAAiB,EAAE,OAA8B;QACvD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAc,CAAC,CAAC;QAC3C,OAAO,GAAG,EAAE;YACR,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,OAAc,CAAC,CAAC;QAC3D,CAAC,CAAC;IACN,CAAC;IAGO,KAAK,CAAC,IAAI,CAAC,SAAiB,EAAE,IAAU;QAC5C,uGAAuG;QACvG,MAAM,cAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAGM,OAAO;QACV,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IACtC,CAAC;CACJ;AApJD,kCAoJC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { MaybePromise } from '../interfaces';
|
|
2
|
+
/**
|
|
3
|
+
* Maintains a queued/buffered list of file operations. These operations don't actually do anything on their own.
|
|
4
|
+
* You need to call the .apply() function and provide an action to operate on them.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DocumentManager {
|
|
7
|
+
private options;
|
|
8
|
+
constructor(options: {
|
|
9
|
+
delay: number;
|
|
10
|
+
flushHandler?: (event: FlushEvent) => any;
|
|
11
|
+
});
|
|
12
|
+
private queue;
|
|
13
|
+
private timeoutHandle;
|
|
14
|
+
private throttle;
|
|
15
|
+
/**
|
|
16
|
+
* Add/set the contents of a file
|
|
17
|
+
*/
|
|
18
|
+
set(options: {
|
|
19
|
+
srcPath: string;
|
|
20
|
+
fileContents?: string;
|
|
21
|
+
allowStandaloneProject?: boolean;
|
|
22
|
+
}): void;
|
|
23
|
+
/**
|
|
24
|
+
* Delete a file or directory. If a directory is provided, all pending changes within that directory will be discarded
|
|
25
|
+
* and only the delete action will be queued
|
|
26
|
+
*/
|
|
27
|
+
delete(srcPath: string): void;
|
|
28
|
+
private isFlushRunning;
|
|
29
|
+
private flush;
|
|
30
|
+
/**
|
|
31
|
+
* Is the manager settled (i.e. no pending files, all files have been fully flushed)
|
|
32
|
+
*/
|
|
33
|
+
get isIdle(): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Returns a promise that resolves when there are no pending files and no active flushes are running. Will immediately resolve if there are no files,
|
|
36
|
+
* and will wait until files are flushed if there are files.
|
|
37
|
+
*/
|
|
38
|
+
onIdle(): Promise<void>;
|
|
39
|
+
once(eventName: 'flush'): Promise<FlushEvent>;
|
|
40
|
+
on(eventName: 'flush', handler: (data: any) => MaybePromise<void>): any;
|
|
41
|
+
private emitSync;
|
|
42
|
+
private emitter;
|
|
43
|
+
dispose(): void;
|
|
44
|
+
}
|
|
45
|
+
export interface SetDocumentAction {
|
|
46
|
+
srcPath: string;
|
|
47
|
+
type: 'set';
|
|
48
|
+
allowStandaloneProject?: boolean;
|
|
49
|
+
fileContents: string;
|
|
50
|
+
}
|
|
51
|
+
export interface DeleteDocumentAction {
|
|
52
|
+
srcPath: string;
|
|
53
|
+
type: 'delete';
|
|
54
|
+
allowStandaloneProject?: boolean;
|
|
55
|
+
}
|
|
56
|
+
export declare type DocumentAction = SetDocumentAction | DeleteDocumentAction;
|
|
57
|
+
export declare type DocumentActionWithStatus = DocumentAction & {
|
|
58
|
+
id: number;
|
|
59
|
+
status: 'accepted' | 'rejected';
|
|
60
|
+
};
|
|
61
|
+
export interface FlushEvent {
|
|
62
|
+
actions: DocumentAction[];
|
|
63
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DocumentManager = void 0;
|
|
4
|
+
const EventEmitter = require("eventemitter3");
|
|
5
|
+
const util_1 = require("../util");
|
|
6
|
+
/**
|
|
7
|
+
* Maintains a queued/buffered list of file operations. These operations don't actually do anything on their own.
|
|
8
|
+
* You need to call the .apply() function and provide an action to operate on them.
|
|
9
|
+
*/
|
|
10
|
+
class DocumentManager {
|
|
11
|
+
constructor(options) {
|
|
12
|
+
this.options = options;
|
|
13
|
+
this.queue = new Map();
|
|
14
|
+
this.isFlushRunning = false;
|
|
15
|
+
this.emitter = new EventEmitter();
|
|
16
|
+
}
|
|
17
|
+
throttle() {
|
|
18
|
+
if (this.timeoutHandle) {
|
|
19
|
+
clearTimeout(this.timeoutHandle);
|
|
20
|
+
}
|
|
21
|
+
this.timeoutHandle = setTimeout(() => {
|
|
22
|
+
void this.flush();
|
|
23
|
+
}, this.options.delay);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Add/set the contents of a file
|
|
27
|
+
*/
|
|
28
|
+
set(options) {
|
|
29
|
+
var _a;
|
|
30
|
+
const srcPath = util_1.default.standardizePath(options.srcPath);
|
|
31
|
+
if (this.queue.has(srcPath)) {
|
|
32
|
+
this.queue.delete(srcPath);
|
|
33
|
+
}
|
|
34
|
+
this.queue.set(srcPath, {
|
|
35
|
+
type: 'set',
|
|
36
|
+
srcPath: srcPath,
|
|
37
|
+
fileContents: options.fileContents,
|
|
38
|
+
allowStandaloneProject: (_a = options.allowStandaloneProject) !== null && _a !== void 0 ? _a : false
|
|
39
|
+
});
|
|
40
|
+
//schedule a future flush
|
|
41
|
+
this.throttle();
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Delete a file or directory. If a directory is provided, all pending changes within that directory will be discarded
|
|
45
|
+
* and only the delete action will be queued
|
|
46
|
+
*/
|
|
47
|
+
delete(srcPath) {
|
|
48
|
+
srcPath = util_1.default.standardizePath(srcPath);
|
|
49
|
+
//remove any pending action with this exact path
|
|
50
|
+
this.queue.delete(srcPath);
|
|
51
|
+
//we can't tell if this a directory, so just remove all pending changes for files that start with this path
|
|
52
|
+
for (const key of this.queue.keys()) {
|
|
53
|
+
if (key.startsWith(srcPath)) {
|
|
54
|
+
this.queue.delete(key);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//register this delete
|
|
58
|
+
this.queue.set(srcPath, { type: 'delete', srcPath: srcPath });
|
|
59
|
+
//schedule a future flush
|
|
60
|
+
this.throttle();
|
|
61
|
+
}
|
|
62
|
+
async flush() {
|
|
63
|
+
var _a, _b;
|
|
64
|
+
//if we're already running a flush, don't run another
|
|
65
|
+
if (this.isFlushRunning) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
this.isFlushRunning = true;
|
|
69
|
+
while (this.queue.size > 0) {
|
|
70
|
+
try {
|
|
71
|
+
const event = {
|
|
72
|
+
actions: [...this.queue.values()]
|
|
73
|
+
};
|
|
74
|
+
this.queue.clear();
|
|
75
|
+
await ((_b = (_a = this.options).flushHandler) === null || _b === void 0 ? void 0 : _b.call(_a, event));
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
console.error(e);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
this.emitSync('flush');
|
|
82
|
+
this.isFlushRunning = false;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Is the manager settled (i.e. no pending files, all files have been fully flushed)
|
|
86
|
+
*/
|
|
87
|
+
get isIdle() {
|
|
88
|
+
return this.queue.size === 0 && this.isFlushRunning === false;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Returns a promise that resolves when there are no pending files and no active flushes are running. Will immediately resolve if there are no files,
|
|
92
|
+
* and will wait until files are flushed if there are files.
|
|
93
|
+
*/
|
|
94
|
+
async onIdle() {
|
|
95
|
+
while (!this.isIdle) {
|
|
96
|
+
await this.once('flush');
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
once(eventName) {
|
|
100
|
+
return new Promise((resolve) => {
|
|
101
|
+
const off = this.on(eventName, (data) => {
|
|
102
|
+
off();
|
|
103
|
+
resolve(data);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
on(eventName, handler) {
|
|
108
|
+
this.emitter.on(eventName, handler);
|
|
109
|
+
return () => {
|
|
110
|
+
this.emitter.removeListener(eventName, handler);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
emitSync(eventName, data) {
|
|
114
|
+
this.emitter.emit(eventName, data);
|
|
115
|
+
}
|
|
116
|
+
dispose() {
|
|
117
|
+
this.queue = new Map();
|
|
118
|
+
this.emitter.removeAllListeners();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.DocumentManager = DocumentManager;
|
|
122
|
+
//# sourceMappingURL=DocumentManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentManager.js","sourceRoot":"","sources":["../../src/lsp/DocumentManager.ts"],"names":[],"mappings":";;;AAAA,8CAA8C;AAE9C,kCAA2B;AAE3B;;;GAGG;AACH,MAAa,eAAe;IAExB,YACY,OAGP;QAHO,YAAO,GAAP,OAAO,CAGd;QAGG,UAAK,GAAG,IAAI,GAAG,EAA0B,CAAC;QAmD1C,mBAAc,GAAG,KAAK,CAAC;QAgEvB,YAAO,GAAG,IAAI,YAAY,EAAE,CAAC;IArHrC,CAAC;IAKO,QAAQ;QACZ,IAAI,IAAI,CAAC,aAAa,EAAE;YACpB,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;SACpC;QACD,IAAI,CAAC,aAAa,GAAG,UAAU,CAAC,GAAG,EAAE;YACjC,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED;;OAEG;IACI,GAAG,CAAC,O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O,CAAC,cAAc,CAAC,SAAS,EAAE,OAAc,CAAC,CAAC;QAC3D,CAAC,CAAC;IACN,CAAC;IAGO,QAAQ,CAAC,SAAiB,EAAE,IAAK;QACrC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACvC,CAAC;IAIM,OAAO;QACV,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IACtC,CAAC;CACJ;AAlID,0CAkIC"}
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { Diagnostic, Position, Range, Location, DocumentSymbol, WorkspaceSymbol, CodeAction, CompletionList, SelectionRange, TextEdit } from 'vscode-languageserver-protocol';
|
|
2
|
+
import type { Hover, MaybePromise, SemanticToken } from '../interfaces';
|
|
3
|
+
import type { DocumentAction, DocumentActionWithStatus } from './DocumentManager';
|
|
4
|
+
import type { FileTranspileResult, SignatureInfoObj } from '../Program';
|
|
5
|
+
import type { Logger, LogLevel } from '../logging';
|
|
6
|
+
/**
|
|
7
|
+
* Defines the contract between the ProjectManager and the main or worker thread Project classes
|
|
8
|
+
*/
|
|
9
|
+
export interface LspProject {
|
|
10
|
+
/**
|
|
11
|
+
* Is this a standalone project?
|
|
12
|
+
*/
|
|
13
|
+
isStandaloneProject: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* A logger instance used for logging in this project
|
|
16
|
+
*/
|
|
17
|
+
logger: Logger;
|
|
18
|
+
/**
|
|
19
|
+
* The config used to activate this project
|
|
20
|
+
*/
|
|
21
|
+
activateOptions: ProjectConfig;
|
|
22
|
+
/**
|
|
23
|
+
* A unique key to represent this project. The format of this key may change, but it will always be unique to this project and can be used for comparison purposes.
|
|
24
|
+
*
|
|
25
|
+
* For directory-only projects, this is the path to the dir. For bsconfig.json projects, this is the path to the config file (typically bsconfig.json).
|
|
26
|
+
*/
|
|
27
|
+
projectKey: string;
|
|
28
|
+
/**
|
|
29
|
+
* The directory for the root of this project (typically where the bsconfig.json or manifest is located)
|
|
30
|
+
*/
|
|
31
|
+
projectDir: string;
|
|
32
|
+
/**
|
|
33
|
+
* A unique number for this project, generated during this current language server session. Mostly used so we can identify which project is doing logging
|
|
34
|
+
*/
|
|
35
|
+
projectNumber: number;
|
|
36
|
+
/**
|
|
37
|
+
* The root directory of the project.
|
|
38
|
+
* Only available after `.activate()` has completed
|
|
39
|
+
*/
|
|
40
|
+
rootDir: string;
|
|
41
|
+
/**
|
|
42
|
+
* The file patterns from bsconfig.json that were used to find all files for this project
|
|
43
|
+
*/
|
|
44
|
+
filePatterns: string[];
|
|
45
|
+
/**
|
|
46
|
+
* Path to a bsconfig.json file that will be used for this project.
|
|
47
|
+
* Only available after `.activate()` has completed
|
|
48
|
+
*/
|
|
49
|
+
bsconfigPath?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The contents of the bsconfig.json file. This is used to detect when the bsconfig file has not actually been changed (even if the fs says it did).
|
|
52
|
+
*
|
|
53
|
+
* Only available after `.activate()` has completed.
|
|
54
|
+
* @deprecated do not depend on this property. This will certainly be removed in a future release
|
|
55
|
+
*/
|
|
56
|
+
bsconfigFileContents?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The contents of the manifest file. This is used to detect when the manifest file has not actually been changed (even if the fs says it did).
|
|
59
|
+
*
|
|
60
|
+
* Only available after `.activate()` has completed.
|
|
61
|
+
* @deprecated do not depend on this property. This will certainly be removed in a future release
|
|
62
|
+
*/
|
|
63
|
+
manifestFileContents?: string;
|
|
64
|
+
/**
|
|
65
|
+
* The absolute source path to the manifest file (the file that maps to dest 'manifest').
|
|
66
|
+
* May differ from rootDir/manifest if the project uses a custom {src; dest} mapping.
|
|
67
|
+
*
|
|
68
|
+
* Only available after `.activate()` has completed.
|
|
69
|
+
*/
|
|
70
|
+
manifestSrcPath?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Initialize and start running the project. This will scan for all files, and build a full project in memory, then validate the project
|
|
73
|
+
* @param options
|
|
74
|
+
*/
|
|
75
|
+
activate(options: ProjectConfig): MaybePromise<ActivateResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* Get a promise that resolves when the project finishes activating
|
|
78
|
+
*/
|
|
79
|
+
whenActivated(): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Validate the project. This will trigger a full validation on any scopes that were changed since the last validation,
|
|
82
|
+
* and will also eventually emit a new 'diagnostics' event that includes all diagnostics for the project
|
|
83
|
+
*/
|
|
84
|
+
validate(): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* Cancel any active validation that's running
|
|
87
|
+
*/
|
|
88
|
+
cancelValidate(): MaybePromise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Get the list of all diagnostics from this project
|
|
91
|
+
*/
|
|
92
|
+
getDiagnostics(): MaybePromise<LspDiagnostic[]>;
|
|
93
|
+
/**
|
|
94
|
+
* Get the full list of semantic tokens for the given file path
|
|
95
|
+
* @param srcPath absolute path to the source file
|
|
96
|
+
*/
|
|
97
|
+
getSemanticTokens(options: {
|
|
98
|
+
srcPath: string;
|
|
99
|
+
}): MaybePromise<SemanticToken[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Transpile the specified file
|
|
102
|
+
* @param srcPath
|
|
103
|
+
*/
|
|
104
|
+
transpileFile(options: {
|
|
105
|
+
srcPath: string;
|
|
106
|
+
}): MaybePromise<FileTranspileResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Get the hover information for the specified position in the specified file
|
|
109
|
+
*/
|
|
110
|
+
getHover(options: {
|
|
111
|
+
srcPath: string;
|
|
112
|
+
position: Position;
|
|
113
|
+
}): MaybePromise<Hover[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Get the locations where the symbol at the specified position is defined
|
|
116
|
+
* @param options the file path and position to get the definition for
|
|
117
|
+
*/
|
|
118
|
+
getDefinition(options: {
|
|
119
|
+
srcPath: string;
|
|
120
|
+
position: Position;
|
|
121
|
+
}): MaybePromise<Location[]>;
|
|
122
|
+
/**
|
|
123
|
+
* Get the locations where the symbol at the specified position is defined
|
|
124
|
+
* @param options the file path and position to get the definition for
|
|
125
|
+
*/
|
|
126
|
+
getSignatureHelp(options: {
|
|
127
|
+
srcPath: string;
|
|
128
|
+
position: Position;
|
|
129
|
+
}): MaybePromise<SignatureInfoObj[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Get the list of symbols for the specified file
|
|
132
|
+
*/
|
|
133
|
+
getDocumentSymbol(options: {
|
|
134
|
+
srcPath: string;
|
|
135
|
+
}): MaybePromise<DocumentSymbol[]>;
|
|
136
|
+
/**
|
|
137
|
+
* Get the list of symbols for the entire workspace
|
|
138
|
+
*/
|
|
139
|
+
getWorkspaceSymbol(): Promise<WorkspaceSymbol[]>;
|
|
140
|
+
/**
|
|
141
|
+
* Get the list of references for the specified file and position
|
|
142
|
+
*/
|
|
143
|
+
getReferences(options: {
|
|
144
|
+
srcPath: string;
|
|
145
|
+
position: Position;
|
|
146
|
+
}): MaybePromise<Location[]>;
|
|
147
|
+
/**
|
|
148
|
+
* Compute the text edits required to keep `import` statements and `<script uri>` tags pointing
|
|
149
|
+
* at a source file when that source file is being renamed. Each project answers independently;
|
|
150
|
+
* the ProjectManager is responsible for reconciling agreement across projects.
|
|
151
|
+
*/
|
|
152
|
+
getFileRenameEdits(options: {
|
|
153
|
+
oldSrcPath: string;
|
|
154
|
+
newSrcPath: string;
|
|
155
|
+
}): MaybePromise<FileRenameTextEdit[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Get all of the code actions for the specified file and range
|
|
158
|
+
*/
|
|
159
|
+
getCodeActions(options: {
|
|
160
|
+
srcPath: string;
|
|
161
|
+
range: Range;
|
|
162
|
+
}): Promise<CodeAction[]>;
|
|
163
|
+
/**
|
|
164
|
+
* Get all "fix all" source actions for the specified file
|
|
165
|
+
*/
|
|
166
|
+
getSourceFixAllCodeActions(options: {
|
|
167
|
+
srcPath: string;
|
|
168
|
+
}): Promise<CodeAction[]>;
|
|
169
|
+
/**
|
|
170
|
+
* Get the selection ranges for the given positions in the specified file
|
|
171
|
+
*/
|
|
172
|
+
getSelectionRanges(options: {
|
|
173
|
+
srcPath: string;
|
|
174
|
+
positions: Position[];
|
|
175
|
+
}): MaybePromise<SelectionRange[]>;
|
|
176
|
+
/**
|
|
177
|
+
* Get the completions for the specified file and position
|
|
178
|
+
*/
|
|
179
|
+
getCompletions(options: {
|
|
180
|
+
srcPath: string;
|
|
181
|
+
position: Position;
|
|
182
|
+
}): Promise<CompletionList>;
|
|
183
|
+
/**
|
|
184
|
+
* Apply a series of file changes to the program.
|
|
185
|
+
* This will cancel any active validation.
|
|
186
|
+
* @param documentActions
|
|
187
|
+
* @returns a boolean indicating whether this project accepted any of the file changes. If false, then this project didn't recognize any of the files and thus did nothing
|
|
188
|
+
*/
|
|
189
|
+
applyFileChanges(documentActions: DocumentAction[]): Promise<DocumentActionWithStatus[]>;
|
|
190
|
+
/**
|
|
191
|
+
* An event that is emitted anytime the diagnostics for the project have changed (typically after a validate cycle has finished)
|
|
192
|
+
* @param eventName
|
|
193
|
+
* @param handler
|
|
194
|
+
*/
|
|
195
|
+
on(eventName: 'diagnostics', handler: (data: {
|
|
196
|
+
diagnostics: LspDiagnostic[];
|
|
197
|
+
}) => void): any;
|
|
198
|
+
on(eventName: 'all', handler: (eventName: string, data: Record<string, any>) => void): any;
|
|
199
|
+
/**
|
|
200
|
+
* List of items to dispose when this project is disposed
|
|
201
|
+
*/
|
|
202
|
+
disposables: Array<{
|
|
203
|
+
dispose(): void;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* Release all resources so this file can be safely garbage collected
|
|
207
|
+
*/
|
|
208
|
+
dispose(): void;
|
|
209
|
+
}
|
|
210
|
+
export interface ProjectConfig {
|
|
211
|
+
/**
|
|
212
|
+
* A unique key to represent this project. The format of this key may change, but it will always be unique to this project and can be used for comparison purposes.
|
|
213
|
+
*
|
|
214
|
+
* For directory-only projects, this is the path to the dir. For bsconfig.json projects, this is the path to the config file (typically bsconfig.json).
|
|
215
|
+
*/
|
|
216
|
+
projectKey: string;
|
|
217
|
+
/**
|
|
218
|
+
* The directory for the root of this project (typically where the bsconfig.json or manifest is located)
|
|
219
|
+
*/
|
|
220
|
+
projectDir: string;
|
|
221
|
+
/**
|
|
222
|
+
* Path to the workspace in which all project files reside or are referenced by
|
|
223
|
+
*/
|
|
224
|
+
workspaceFolder: string;
|
|
225
|
+
/**
|
|
226
|
+
* A list of glob patterns used to _exclude_ files from various bsconfig searches
|
|
227
|
+
*/
|
|
228
|
+
excludePatterns?: string[];
|
|
229
|
+
/**
|
|
230
|
+
* An optional project number to assign to the project within the context of a language server. reloaded projects should keep the same number if possible
|
|
231
|
+
*/
|
|
232
|
+
projectNumber?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Path to a bsconfig that should be used instead of the auto-discovery algorithm. If this is present, no bsconfig discovery should be used. and an error should be emitted if this file is missing
|
|
235
|
+
*/
|
|
236
|
+
bsconfigPath: string | undefined;
|
|
237
|
+
/**
|
|
238
|
+
* Should this project run in its own dedicated worker thread
|
|
239
|
+
* TODO - is there a better name for this?
|
|
240
|
+
*/
|
|
241
|
+
enableThreading?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* If present, this will override any files array found in bsconfig or the default.
|
|
244
|
+
*
|
|
245
|
+
* The list of file globs used to find all files for the project
|
|
246
|
+
* If using the {src;dest;} format, you can specify a different destination directory
|
|
247
|
+
* for the matched files in src.
|
|
248
|
+
*
|
|
249
|
+
*/
|
|
250
|
+
files?: Array<string | {
|
|
251
|
+
src: string | string[];
|
|
252
|
+
dest?: string;
|
|
253
|
+
}>;
|
|
254
|
+
}
|
|
255
|
+
export interface LspDiagnostic extends Diagnostic {
|
|
256
|
+
uri: string;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* A LSP TextEdit augmented with the URI of the document the edit applies to. Used for cross-file
|
|
260
|
+
* edits where each entry stands alone (e.g. file-rename edits collected across projects).
|
|
261
|
+
*/
|
|
262
|
+
export interface FileRenameTextEdit extends TextEdit {
|
|
263
|
+
uri: string;
|
|
264
|
+
}
|
|
265
|
+
export interface ActivateResponse {
|
|
266
|
+
/**
|
|
267
|
+
* The root directory of the project
|
|
268
|
+
*/
|
|
269
|
+
rootDir: string;
|
|
270
|
+
/**
|
|
271
|
+
* The path to the config file (i.e. `bsconfig.json`) that was used to load this project
|
|
272
|
+
*/
|
|
273
|
+
bsconfigPath: string;
|
|
274
|
+
/**
|
|
275
|
+
* The file patterns from bsconfig.json that were used to find all files for this project
|
|
276
|
+
*/
|
|
277
|
+
filePatterns: string[];
|
|
278
|
+
/**
|
|
279
|
+
* The logLevel used for this project's logger
|
|
280
|
+
*/
|
|
281
|
+
logLevel: LogLevel;
|
|
282
|
+
/**
|
|
283
|
+
* The absolute source path to the manifest file (the file that maps to dest 'manifest').
|
|
284
|
+
* May differ from rootDir/manifest if the project uses a custom {src; dest} mapping.
|
|
285
|
+
*/
|
|
286
|
+
manifestSrcPath: string;
|
|
287
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LspProject.js","sourceRoot":"","sources":["../../src/lsp/LspProject.ts"],"names":[],"mappings":""}
|