brighterscript 0.73.0 → 0.73.2
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/dist/BusyStatusTracker.js +3 -0
- package/dist/BusyStatusTracker.js.map +1 -1
- package/dist/DiagnosticMessages.d.ts +21 -1
- package/dist/DiagnosticMessages.js +26 -2
- package/dist/DiagnosticMessages.js.map +1 -1
- package/dist/LanguageServer.d.ts +14 -1
- package/dist/LanguageServer.js +51 -5
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Logger.d.ts +7 -7
- package/dist/Logger.js.map +1 -1
- package/dist/Program.d.ts +57 -5
- package/dist/Program.js +125 -3
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/RokuConstants.d.ts +37 -2
- package/dist/RokuConstants.js +32 -3
- package/dist/RokuConstants.js.map +1 -1
- package/dist/Scope.d.ts +3 -3
- package/dist/Scope.js.map +1 -1
- package/dist/ScopeNamespaceLookup.js.map +1 -1
- package/dist/Throttler.d.ts +1 -1
- package/dist/Throttler.js.map +1 -1
- package/dist/XmlScope.d.ts +2 -2
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +1 -1
- package/dist/astUtils/visitors.js +2 -0
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/bscPlugin/BscPlugin.js +4 -0
- package/dist/bscPlugin/BscPlugin.js.map +1 -1
- package/dist/bscPlugin/CallExpressionInfo.js.map +1 -1
- package/dist/bscPlugin/SignatureHelpUtil.js.map +1 -1
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js +3 -3
- package/dist/bscPlugin/codeActions/CodeActionsProcessor.js.map +1 -1
- package/dist/bscPlugin/definition/DefinitionProvider.d.ts +67 -2
- package/dist/bscPlugin/definition/DefinitionProvider.js +242 -4
- package/dist/bscPlugin/definition/DefinitionProvider.js.map +1 -1
- package/dist/bscPlugin/inlayHints/InlayHintProcessor.js.map +1 -1
- package/dist/bscPlugin/references/ReferencesProvider.js +7 -1
- package/dist/bscPlugin/references/ReferencesProvider.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/transpile/BrsFilePreTranspileProcessor.js.map +1 -1
- package/dist/bscPlugin/validation/BrsFileValidator.d.ts +14 -0
- package/dist/bscPlugin/validation/BrsFileValidator.js +33 -4
- package/dist/bscPlugin/validation/BrsFileValidator.js.map +1 -1
- package/dist/bscPlugin/validation/ScopeValidator.js.map +1 -1
- package/dist/bscPlugin/validation/XmlFileValidator.d.ts +18 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js +50 -0
- package/dist/bscPlugin/validation/XmlFileValidator.js.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/common/Sequencer.js.map +1 -1
- package/dist/diagnosticUtils.d.ts +1 -1
- package/dist/diagnosticUtils.js.map +1 -1
- package/dist/files/BrsFile.d.ts +2 -2
- package/dist/files/BrsFile.js +4 -0
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/XmlFile.d.ts +45 -0
- package/dist/files/XmlFile.js +258 -2
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/interfaces.d.ts +6 -3
- package/dist/lexer/Lexer.d.ts +26 -0
- package/dist/lexer/Lexer.js +151 -19
- package/dist/lexer/Lexer.js.map +1 -1
- package/dist/lexer/TokenKind.d.ts +27 -0
- package/dist/lexer/TokenKind.js +77 -3
- package/dist/lexer/TokenKind.js.map +1 -1
- package/dist/lsp/ActionQueue.js.map +1 -1
- package/dist/lsp/DocumentManager.js +4 -0
- package/dist/lsp/DocumentManager.js.map +1 -1
- package/dist/lsp/LspProject.d.ts +2 -2
- package/dist/lsp/Project.d.ts +2 -2
- package/dist/lsp/Project.js +2 -0
- package/dist/lsp/Project.js.map +1 -1
- package/dist/lsp/ProjectManager.d.ts +7 -2
- package/dist/lsp/ProjectManager.js +3 -1
- package/dist/lsp/ProjectManager.js.map +1 -1
- package/dist/lsp/worker/MessageHandler.d.ts +1 -0
- package/dist/lsp/worker/MessageHandler.js +9 -0
- package/dist/lsp/worker/MessageHandler.js.map +1 -1
- package/dist/lsp/worker/WorkerPool.d.ts +37 -16
- package/dist/lsp/worker/WorkerPool.js +87 -39
- package/dist/lsp/worker/WorkerPool.js.map +1 -1
- package/dist/lsp/worker/WorkerThreadProject.d.ts +16 -3
- package/dist/lsp/worker/WorkerThreadProject.js +42 -10
- package/dist/lsp/worker/WorkerThreadProject.js.map +1 -1
- package/dist/lsp/worker/WorkerThreadProjectRunner.js +6 -0
- package/dist/lsp/worker/WorkerThreadProjectRunner.js.map +1 -1
- package/dist/lsp/worker/run.js +20 -3
- package/dist/lsp/worker/run.js.map +1 -1
- package/dist/parser/AstNode.d.ts +55 -1
- package/dist/parser/AstNode.js +56 -5
- package/dist/parser/AstNode.js.map +1 -1
- package/dist/parser/BrsTranspileState.d.ts +44 -0
- package/dist/parser/BrsTranspileState.js +49 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.d.ts +14 -0
- package/dist/parser/Expression.js +28 -0
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.d.ts +0 -5
- package/dist/parser/Parser.js +8 -12
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/SGParser.d.ts +6 -0
- package/dist/parser/SGParser.js +31 -18
- package/dist/parser/SGParser.js.map +1 -1
- package/dist/parser/SGTypes.d.ts +18 -8
- package/dist/parser/SGTypes.js +42 -15
- package/dist/parser/SGTypes.js.map +1 -1
- package/dist/parser/Statement.d.ts +2 -2
- package/dist/parser/Statement.js +32 -2
- package/dist/parser/Statement.js.map +1 -1
- package/dist/preprocessor/Preprocessor.js.map +1 -1
- package/dist/roku-types/index.d.ts +4 -0
- package/dist/util.d.ts +13 -2
- package/dist/util.js +27 -3
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.d.ts +5 -4
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +8 -4
|
@@ -1,77 +1,125 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkerPool = void 0;
|
|
4
|
+
const worker_threads_1 = require("worker_threads");
|
|
4
5
|
const logging_1 = require("../../logging");
|
|
6
|
+
const os = require("os");
|
|
5
7
|
class WorkerPool {
|
|
6
8
|
constructor(factory) {
|
|
7
9
|
this.factory = factory;
|
|
8
10
|
this.logger = (0, logging_1.createLogger)();
|
|
9
11
|
/**
|
|
10
|
-
*
|
|
12
|
+
* The maximum number of worker threads (i.e. separate V8 isolates) this pool will create.
|
|
13
|
+
* Once this limit is reached, additional projects are multiplexed onto existing workers
|
|
14
|
+
* (each project still gets its own dedicated MessagePort) instead of spawning new threads.
|
|
11
15
|
*/
|
|
12
|
-
this.
|
|
16
|
+
this.maxWorkers = Math.max(1, os.cpus().length);
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* Every worker thread currently in the pool, along with how many projects are attached to it
|
|
15
19
|
*/
|
|
16
|
-
this.
|
|
20
|
+
this.workers = [];
|
|
17
21
|
}
|
|
18
22
|
/**
|
|
19
|
-
*
|
|
20
|
-
* @param count the number of total free workers that should exist when this function exits
|
|
23
|
+
* Create a new worker and add it to the pool
|
|
21
24
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
this.
|
|
25
|
+
createWorker() {
|
|
26
|
+
const entry = {
|
|
27
|
+
worker: this.factory(),
|
|
28
|
+
projectCount: 0
|
|
29
|
+
};
|
|
30
|
+
this.workers.push(entry);
|
|
31
|
+
//stop tracking a worker once it unexpectedly exits, so it can't be reused and doesn't consume a maxWorkers slot forever
|
|
32
|
+
entry.worker.once('exit', () => this.removeWorker(entry.worker));
|
|
33
|
+
return entry;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Stop tracking a worker in this pool. Does NOT terminate the worker (it's assumed to already be gone,
|
|
37
|
+
* e.g. because it exited/crashed). Safe to call even if the worker is already untracked (e.g. because
|
|
38
|
+
* `releaseProject()` already removed it as part of an intentional shutdown).
|
|
39
|
+
*/
|
|
40
|
+
removeWorker(worker) {
|
|
41
|
+
const index = this.workers.findIndex(x => x.worker === worker);
|
|
42
|
+
if (index > -1) {
|
|
43
|
+
this.workers.splice(index, 1);
|
|
25
44
|
}
|
|
26
45
|
}
|
|
27
46
|
/**
|
|
28
|
-
*
|
|
47
|
+
* Find the worker entry with the fewest attached projects
|
|
29
48
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
this.allWorkers.push(worker);
|
|
33
|
-
return worker;
|
|
49
|
+
getLeastLoadedEntry() {
|
|
50
|
+
return this.workers.reduce((least, current) => (current.projectCount < least.projectCount ? current : least), this.workers[0]);
|
|
34
51
|
}
|
|
35
52
|
/**
|
|
36
|
-
*
|
|
37
|
-
* @
|
|
53
|
+
* Ensure that there are at least `count` workers created in the pool
|
|
54
|
+
* @param count the minimum number of workers that should exist when this function exits
|
|
38
55
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
56
|
+
preload(count) {
|
|
57
|
+
while (this.workers.length < Math.min(count, this.maxWorkers)) {
|
|
58
|
+
this.createWorker();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Assign a new project to a worker thread. Prefers reusing an existing idle (zero-project) worker
|
|
63
|
+
* (e.g. one created via `preload()`). If none is available and the pool hasn't yet reached `maxWorkers`,
|
|
64
|
+
* a new worker is created for this project. Otherwise, the project is attached to the least-loaded
|
|
65
|
+
* existing worker via its own dedicated `MessagePort`, so multiple projects can share a single worker
|
|
66
|
+
* thread/isolate.
|
|
67
|
+
* @returns the worker thread hosting this project, and the MessagePort dedicated to it
|
|
68
|
+
*/
|
|
69
|
+
assignProject() {
|
|
70
|
+
let entry = this.workers.find(x => x.projectCount === 0);
|
|
71
|
+
if (!entry) {
|
|
72
|
+
//the `=== 0` check guards against a nonsensical maxWorkers (0, negative, NaN) stranding the pool at zero workers
|
|
73
|
+
if (this.workers.length === 0 || this.workers.length < this.maxWorkers) {
|
|
74
|
+
this.logger.log('Creating new worker thread');
|
|
75
|
+
entry = this.createWorker();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
this.logger.log('Reusing existing worker thread');
|
|
79
|
+
entry = this.getLeastLoadedEntry();
|
|
80
|
+
}
|
|
44
81
|
}
|
|
45
82
|
else {
|
|
46
|
-
|
|
47
|
-
this.logger.log('Reusing existing worker thread');
|
|
48
|
-
return this.freeWorkers.pop();
|
|
83
|
+
this.logger.log('Reusing preloaded/idle worker thread');
|
|
49
84
|
}
|
|
85
|
+
entry.projectCount++;
|
|
86
|
+
const { port1, port2 } = new worker_threads_1.MessageChannel();
|
|
87
|
+
entry.worker.postMessage({ type: 'attachProject', port: port2 }, [port2]);
|
|
88
|
+
return { worker: entry.worker, port: port1 };
|
|
50
89
|
}
|
|
51
90
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
91
|
+
* Release a project from its worker. If that worker has no more attached projects, it is
|
|
92
|
+
* terminated and removed from the pool so its memory can be reclaimed.
|
|
93
|
+
* @param worker the worker the project was assigned to (from `assignProject()`)
|
|
54
94
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (
|
|
58
|
-
|
|
95
|
+
releaseProject(worker) {
|
|
96
|
+
const index = this.workers.findIndex(x => x.worker === worker);
|
|
97
|
+
if (index === -1) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const entry = this.workers[index];
|
|
101
|
+
entry.projectCount--;
|
|
102
|
+
if (entry.projectCount <= 0) {
|
|
103
|
+
this.workers.splice(index, 1);
|
|
104
|
+
this.terminateWorker(worker);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
terminateWorker(worker) {
|
|
108
|
+
try {
|
|
109
|
+
Promise.resolve(worker.terminate()).catch(e => console.error(e));
|
|
110
|
+
}
|
|
111
|
+
catch (e) {
|
|
112
|
+
console.error(e);
|
|
59
113
|
}
|
|
60
114
|
}
|
|
61
115
|
/**
|
|
62
116
|
* Shut down all active worker pools
|
|
63
117
|
*/
|
|
64
118
|
dispose() {
|
|
65
|
-
for (const
|
|
66
|
-
|
|
67
|
-
Promise.resolve(worker.terminate()).catch(e => console.error(e));
|
|
68
|
-
}
|
|
69
|
-
catch (e) {
|
|
70
|
-
console.error(e);
|
|
71
|
-
}
|
|
119
|
+
for (const entry of this.workers) {
|
|
120
|
+
this.terminateWorker(entry.worker);
|
|
72
121
|
}
|
|
73
|
-
this.
|
|
74
|
-
this.freeWorkers = [];
|
|
122
|
+
this.workers = [];
|
|
75
123
|
}
|
|
76
124
|
}
|
|
77
125
|
exports.WorkerPool = WorkerPool;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerPool.js","sourceRoot":"","sources":["../../../src/lsp/worker/WorkerPool.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"WorkerPool.js","sourceRoot":"","sources":["../../../src/lsp/worker/WorkerPool.ts"],"names":[],"mappings":";;;AAAA,mDAAgD;AAEhD,2CAA6C;AAC7C,yBAAyB;AAUzB,MAAa,UAAU;IACnB,YACY,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;QAK1B,WAAM,GAAG,IAAA,sBAAY,GAAE,CAAC;QAE/B;;;;WAIG;QACI,eAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC;QAElD;;WAEG;QACK,YAAO,GAAkB,EAAE,CAAC;IAdpC,CAAC;IAgBD;;OAEG;IACK,YAAY;QAChB,MAAM,KAAK,GAAgB;YACvB,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE;YACtB,YAAY,EAAE,CAAC;SAClB,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzB,wHAAwH;QACxH,KAAK,CAAC,MAAM,CAAC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AAO,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;SACpE;QAAC,OAAO,CAAC,EAAE;YACR,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACpB;IACL,CAAC;IAED;;OAEG;IACI,OAAO;QACV,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,OAAO,EAAE;YAC9B,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SACtC;QACD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;IACtB,CAAC;CACJ;AAnID,gCAmIC"}
|
|
@@ -4,7 +4,7 @@ import { WorkerPool } from './WorkerPool';
|
|
|
4
4
|
import type { Hover, MaybePromise, SemanticToken } from '../../interfaces';
|
|
5
5
|
import type { DocumentAction, DocumentActionWithStatus } from '../DocumentManager';
|
|
6
6
|
import type { FileTranspileResult, SignatureInfoObj } from '../../Program';
|
|
7
|
-
import type { Position, Range, Location, DocumentSymbol, WorkspaceSymbol, CodeAction, CompletionList, SelectionRange, InlayHint } from 'vscode-languageserver-protocol';
|
|
7
|
+
import type { Position, Range, Location, LocationLink, DocumentSymbol, WorkspaceSymbol, CodeAction, CompletionList, SelectionRange, InlayHint } from 'vscode-languageserver-protocol';
|
|
8
8
|
import type { Logger } from '../../logging';
|
|
9
9
|
export declare const workerPool: WorkerPool;
|
|
10
10
|
export declare class WorkerThreadProject implements LspProject {
|
|
@@ -53,9 +53,22 @@ export declare class WorkerThreadProject implements LspProject {
|
|
|
53
53
|
*/
|
|
54
54
|
manifestSrcPath?: string;
|
|
55
55
|
/**
|
|
56
|
-
* The worker thread where the actual project will execute
|
|
56
|
+
* The worker thread where the actual project will execute. May be shared with other projects.
|
|
57
57
|
*/
|
|
58
58
|
private worker;
|
|
59
|
+
/**
|
|
60
|
+
* This project's dedicated MessagePort on `worker`, used for all request/response/update traffic
|
|
61
|
+
*/
|
|
62
|
+
private port;
|
|
63
|
+
/**
|
|
64
|
+
* True once `dispose()` has run. Used to distinguish an intentional worker shutdown from an unexpected crash.
|
|
65
|
+
*/
|
|
66
|
+
private isDisposed;
|
|
67
|
+
/**
|
|
68
|
+
* Called if this project's worker thread exits. If we didn't cause that ourselves via `dispose()`,
|
|
69
|
+
* treat it as a critical failure so the user finds out instead of every request just hanging forever.
|
|
70
|
+
*/
|
|
71
|
+
private handleWorkerExit;
|
|
59
72
|
/**
|
|
60
73
|
* Path to the project. For directory-only projects, this is the path to the dir. For bsconfig.json projects, this is the path to the config.
|
|
61
74
|
*/
|
|
@@ -116,7 +129,7 @@ export declare class WorkerThreadProject implements LspProject {
|
|
|
116
129
|
getDefinition(options: {
|
|
117
130
|
srcPath: string;
|
|
118
131
|
position: Position;
|
|
119
|
-
}): Promise<Location
|
|
132
|
+
}): Promise<Array<Location | LocationLink>>;
|
|
120
133
|
getSignatureHelp(options: {
|
|
121
134
|
srcPath: string;
|
|
122
135
|
position: Position;
|
|
@@ -38,6 +38,27 @@ class WorkerThreadProject {
|
|
|
38
38
|
var _a;
|
|
39
39
|
this.isStandaloneProject = false;
|
|
40
40
|
this.activationDeferred = new deferred_1.Deferred();
|
|
41
|
+
/**
|
|
42
|
+
* True once `dispose()` has run. Used to distinguish an intentional worker shutdown from an unexpected crash.
|
|
43
|
+
*/
|
|
44
|
+
this.isDisposed = false;
|
|
45
|
+
/**
|
|
46
|
+
* Called if this project's worker thread exits. If we didn't cause that ourselves via `dispose()`,
|
|
47
|
+
* treat it as a critical failure so the user finds out instead of every request just hanging forever.
|
|
48
|
+
*/
|
|
49
|
+
this.handleWorkerExit = (code) => {
|
|
50
|
+
var _a;
|
|
51
|
+
if (this.isDisposed) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
this.logger.error(`Worker thread for project #${this.projectNumber} exited unexpectedly with code ${code}`);
|
|
55
|
+
//emit() is async; this handler can't be, so void it
|
|
56
|
+
void this.emit('critical-failure', {
|
|
57
|
+
message: `The BrighterScript language server's worker thread crashed unexpectedly (exit code ${code}). This project (and any others sharing its worker thread) will stop responding until the language server is reloaded - there is currently no automatic recovery for a crashed worker thread.`
|
|
58
|
+
});
|
|
59
|
+
//reject any in-flight requests instead of leaving callers hanging forever on a worker that's gone
|
|
60
|
+
(_a = this.messageHandler) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
61
|
+
};
|
|
41
62
|
this.emitter = new EventEmitter();
|
|
42
63
|
this.disposables = [];
|
|
43
64
|
this.logger = (_a = options === null || options === void 0 ? void 0 : options.logger) !== null && _a !== void 0 ? _a : (0, logging_1.createLogger)();
|
|
@@ -50,11 +71,14 @@ class WorkerThreadProject {
|
|
|
50
71
|
this.projectKey = options.projectKey ? util_1.default.standardizePath(options.projectKey) : (_a = options.bsconfigPath) !== null && _a !== void 0 ? _a : options.projectDir;
|
|
51
72
|
this.workspaceFolder = options.workspaceFolder ? util_1.default.standardizePath(options.workspaceFolder) : options.workspaceFolder;
|
|
52
73
|
this.projectNumber = options.projectNumber;
|
|
53
|
-
//
|
|
54
|
-
|
|
74
|
+
// get a dedicated MessagePort on a (possibly shared) worker thread
|
|
75
|
+
const assignment = exports.workerPool.assignProject();
|
|
76
|
+
this.worker = assignment.worker;
|
|
77
|
+
this.port = assignment.port;
|
|
78
|
+
this.worker.on('exit', this.handleWorkerExit);
|
|
55
79
|
this.messageHandler = new MessageHandler_1.MessageHandler({
|
|
56
80
|
name: 'MainThread',
|
|
57
|
-
port: this.
|
|
81
|
+
port: this.port,
|
|
58
82
|
onRequest: this.processRequest.bind(this),
|
|
59
83
|
onUpdate: this.processUpdate.bind(this)
|
|
60
84
|
});
|
|
@@ -176,11 +200,13 @@ class WorkerThreadProject {
|
|
|
176
200
|
}
|
|
177
201
|
processUpdate(update) {
|
|
178
202
|
//for now, all updates are treated like "events"
|
|
179
|
-
this.emit(update.name, update.data);
|
|
203
|
+
void this.emit(update.name, update.data);
|
|
180
204
|
}
|
|
181
205
|
on(eventName, handler) {
|
|
206
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
182
207
|
this.emitter.on(eventName, handler);
|
|
183
208
|
return () => {
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
184
210
|
this.emitter.removeListener(eventName, handler);
|
|
185
211
|
};
|
|
186
212
|
}
|
|
@@ -192,16 +218,22 @@ class WorkerThreadProject {
|
|
|
192
218
|
this.emitter.emit('all', eventName, data);
|
|
193
219
|
}
|
|
194
220
|
dispose() {
|
|
195
|
-
var _a, _b, _c;
|
|
196
|
-
|
|
197
|
-
|
|
221
|
+
var _a, _b, _c, _d, _e;
|
|
222
|
+
if (this.isDisposed) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
this.isDisposed = true;
|
|
226
|
+
(_a = this.worker) === null || _a === void 0 ? void 0 : _a.off('exit', this.handleWorkerExit);
|
|
227
|
+
for (let disposable of (_b = this.disposables) !== null && _b !== void 0 ? _b : []) {
|
|
228
|
+
(_c = disposable === null || disposable === void 0 ? void 0 : disposable.dispose) === null || _c === void 0 ? void 0 : _c.call(disposable);
|
|
198
229
|
}
|
|
199
230
|
this.disposables = [];
|
|
200
|
-
//
|
|
231
|
+
//close our dedicated port and release our slot on the worker (which terminates the worker if it's now empty)
|
|
232
|
+
(_d = this.port) === null || _d === void 0 ? void 0 : _d.close();
|
|
201
233
|
if (this.worker) {
|
|
202
|
-
exports.workerPool.
|
|
234
|
+
exports.workerPool.releaseProject(this.worker);
|
|
203
235
|
}
|
|
204
|
-
(
|
|
236
|
+
(_e = this.emitter) === null || _e === void 0 ? void 0 : _e.removeAllListeners();
|
|
205
237
|
}
|
|
206
238
|
}
|
|
207
239
|
exports.WorkerThreadProject = WorkerThreadProject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerThreadProject.js","sourceRoot":"","sources":["../../../src/lsp/worker/WorkerThreadProject.ts"],"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38
|
});
|
|
39
39
|
this.requestInterceptors.activate = this.onActivate.bind(this);
|
|
40
|
+
//dispose this project's Program when its dedicated port closes, even though the shared worker keeps running
|
|
41
|
+
parentPort.on('close', () => {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
(_a = this.project) === null || _a === void 0 ? void 0 : _a.dispose();
|
|
44
|
+
(_b = this.messageHandler) === null || _b === void 0 ? void 0 : _b.dispose();
|
|
45
|
+
});
|
|
40
46
|
}
|
|
41
47
|
/**
|
|
42
48
|
* Fired anytime we get an `activate` request from the client. This allows us to clean up the previous project and make a new one
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WorkerThreadProjectRunner.js","sourceRoot":"","sources":["../../../src/lsp/worker/WorkerThreadProjectRunner.ts"],"names":[],"mappings":";;;AAAA,2CAAkD;AAElD,wCAAqC;AAErC,qDAAkD;AAGlD;;GAEG;AACH,MAAa,yBAAyB;IAAtC;QACI,sEAAsE;QAC9D,wBAAmB,GAAG,EAAyD,CAAC;
|
|
1
|
+
{"version":3,"file":"WorkerThreadProjectRunner.js","sourceRoot":"","sources":["../../../src/lsp/worker/WorkerThreadProjectRunner.ts"],"names":[],"mappings":";;;AAAA,2CAAkD;AAElD,wCAAqC;AAErC,qDAAkD;AAGlD;;GAEG;AACH,MAAa,yBAAyB;IAAtC;QACI,sEAAsE;QAC9D,wBAAmB,GAAG,EAAyD,CAAC;IA0D5F,CAAC;IApDU,GAAG,CAAC,UAAuB;QAC9B,8CAA8C;QAC9C,IAAA,2BAAiB,GAAE,CAAC;QAEpB,IAAI,CAAC,cAAc,GAAG,IAAI,+BAAc,CAAC;YACrC,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,KAAK,EAAE,OAAsB,EAAE,EAAE;;gBACxC,IAAI;oBACA,qEAAqE;oBACrE,MAAA,MAAA,IAAI,CAAC,mBAAmB,EAAC,OAAO,CAAC,IAAI,CAAC,mDAAG,OAAO,CAAC,IAAI,CAA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AC;IACP,CAAC;CACJ;AA5DD,8DA4DC"}
|
package/dist/lsp/worker/run.js
CHANGED
|
@@ -2,13 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
/**
|
|
4
4
|
* This script is the entry point for worker threads that run LSP Projects.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
|
+
* A worker thread can host multiple projects at once (see `WorkerPool.assignProject()`): each project
|
|
7
|
+
* gets its own dedicated `MessagePort`, delivered to this worker as an `attachProject` message on
|
|
8
|
+
* `parentPort`. For every such message, we spin up a new `WorkerThreadProjectRunner` bound to that
|
|
9
|
+
* project's port, so each project's request/response traffic stays fully independent even though they
|
|
10
|
+
* share this worker's JS realm (and its module-level caches).
|
|
6
11
|
*/
|
|
7
12
|
const worker_threads_1 = require("worker_threads");
|
|
8
13
|
const WorkerThreadProjectRunner_1 = require("./WorkerThreadProjectRunner");
|
|
9
|
-
const runner = new WorkerThreadProjectRunner_1.WorkerThreadProjectRunner();
|
|
10
14
|
if (!worker_threads_1.parentPort) {
|
|
11
15
|
throw new Error('This script must be run as a worker thread');
|
|
12
16
|
}
|
|
13
|
-
|
|
17
|
+
worker_threads_1.parentPort.on('message', (message) => {
|
|
18
|
+
if ((message === null || message === void 0 ? void 0 : message.type) === 'attachProject') {
|
|
19
|
+
try {
|
|
20
|
+
const runner = new WorkerThreadProjectRunner_1.WorkerThreadProjectRunner();
|
|
21
|
+
runner.run(message.port);
|
|
22
|
+
}
|
|
23
|
+
catch (e) {
|
|
24
|
+
//don't let one project's setup failure crash this worker thread and take down every other project sharing it
|
|
25
|
+
console.error('Failed to attach project to worker thread', e);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
//tell the main thread this worker has booted and is actually ready to receive `attachProject` messages (see WorkerPool)
|
|
30
|
+
worker_threads_1.parentPort.postMessage({ type: 'ready' });
|
|
14
31
|
//# sourceMappingURL=run.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/lsp/worker/run.ts"],"names":[],"mappings":";;AAAA
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../src/lsp/worker/run.ts"],"names":[],"mappings":";;AAAA;;;;;;;;GAQG;AACH,mDAA4C;AAE5C,2EAAwE;AAExE,IAAI,CAAC,2BAAU,EAAE;IACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;CACjE;AAED,2BAAU,CAAC,EAAE,CAAC,SAAS,EAAE,CAAC,OAA4C,EAAE,EAAE;IACtE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,MAAK,eAAe,EAAE;QACnC,IAAI;YACA,MAAM,MAAM,GAAG,IAAI,qDAAyB,EAAE,CAAC;YAC/C,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SAC5B;QAAC,OAAO,CAAC,EAAE;YACR,6GAA6G;YAC7G,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,CAAC,CAAC,CAAC;SACjE;KACJ;AACL,CAAC,CAAC,CAAC;AAEH,wHAAwH;AACxH,2BAAU,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC"}
|
package/dist/parser/AstNode.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ export declare abstract class AstNode {
|
|
|
42
42
|
* @param matcher a function called for each node. If you return true, this function returns the specified node. If you return a node, that node is returned. all other return values continue the loop
|
|
43
43
|
* The function's second parameter is a cancellation token. If you'd like to short-circuit the walk, call `cancellationToken.cancel()`, then this function will return `undefined`
|
|
44
44
|
*/
|
|
45
|
+
findAncestor<TNode extends AstNode = AstNode>(matcher: (node: AstNode) => node is TNode): TNode | undefined;
|
|
45
46
|
findAncestor<TNode extends AstNode = AstNode>(matcher: (node: AstNode, cancellationToken: CancellationTokenSource) => boolean | AstNode | undefined | void): TNode | undefined;
|
|
46
47
|
/**
|
|
47
48
|
* Find the first child where the matcher evaluates to true.
|
|
@@ -56,11 +57,62 @@ export declare abstract class AstNode {
|
|
|
56
57
|
* Links all child nodes to their parent AstNode, and the same with symbol tables. This performs a full AST walk, so you should use this sparingly
|
|
57
58
|
*/
|
|
58
59
|
link(): void;
|
|
60
|
+
/**
|
|
61
|
+
* The previous step in this expression, or undefined if this node doesn't build on another
|
|
62
|
+
* expression. Overridden by dotted/indexed gets, calls, and other chaining nodes.
|
|
63
|
+
*
|
|
64
|
+
* Each node in a chain spans a whole prefix of the source, so this walks to the next-shorter
|
|
65
|
+
* prefix. Given `a.b.c`, there are only three nodes:
|
|
66
|
+
* ```
|
|
67
|
+
* a.b.c .previousInChain -> a.b
|
|
68
|
+
* a.b .previousInChain -> a
|
|
69
|
+
* a .previousInChain -> undefined
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* This walks toward the AST *child*, since chains are stored inverted: the full expression is
|
|
73
|
+
* the top node and its base is the deepest descendant. It is not `parent` reversed though -
|
|
74
|
+
* arguments and index values have a `parent`, but are never anything's `previousInChain`,
|
|
75
|
+
* because they're separate expressions that merely sit inside this one:
|
|
76
|
+
* ```
|
|
77
|
+
* a.b(arg) //CallExpression.previousInChain is `a.b`, NOT `arg`
|
|
78
|
+
* a[i] //IndexedGetExpression.previousInChain is `a`, NOT `i`
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
get previousInChain(): AstNode | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* Is this node a complete expression, rather than one step inside a longer one?
|
|
84
|
+
*
|
|
85
|
+
* True when nothing chains onto this node. Statements are always terminal. Use this to find
|
|
86
|
+
* whole expressions while walking, instead of also matching every prefix inside them.
|
|
87
|
+
*
|
|
88
|
+
* ```
|
|
89
|
+
* print a.b.c(arg)
|
|
90
|
+
*
|
|
91
|
+
* //a.b.c(arg) yes - the whole expression
|
|
92
|
+
* //a.b.c no - a.b.c(arg) chains onto it
|
|
93
|
+
* //a.b no - a.b.c chains onto it
|
|
94
|
+
* //a no - a.b chains onto it
|
|
95
|
+
* //arg yes - an argument, so an expression of its own
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* An argument is terminal no matter how long it is, because nothing chains onto it. Both of
|
|
99
|
+
* these are terminal, even though they sit inside the call:
|
|
100
|
+
* ```
|
|
101
|
+
* print doSomething(x.y, 1 + 2)
|
|
102
|
+
*
|
|
103
|
+
* //x.y yes
|
|
104
|
+
* //1 + 2 yes
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* Requires `parent` to be set, so the node must already be linked (see `link()`). An
|
|
108
|
+
* unlinked node has no parent, so it reports `true`.
|
|
109
|
+
*/
|
|
110
|
+
isTerminal(): boolean;
|
|
59
111
|
/**
|
|
60
112
|
* Clone this node and all of its children. This creates a completely detached and identical copy of the AST.
|
|
61
113
|
* All tokens, statements, expressions, range, and location are cloned.
|
|
62
114
|
*/
|
|
63
|
-
abstract clone():
|
|
115
|
+
abstract clone(): AstNode;
|
|
64
116
|
/**
|
|
65
117
|
* Helper function for creating a clone. This will clone any attached annotations, as well as reparent the cloned node's children to the clone
|
|
66
118
|
*/
|
|
@@ -77,6 +129,7 @@ export declare abstract class Statement extends AstNode {
|
|
|
77
129
|
* Annotations for this statement
|
|
78
130
|
*/
|
|
79
131
|
annotations: AnnotationExpression[] | undefined;
|
|
132
|
+
abstract clone(): Statement;
|
|
80
133
|
}
|
|
81
134
|
/** A BrightScript expression */
|
|
82
135
|
export declare abstract class Expression extends AstNode {
|
|
@@ -84,4 +137,5 @@ export declare abstract class Expression extends AstNode {
|
|
|
84
137
|
* When being considered by the walk visitor, this describes what type of element the current class is.
|
|
85
138
|
*/
|
|
86
139
|
visitMode: InternalWalkMode;
|
|
140
|
+
abstract clone(): Expression;
|
|
87
141
|
}
|
package/dist/parser/AstNode.js
CHANGED
|
@@ -37,11 +37,6 @@ class AstNode {
|
|
|
37
37
|
//but it is not so easy to convince the typechecker of this.
|
|
38
38
|
return undefined;
|
|
39
39
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Walk upward and return the first node that results in `true` from the matcher.
|
|
42
|
-
* @param matcher a function called for each node. If you return true, this function returns the specified node. If you return a node, that node is returned. all other return values continue the loop
|
|
43
|
-
* The function's second parameter is a cancellation token. If you'd like to short-circuit the walk, call `cancellationToken.cancel()`, then this function will return `undefined`
|
|
44
|
-
*/
|
|
45
40
|
findAncestor(matcher) {
|
|
46
41
|
let node = this.parent;
|
|
47
42
|
const cancel = new vscode_languageserver_1.CancellationTokenSource();
|
|
@@ -94,6 +89,62 @@ class AstNode {
|
|
|
94
89
|
walkMode: visitors_1.WalkMode.visitAllRecursive
|
|
95
90
|
});
|
|
96
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* The previous step in this expression, or undefined if this node doesn't build on another
|
|
94
|
+
* expression. Overridden by dotted/indexed gets, calls, and other chaining nodes.
|
|
95
|
+
*
|
|
96
|
+
* Each node in a chain spans a whole prefix of the source, so this walks to the next-shorter
|
|
97
|
+
* prefix. Given `a.b.c`, there are only three nodes:
|
|
98
|
+
* ```
|
|
99
|
+
* a.b.c .previousInChain -> a.b
|
|
100
|
+
* a.b .previousInChain -> a
|
|
101
|
+
* a .previousInChain -> undefined
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* This walks toward the AST *child*, since chains are stored inverted: the full expression is
|
|
105
|
+
* the top node and its base is the deepest descendant. It is not `parent` reversed though -
|
|
106
|
+
* arguments and index values have a `parent`, but are never anything's `previousInChain`,
|
|
107
|
+
* because they're separate expressions that merely sit inside this one:
|
|
108
|
+
* ```
|
|
109
|
+
* a.b(arg) //CallExpression.previousInChain is `a.b`, NOT `arg`
|
|
110
|
+
* a[i] //IndexedGetExpression.previousInChain is `a`, NOT `i`
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
get previousInChain() {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Is this node a complete expression, rather than one step inside a longer one?
|
|
118
|
+
*
|
|
119
|
+
* True when nothing chains onto this node. Statements are always terminal. Use this to find
|
|
120
|
+
* whole expressions while walking, instead of also matching every prefix inside them.
|
|
121
|
+
*
|
|
122
|
+
* ```
|
|
123
|
+
* print a.b.c(arg)
|
|
124
|
+
*
|
|
125
|
+
* //a.b.c(arg) yes - the whole expression
|
|
126
|
+
* //a.b.c no - a.b.c(arg) chains onto it
|
|
127
|
+
* //a.b no - a.b.c chains onto it
|
|
128
|
+
* //a no - a.b chains onto it
|
|
129
|
+
* //arg yes - an argument, so an expression of its own
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* An argument is terminal no matter how long it is, because nothing chains onto it. Both of
|
|
133
|
+
* these are terminal, even though they sit inside the call:
|
|
134
|
+
* ```
|
|
135
|
+
* print doSomething(x.y, 1 + 2)
|
|
136
|
+
*
|
|
137
|
+
* //x.y yes
|
|
138
|
+
* //1 + 2 yes
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* Requires `parent` to be set, so the node must already be linked (see `link()`). An
|
|
142
|
+
* unlinked node has no parent, so it reports `true`.
|
|
143
|
+
*/
|
|
144
|
+
isTerminal() {
|
|
145
|
+
//walk up, then back down: if we don't land on ourselves, nothing chains onto us
|
|
146
|
+
return this.parent === undefined || this.parent.previousInChain !== this;
|
|
147
|
+
}
|
|
97
148
|
/**
|
|
98
149
|
* Helper function for creating a clone. This will clone any attached annotations, as well as reparent the cloned node's children to the clone
|
|
99
150
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AstNode.js","sourceRoot":"","sources":["../../src/parser/AstNode.ts"],"names":[],"mappings":";;;AACA,mDAAgD;AAEhD,iEAAgE;AAChE,mDAAwD;AAKxD,kCAA2B;AAE3B;;GAEG;AACH,MAAsB,OAAO;IAA7B;QAeI;;WAEG;QACI,cAAS,GAAG,2BAAgB,CAAC,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"AstNode.js","sourceRo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