brighterscript 0.68.5 → 0.69.1
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 +12 -0
- package/dist/BusyStatusTracker.d.ts +37 -7
- package/dist/BusyStatusTracker.js +73 -8
- package/dist/BusyStatusTracker.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +19 -5
- package/dist/DiagnosticCollection.js +67 -16
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/LanguageServer.d.ts +82 -132
- package/dist/LanguageServer.js +403 -940
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +9 -4
- package/dist/Logger.js +30 -6
- package/dist/Logger.js.map +1 -1
- package/dist/PluginInterface.d.ts +1 -1
- package/dist/PluginInterface.js.map +1 -1
- package/dist/Program.d.ts +20 -2
- package/dist/Program.js +124 -49
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.d.ts +13 -6
- package/dist/ProgramBuilder.js +25 -15
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.js +6 -3
- package/dist/Scope.js.map +1 -1
- package/dist/SemanticTokenUtils.js +1 -1
- package/dist/SemanticTokenUtils.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.js +2 -1
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/completions/CompletionsProcessor.js +14 -4
- package/dist/bscPlugin/completions/CompletionsProcessor.js.map +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.js +1 -1
- package/dist/bscPlugin/hover/HoverProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.js +9 -9
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/common/Sequencer.d.ts +27 -0
- package/dist/common/Sequencer.js +113 -0
- package/dist/common/Sequencer.js.map +1 -0
- package/dist/common/Sequencer.spec.d.ts +1 -0
- package/dist/common/Sequencer.spec.js +75 -0
- package/dist/common/Sequencer.spec.js.map +1 -0
- package/dist/deferred.d.ts +2 -0
- package/dist/deferred.js +10 -0
- package/dist/deferred.js.map +1 -1
- package/dist/files/BrsFile.d.ts +1 -1
- package/dist/files/BrsFile.js +10 -15
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +8 -0
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/interfaces.d.ts +22 -2
- package/dist/lexer/Lexer.js +1 -1
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/logging.d.ts +6 -1
- package/dist/logging.js +14 -1
- package/dist/logging.js.map +1 -1
- 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/ActionQueue.spec.d.ts +1 -0
- package/dist/lsp/ActionQueue.spec.js +80 -0
- package/dist/lsp/ActionQueue.spec.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/DocumentManager.spec.d.ts +1 -0
- package/dist/lsp/DocumentManager.spec.js +103 -0
- package/dist/lsp/DocumentManager.spec.js.map +1 -0
- package/dist/lsp/LspProject.d.ts +231 -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/PathFilterer.spec.d.ts +1 -0
- package/dist/lsp/PathFilterer.spec.js +182 -0
- package/dist/lsp/PathFilterer.spec.js.map +1 -0
- package/dist/lsp/Project.d.ts +178 -0
- package/dist/lsp/Project.js +438 -0
- package/dist/lsp/Project.js.map +1 -0
- package/dist/lsp/Project.spec.d.ts +1 -0
- package/dist/lsp/Project.spec.js +236 -0
- package/dist/lsp/Project.spec.js.map +1 -0
- package/dist/lsp/ProjectManager.d.ts +221 -0
- package/dist/lsp/ProjectManager.js +735 -0
- package/dist/lsp/ProjectManager.js.map +1 -0
- package/dist/lsp/ProjectManager.spec.d.ts +1 -0
- package/dist/lsp/ProjectManager.spec.js +756 -0
- package/dist/lsp/ProjectManager.spec.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/MessageHandler.spec.d.ts +1 -0
- package/dist/lsp/worker/MessageHandler.spec.js +64 -0
- package/dist/lsp/worker/MessageHandler.spec.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/WorkerPool.spec.d.ts +1 -0
- package/dist/lsp/worker/WorkerPool.spec.js +59 -0
- package/dist/lsp/worker/WorkerPool.spec.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.d.ts +144 -0
- package/dist/lsp/worker/WorkerThreadProject.js +183 -0
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.d.ts +2 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.js +68 -0
- package/dist/lsp/worker/WorkerThreadProject.spec.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/util.d.ts +32 -5
- package/dist/util.js +117 -19
- package/dist/util.js.map +1 -1
- package/package.json +13 -3
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const PathFilterer_1 = require("./PathFilterer");
|
|
4
|
+
const testHelpers_spec_1 = require("../testHelpers.spec");
|
|
5
|
+
const chai_1 = require("chai");
|
|
6
|
+
const util_1 = require("../util");
|
|
7
|
+
const sinon_1 = require("sinon");
|
|
8
|
+
const sinon = (0, sinon_1.createSandbox)();
|
|
9
|
+
describe('PathFilterer', () => {
|
|
10
|
+
let filterer;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
filterer = new PathFilterer_1.PathFilterer();
|
|
13
|
+
sinon.restore();
|
|
14
|
+
});
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
sinon.restore();
|
|
17
|
+
});
|
|
18
|
+
it('allows all files through when no filters exist', () => {
|
|
19
|
+
(0, chai_1.expect)(filterer.filter([
|
|
20
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
21
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a/b/c/d.xml`,
|
|
22
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/e.txt`
|
|
23
|
+
])).to.eql([
|
|
24
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
25
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a/b/c/d.xml`,
|
|
26
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/e.txt`
|
|
27
|
+
]);
|
|
28
|
+
});
|
|
29
|
+
it('supports standalone workspace style', () => {
|
|
30
|
+
const filterer = new PathFilterer_1.PathCollection({
|
|
31
|
+
rootDir: (0, util_1.standardizePath) `${testHelpers_spec_1.cwd}/src/lsp/standalone-project-1`,
|
|
32
|
+
globs: [(0, util_1.standardizePath) `${testHelpers_spec_1.cwd}/.tmp/rootDir/source/main.bs`]
|
|
33
|
+
});
|
|
34
|
+
(0, chai_1.expect)(filterer.isMatch(`${testHelpers_spec_1.cwd}/.tmp/rootDir/source/main.bs`)).to.be.true;
|
|
35
|
+
});
|
|
36
|
+
it('filters files', () => {
|
|
37
|
+
filterer.registerExcludeList(testHelpers_spec_1.rootDir, ['**/*.brs']);
|
|
38
|
+
(0, chai_1.expect)(filterer.filter([
|
|
39
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
40
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
41
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
42
|
+
])).to.eql([
|
|
43
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`
|
|
44
|
+
]);
|
|
45
|
+
});
|
|
46
|
+
it('filters files but re-includes them if part of an include list', () => {
|
|
47
|
+
filterer.registerExcludeList(testHelpers_spec_1.rootDir, ['**/*.brs']);
|
|
48
|
+
filterer.registerIncludeList(testHelpers_spec_1.rootDir, ['**/a*.brs']);
|
|
49
|
+
(0, chai_1.expect)(filterer.filter([
|
|
50
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
51
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
52
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
53
|
+
])).to.eql([
|
|
54
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
55
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
it('supports removing lists', () => {
|
|
59
|
+
const removeExclude = filterer.registerExcludeList(testHelpers_spec_1.rootDir, ['**/*.brs']);
|
|
60
|
+
const removeInclude = filterer.registerIncludeList(testHelpers_spec_1.rootDir, ['**/a*.brs']);
|
|
61
|
+
(0, chai_1.expect)(filterer.filter([
|
|
62
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
63
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
64
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
65
|
+
])).to.eql([
|
|
66
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
67
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`
|
|
68
|
+
]);
|
|
69
|
+
removeInclude();
|
|
70
|
+
(0, chai_1.expect)(filterer.filter([
|
|
71
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
72
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
73
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
74
|
+
])).to.eql([
|
|
75
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`
|
|
76
|
+
]);
|
|
77
|
+
removeExclude();
|
|
78
|
+
(0, chai_1.expect)(filterer.filter([
|
|
79
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
80
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
81
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
82
|
+
])).to.eql([
|
|
83
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
84
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
85
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
86
|
+
]);
|
|
87
|
+
});
|
|
88
|
+
it('clear removes all exclude and include lists', () => {
|
|
89
|
+
filterer.registerExcludeList(testHelpers_spec_1.rootDir, ['**/components/**/*.brs']);
|
|
90
|
+
(0, chai_1.expect)(filterer.filter([
|
|
91
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
92
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
93
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
94
|
+
])).to.eql([]);
|
|
95
|
+
filterer.clear();
|
|
96
|
+
(0, chai_1.expect)(filterer.filter([
|
|
97
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
98
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
99
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
100
|
+
])).to.eql([
|
|
101
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
102
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
103
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
104
|
+
]);
|
|
105
|
+
});
|
|
106
|
+
it('works with null exclude list', () => {
|
|
107
|
+
filterer.registerExcludeList(testHelpers_spec_1.rootDir, null);
|
|
108
|
+
(0, chai_1.expect)(filterer.filter([
|
|
109
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
110
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
111
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
112
|
+
])).to.eql([
|
|
113
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
114
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
115
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
116
|
+
]);
|
|
117
|
+
});
|
|
118
|
+
it('works with null include list', () => {
|
|
119
|
+
filterer.registerExcludeList(testHelpers_spec_1.rootDir, ['**/*']);
|
|
120
|
+
filterer.registerIncludeList(testHelpers_spec_1.rootDir, null);
|
|
121
|
+
(0, chai_1.expect)(filterer.filter([
|
|
122
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/a.brs`,
|
|
123
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/b.brs`,
|
|
124
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/components/c.brs`
|
|
125
|
+
])).to.eql([]);
|
|
126
|
+
});
|
|
127
|
+
describe('registerExcludeMatcher', () => {
|
|
128
|
+
it('calls the callback function on every path', () => {
|
|
129
|
+
const spy = sinon.spy();
|
|
130
|
+
filterer.registerExcludeMatcher(spy);
|
|
131
|
+
filterer.filter([
|
|
132
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
133
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
134
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
135
|
+
]);
|
|
136
|
+
(0, chai_1.expect)(spy.getCalls().map(x => (0, util_1.standardizePath) `${x.args[0]}`)).to.eql([
|
|
137
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/a.brs`,
|
|
138
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/b.txt`,
|
|
139
|
+
(0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/c.brs`
|
|
140
|
+
]);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
describe('PathCollection', () => {
|
|
145
|
+
function doTest(globs, filePath, expected) {
|
|
146
|
+
const collection = new PathFilterer_1.PathCollection({
|
|
147
|
+
rootDir: testHelpers_spec_1.rootDir,
|
|
148
|
+
globs: globs
|
|
149
|
+
});
|
|
150
|
+
(0, chai_1.expect)(collection.isMatch(filePath)).to.equal(expected);
|
|
151
|
+
}
|
|
152
|
+
it('includes a file that matches a single pattern', () => {
|
|
153
|
+
doTest([
|
|
154
|
+
'**/*.brs'
|
|
155
|
+
], (0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/alpha.brs`, true);
|
|
156
|
+
});
|
|
157
|
+
it('includes a file that matches the 2nd pattern', () => {
|
|
158
|
+
doTest([
|
|
159
|
+
'**/*beta*.brs',
|
|
160
|
+
'**/*alpha*.brs'
|
|
161
|
+
], (0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/alpha.brs`, true);
|
|
162
|
+
});
|
|
163
|
+
it('includes a file that is included then excluded then included again', () => {
|
|
164
|
+
doTest([
|
|
165
|
+
'**/*.brs',
|
|
166
|
+
'!**/a*.brs',
|
|
167
|
+
'**/alpha.brs'
|
|
168
|
+
], (0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/alpha.brs`, true);
|
|
169
|
+
});
|
|
170
|
+
it('excludes a file that does not match the pattern', () => {
|
|
171
|
+
doTest([
|
|
172
|
+
'**/beta.brs'
|
|
173
|
+
], (0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/alpha.brs`, false);
|
|
174
|
+
});
|
|
175
|
+
it('excludes a file that matches first pattern but is excluded from the second pattern', () => {
|
|
176
|
+
doTest([
|
|
177
|
+
'**/*.brs',
|
|
178
|
+
'!**/alpha.brs'
|
|
179
|
+
], (0, util_1.standardizePath) `${testHelpers_spec_1.rootDir}/alpha.brs`, false);
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=PathFilterer.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PathFilterer.spec.js","sourceRoot":"","sources":["../../src/lsp/PathFilterer.spec.ts"],"names":[],"mappings":";;AAAA,iDAA8D;AAC9D,0DAAmD;AACnD,+BAA8B;AAC9B,kCAA+C;AAC/C,iCAAsC;AACtC,MAAM,KAAK,GAAG,IAAA,qBAAa,GAAE,CAAC;AAE9B,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC1B,IAAI,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ponse, LspDiagnostic, LspProject } from './LspProject';
|
|
2
|
+
import type { Hover, MaybePromise } from '../interfaces';
|
|
3
|
+
import type { DocumentSymbol, Position, Range, Location, WorkspaceSymbol } from 'vscode-languageserver-protocol';
|
|
4
|
+
import { CompletionList } from 'vscode-languageserver-protocol';
|
|
5
|
+
import type { DocumentAction, DocumentActionWithStatus } from './DocumentManager';
|
|
6
|
+
import type { SignatureInfoObj } from '../Program';
|
|
7
|
+
import type { BsConfig } from '../BsConfig';
|
|
8
|
+
import type { Logger } from '../logging';
|
|
9
|
+
export declare class Project implements LspProject {
|
|
10
|
+
constructor(options?: {
|
|
11
|
+
logger?: Logger;
|
|
12
|
+
projectIdentifier?: string;
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* Activates this project. Every call to `activate` should completely reset the project, clear all used ram and start from scratch.
|
|
16
|
+
*/
|
|
17
|
+
activate(options: ProjectConfig): Promise<ActivateResponse>;
|
|
18
|
+
isStandaloneProject: boolean;
|
|
19
|
+
logger: Logger;
|
|
20
|
+
/**
|
|
21
|
+
* Options used to activate this project
|
|
22
|
+
*/
|
|
23
|
+
activateOptions: ProjectConfig;
|
|
24
|
+
get rootDir(): string;
|
|
25
|
+
/**
|
|
26
|
+
* The file patterns from bsconfig.json that were used to find all files for this project
|
|
27
|
+
*/
|
|
28
|
+
get filePatterns(): string[];
|
|
29
|
+
/**
|
|
30
|
+
* Gets resolved when the project has finished activating
|
|
31
|
+
*/
|
|
32
|
+
private activationDeferred;
|
|
33
|
+
/**
|
|
34
|
+
* Promise that resolves when the project finishes activating
|
|
35
|
+
* @returns a promise that resolves when the project finishes activating
|
|
36
|
+
*/
|
|
37
|
+
whenActivated(): Promise<void>;
|
|
38
|
+
private validationCancelToken;
|
|
39
|
+
/**
|
|
40
|
+
* Validate the project. This will trigger a full validation on any scopes that were changed since the last validation,
|
|
41
|
+
* and will also eventually emit a new 'diagnostics' event that includes all diagnostics for the project.
|
|
42
|
+
*
|
|
43
|
+
* This will cancel any currently running validation and then run a new one.
|
|
44
|
+
*/
|
|
45
|
+
validate(): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Cancel any active running validation
|
|
48
|
+
*/
|
|
49
|
+
cancelValidate(): void;
|
|
50
|
+
getDiagnostics(): {
|
|
51
|
+
uri: string;
|
|
52
|
+
range: Range;
|
|
53
|
+
severity?: import("vscode-languageserver-types").DiagnosticSeverity;
|
|
54
|
+
code?: string | number;
|
|
55
|
+
codeDescription?: import("vscode-languageserver-types").CodeDescription;
|
|
56
|
+
source?: string;
|
|
57
|
+
message: string;
|
|
58
|
+
tags?: import("vscode-languageserver-types").DiagnosticTag[];
|
|
59
|
+
relatedInformation?: import("vscode-languageserver-types").DiagnosticRelatedInformation[];
|
|
60
|
+
data?: any;
|
|
61
|
+
}[];
|
|
62
|
+
/**
|
|
63
|
+
* Promise that resolves the next time the system is idle. If the system is already idle, it will resolve immediately
|
|
64
|
+
*/
|
|
65
|
+
private onIdle;
|
|
66
|
+
/**
|
|
67
|
+
* Add or replace the in-memory contents of the file at the specified path. This is typically called as the user is typing.
|
|
68
|
+
* This will cancel any pending validation cycles and queue a future validation cycle instead.
|
|
69
|
+
*/
|
|
70
|
+
applyFileChanges(documentActions: DocumentAction[]): Promise<DocumentActionWithStatus[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Determine if this project will accept the file at the specified path (i.e. does it match a pattern in the project's files array)
|
|
73
|
+
*/
|
|
74
|
+
static willAcceptFile(srcPath: string, files: BsConfig['files'], rootDir: string): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Set new contents for a file. This is safe to call any time. Changes will be queued and flushed at the correct times
|
|
77
|
+
* during the program's lifecycle flow
|
|
78
|
+
* @param srcPath absolute source path of the file
|
|
79
|
+
* @param fileContents the text contents of the file
|
|
80
|
+
* @returns true if this program accepted and added the file. false if the program didn't want the file, or if the contents didn't change
|
|
81
|
+
*/
|
|
82
|
+
private setFile;
|
|
83
|
+
/**
|
|
84
|
+
* Remove the in-memory file at the specified path. This is typically called when the user (or file system watcher) triggers a file delete
|
|
85
|
+
* @param srcPath absolute path to the File
|
|
86
|
+
* @returns true if we found and removed at least one file, or false if no files were removed
|
|
87
|
+
*/
|
|
88
|
+
private removeFileOrDirectory;
|
|
89
|
+
/**
|
|
90
|
+
* Get the full list of semantic tokens for the given file path
|
|
91
|
+
* @param options options for getting semantic tokens
|
|
92
|
+
* @param options.srcPath absolute path to the source file
|
|
93
|
+
*/
|
|
94
|
+
getSemanticTokens(options: {
|
|
95
|
+
srcPath: string;
|
|
96
|
+
}): Promise<import("../interfaces").SemanticToken[]>;
|
|
97
|
+
transpileFile(options: {
|
|
98
|
+
srcPath: string;
|
|
99
|
+
}): Promise<import("../Program").FileTranspileResult>;
|
|
100
|
+
getHover(options: {
|
|
101
|
+
srcPath: string;
|
|
102
|
+
position: Position;
|
|
103
|
+
}): Promise<Hover[]>;
|
|
104
|
+
getDefinition(options: {
|
|
105
|
+
srcPath: string;
|
|
106
|
+
position: Position;
|
|
107
|
+
}): Promise<Location[]>;
|
|
108
|
+
getSignatureHelp(options: {
|
|
109
|
+
srcPath: string;
|
|
110
|
+
position: Position;
|
|
111
|
+
}): Promise<SignatureInfoObj[]>;
|
|
112
|
+
getDocumentSymbol(options: {
|
|
113
|
+
srcPath: string;
|
|
114
|
+
}): Promise<DocumentSymbol[]>;
|
|
115
|
+
getWorkspaceSymbol(): Promise<WorkspaceSymbol[]>;
|
|
116
|
+
getReferences(options: {
|
|
117
|
+
srcPath: string;
|
|
118
|
+
position: Position;
|
|
119
|
+
}): Promise<Location[]>;
|
|
120
|
+
getCodeActions(options: {
|
|
121
|
+
srcPath: string;
|
|
122
|
+
range: Range;
|
|
123
|
+
}): Promise<import("vscode-languageserver-types").CodeAction[]>;
|
|
124
|
+
getCompletions(options: {
|
|
125
|
+
srcPath: string;
|
|
126
|
+
position: Position;
|
|
127
|
+
}): Promise<CompletionList>;
|
|
128
|
+
/**
|
|
129
|
+
* Manages the BrighterScript program. The main interface into the compiler/validator
|
|
130
|
+
*/
|
|
131
|
+
private builder;
|
|
132
|
+
/**
|
|
133
|
+
* The path to where the project resides
|
|
134
|
+
*/
|
|
135
|
+
projectPath: string;
|
|
136
|
+
/**
|
|
137
|
+
* A unique number for this project, generated during this current language server session. Mostly used so we can identify which project is doing logging
|
|
138
|
+
*/
|
|
139
|
+
projectNumber: number;
|
|
140
|
+
/**
|
|
141
|
+
* A unique name for this project used in logs to help keep track of everything
|
|
142
|
+
*/
|
|
143
|
+
projectIdentifier: string;
|
|
144
|
+
/**
|
|
145
|
+
* The path to the workspace where this project resides. A workspace can have multiple projects (by adding a bsconfig.json to each folder).
|
|
146
|
+
* Defaults to `.projectPath` if not set
|
|
147
|
+
*/
|
|
148
|
+
workspaceFolder: string;
|
|
149
|
+
/**
|
|
150
|
+
* Path to a bsconfig.json file that will be used for this project
|
|
151
|
+
*/
|
|
152
|
+
bsconfigPath?: string;
|
|
153
|
+
/**
|
|
154
|
+
* 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).
|
|
155
|
+
*
|
|
156
|
+
* Only available after `.activate()` has completed.
|
|
157
|
+
* @deprecated do not depend on this property. This will certainly be removed in a future release
|
|
158
|
+
*/
|
|
159
|
+
bsconfigFileContents?: string;
|
|
160
|
+
/**
|
|
161
|
+
* Find the path to the bsconfig.json file for this project
|
|
162
|
+
* @returns path to bsconfig.json, or undefined if unable to find it
|
|
163
|
+
*/
|
|
164
|
+
private getConfigFilePath;
|
|
165
|
+
on(eventName: 'validate-begin', handler: (data: any) => MaybePromise<void>): any;
|
|
166
|
+
on(eventName: 'validate-end', handler: (data: any) => MaybePromise<void>): any;
|
|
167
|
+
on(eventName: 'critical-failure', handler: (data: {
|
|
168
|
+
message: string;
|
|
169
|
+
}) => MaybePromise<void>): any;
|
|
170
|
+
on(eventName: 'diagnostics', handler: (data: {
|
|
171
|
+
diagnostics: LspDiagnostic[];
|
|
172
|
+
}) => MaybePromise<void>): any;
|
|
173
|
+
on(eventName: 'all', handler: (eventName: string, data: any) => MaybePromise<void>): any;
|
|
174
|
+
private emit;
|
|
175
|
+
private emitter;
|
|
176
|
+
disposables: LspProject['disposables'];
|
|
177
|
+
dispose(): void;
|
|
178
|
+
}
|