brighterscript 1.0.0-alpha.21 → 1.0.0-alpha.22
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 +84 -0
- package/README.md +6 -3
- package/bsconfig.schema.json +10 -2
- package/dist/BsConfig.d.ts +5 -0
- package/dist/DependencyGraph.d.ts +2 -2
- package/dist/DependencyGraph.js +15 -3
- package/dist/DependencyGraph.js.map +1 -1
- package/dist/DiagnosticCollection.d.ts +3 -3
- package/dist/DiagnosticCollection.js +11 -11
- package/dist/DiagnosticCollection.js.map +1 -1
- package/dist/DiagnosticFilterer.js +4 -3
- package/dist/DiagnosticFilterer.js.map +1 -1
- package/dist/LanguageServer.d.ts +48 -26
- package/dist/LanguageServer.js +281 -211
- package/dist/LanguageServer.js.map +1 -1
- package/dist/Program.js +1 -1
- package/dist/Program.js.map +1 -1
- package/dist/ProgramBuilder.js +11 -11
- package/dist/ProgramBuilder.js.map +1 -1
- package/dist/Scope.js +6 -3
- package/dist/Scope.js.map +1 -1
- package/dist/astUtils/AstEditor.d.ts +32 -0
- package/dist/astUtils/AstEditor.js +132 -0
- package/dist/astUtils/AstEditor.js.map +1 -1
- package/dist/astUtils/AstEditor.spec.js +118 -34
- package/dist/astUtils/AstEditor.spec.js.map +1 -1
- package/dist/astUtils/creators.d.ts +6 -2
- package/dist/astUtils/creators.js +9 -2
- package/dist/astUtils/creators.js.map +1 -1
- package/dist/astUtils/reflection.d.ts +3 -3
- package/dist/astUtils/reflection.js +9 -7
- package/dist/astUtils/reflection.js.map +1 -1
- package/dist/astUtils/visitors.d.ts +74 -64
- package/dist/astUtils/visitors.js +30 -10
- package/dist/astUtils/visitors.js.map +1 -1
- package/dist/astUtils/visitors.spec.js +95 -3
- package/dist/astUtils/visitors.spec.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js +36 -25
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.js.map +1 -1
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js +57 -0
- package/dist/bscPlugin/semanticTokens/BrsFileSemanticTokensProcessor.spec.js.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/files/BrsFile.Class.spec.js +83 -2
- package/dist/files/BrsFile.Class.spec.js.map +1 -1
- package/dist/files/BrsFile.d.ts +8 -0
- package/dist/files/BrsFile.js +46 -28
- package/dist/files/BrsFile.js.map +1 -1
- package/dist/files/BrsFile.spec.js +83 -0
- package/dist/files/BrsFile.spec.js.map +1 -1
- package/dist/files/XmlFile.js +5 -4
- package/dist/files/XmlFile.js.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/interfaces.d.ts +1 -1
- package/dist/parser/BrsTranspileState.d.ts +2 -0
- package/dist/parser/BrsTranspileState.js +5 -0
- package/dist/parser/BrsTranspileState.js.map +1 -1
- package/dist/parser/Expression.js +6 -23
- package/dist/parser/Expression.js.map +1 -1
- package/dist/parser/Parser.Class.spec.js.map +1 -1
- package/dist/parser/Parser.d.ts +3 -3
- package/dist/parser/Parser.js +6 -6
- package/dist/parser/Parser.js.map +1 -1
- package/dist/parser/Statement.d.ts +12 -16
- package/dist/parser/Statement.js +76 -69
- package/dist/parser/Statement.js.map +1 -1
- package/dist/util.d.ts +4 -5
- package/dist/util.js +26 -21
- package/dist/util.js.map +1 -1
- package/dist/validators/ClassValidator.js +6 -6
- package/dist/validators/ClassValidator.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,90 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
## [1.0.0-alpha.22](https://github.com/rokucommunity/brighterscript/compare/v1.0.0-alpha21...v1.0.0-alpha.22) - 2022-06-08
|
|
10
|
+
### Changed
|
|
11
|
+
- all changes from [v0.52.0](#0520---2022-06-08)
|
|
12
|
+
- all changes from [v0.51.4](#0514---2022-05-31)
|
|
13
|
+
- all changes from [v0.51.3](#0513---2022-05-31)
|
|
14
|
+
- all changes from [v0.51.2](#0512---2022-05-26)
|
|
15
|
+
- all changes from [v0.51.1](#0511---2022-05-26)
|
|
16
|
+
- all changes from [v0.51.0](#0510---2022-05-24)
|
|
17
|
+
- all changes from [v0.50.2](#0502---2022-05-23)
|
|
18
|
+
- all changes from [v0.50.1](#0501---2022-05-18)
|
|
19
|
+
- all changes from [v0.50.0](#0500---2022-05-17)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## [0.52.0](https://github.com/rokucommunity/brighterscript/compare/v0.51.4...v0.52.0) - 2022-06-08
|
|
24
|
+
### Added
|
|
25
|
+
- LanguageServer: Load projects based on bsconfig.json presence ([#613](https://github.com/rokucommunity/brighterscript/pull/613))
|
|
26
|
+
### Changed
|
|
27
|
+
- upgrade to [roku-deploy@3.7.1](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#371---2022-06-08)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
## [0.51.4](https://github.com/rokucommunity/brighterscript/compare/v0.51.3...v0.51.4) - 2022-05-31
|
|
32
|
+
### Fixed
|
|
33
|
+
- Add allowBrighterScriptInBrightScript to bsconfig.schema.json ([#610](https://github.com/rokucommunity/brighterscript/pull/610))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
## [0.51.3](https://github.com/rokucommunity/brighterscript/compare/v0.51.2...v0.51.3) - 2022-05-31
|
|
38
|
+
### Fixed
|
|
39
|
+
- hover for namespace functions ([#606](https://github.com/rokucommunity/brighterscript/pull/606))
|
|
40
|
+
### Changed
|
|
41
|
+
- add `owner` and `key` to the visitor callbacks ([#600](https://github.com/rokucommunity/brighterscript/pull/600))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## [0.51.2](https://github.com/rokucommunity/brighterscript/compare/v0.51.1...v0.51.2) - 2022-05-26
|
|
46
|
+
### Fixed
|
|
47
|
+
- allow enums and interfaces as class field types ([#602](https://github.com/rokucommunity/brighterscript/pull/602))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [0.51.1](https://github.com/rokucommunity/brighterscript/compare/v0.51.0...v0.51.1) - 2022-05-26
|
|
52
|
+
### Fixed
|
|
53
|
+
- allow enums and interfaces as function return types ([#601](https://github.com/rokucommunity/brighterscript/pull/601))
|
|
54
|
+
- support AstEditor in visitor editing pattern ([#599](https://github.com/rokucommunity/brighterscript/pull/599))
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## [0.51.0](https://github.com/rokucommunity/brighterscript/compare/v0.50.2...v0.51.0) - 2022-05-24
|
|
59
|
+
### Added
|
|
60
|
+
- Add function-based` AstEditor.edit` method ([#598](https://github.com/rokucommunity/brighterscript/pull/598))
|
|
61
|
+
- Allow multiple keys for `DependencyGraph.getAllDependencies()` ([#596](https://github.com/rokucommunity/brighterscript/pull/596))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## [0.50.2](https://github.com/rokucommunity/brighterscript/compare/v0.50.1...v0.50.2) - 2022-05-23
|
|
66
|
+
### Added
|
|
67
|
+
- `allowBrighterScriptInBrightScript` config option to allow brighterscript features to be included in BrightScript files, and force those files to be transpiled ([#573](https://github.com/rokucommunity/brighterscript/pull/573))
|
|
68
|
+
### Changed
|
|
69
|
+
- upgrade to [roku-deploy@3.7.0](https://github.com/rokucommunity/roku-deploy/blob/master/CHANGELOG.md#370---2022-05-23)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## [0.50.1](https://github.com/rokucommunity/brighterscript/compare/v0.50.0...v0.50.1) - 2022-05-18
|
|
74
|
+
### Fixed
|
|
75
|
+
- Expose all the AstEditor methods to plugin events ([#593](https://github.com/rokucommunity/brighterscript/pull/593))
|
|
76
|
+
- Fix language server cwd issue with multi-root workspaces ([#592](https://github.com/rokucommunity/brighterscript/pull/592))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## [0.50.0](https://github.com/rokucommunity/brighterscript/compare/v0.49.0...v0.50.0) - 2022-05-17
|
|
81
|
+
### Added
|
|
82
|
+
- `srcPath` property on `XmlFile` and `BrsFile` to line up with the v1 branch ([#581](https://github.com/rokucommunity/brighterscript/pull/581))
|
|
83
|
+
- more `AstEditor` functions ([#589](https://github.com/rokucommunity/brighterscript/pull/589))
|
|
84
|
+
### Changed
|
|
85
|
+
- rename `ClassFieldStatement` and `ClassMethodStatement` to `FieldStatement` and `MethodStatement` respectively to allow their use in non-class-related things ([#582](https://github.com/rokucommunity/brighterscript/pull/582))
|
|
86
|
+
### Fixed
|
|
87
|
+
- Fix semantic tokens for enums in if statements ([#584](https://github.com/rokucommunity/brighterscript/pull/584))
|
|
88
|
+
- Don't push synthetic constructor into each class ([#586](https://github.com/rokucommunity/brighterscript/pull/586))
|
|
89
|
+
- transpile bugs related to class `super` handling ([#590](https://github.com/rokucommunity/brighterscript/pull/590))
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
9
93
|
## [1.0.0-alpha.21](https://github.com/rokucommunity/brighterscript/compare/v1.0.0-alpha20...v1.0.0-alpha.21) - 2022-05-02
|
|
10
94
|
### Added
|
|
11
95
|
- allow enym types as function parameters ([#579](https://github.com/rokucommunity/brighterscript/pull/579))
|
package/README.md
CHANGED
|
@@ -74,9 +74,9 @@ BrighterScript adds several new features to the BrightScript language such as Na
|
|
|
74
74
|
<a href="https://www.nba.com/">
|
|
75
75
|
<img src="https://user-images.githubusercontent.com/2544493/157430017-a27b62d0-63de-4e87-a6df-8448007bd24d.png">
|
|
76
76
|
</a>
|
|
77
|
-
<a href="https://
|
|
78
|
-
<img src="https://user-images.githubusercontent.com/2544493/
|
|
79
|
-
</a
|
|
77
|
+
<a href="https://channelstore.roku.com/details/222212/phototv">
|
|
78
|
+
<img height="34" src="https://user-images.githubusercontent.com/2544493/169118062-81d94da5-2323-4e31-b19d-7db3f9c88dff.png">
|
|
79
|
+
</a>
|
|
80
80
|
</p>
|
|
81
81
|
<br/>
|
|
82
82
|
|
|
@@ -247,6 +247,9 @@ These are the options available in the `bsconfig.json` file.
|
|
|
247
247
|
|
|
248
248
|
- **require**: `Array<string>` - List of node scripts or npm modules to load during the startup sequence. Useful for running things like `ts-node/require`
|
|
249
249
|
|
|
250
|
+
- **allowBrighterScriptInBrightScript**: `boolean` - Allow brighterscript features (classes, interfaces, etc...) to be included in BrightScript (`.brs`) files, and force those files to be transpiled.
|
|
251
|
+
|
|
252
|
+
|
|
250
253
|
## Ignore errors and warnings on a per-line basis
|
|
251
254
|
In addition to disabling an entire class of errors in `bsconfig.json` by using `ignoreErrorCodes`, you may also disable errors for a subset of the complier rules within a file with the following comment flags:
|
|
252
255
|
- `bs:disable-next-line`
|
package/bsconfig.schema.json
CHANGED
|
@@ -165,7 +165,10 @@
|
|
|
165
165
|
"items": {
|
|
166
166
|
"anyOf": [
|
|
167
167
|
{
|
|
168
|
-
"type": [
|
|
168
|
+
"type": [
|
|
169
|
+
"number",
|
|
170
|
+
"string"
|
|
171
|
+
],
|
|
169
172
|
"description": "A code of diagnostics that should be filtered out from the files matched in 'src'"
|
|
170
173
|
}
|
|
171
174
|
]
|
|
@@ -232,6 +235,11 @@
|
|
|
232
235
|
"warn",
|
|
233
236
|
"error"
|
|
234
237
|
]
|
|
238
|
+
},
|
|
239
|
+
"allowBrighterScriptInBrightScript": {
|
|
240
|
+
"description": "Allow brighterscript features (classes, interfaces, etc...) to be included in BrightScript (`.brs`) files, and force those files to be transpiled.",
|
|
241
|
+
"type": "boolean",
|
|
242
|
+
"default": false
|
|
235
243
|
}
|
|
236
244
|
}
|
|
237
|
-
}
|
|
245
|
+
}
|
package/dist/BsConfig.d.ts
CHANGED
|
@@ -138,4 +138,9 @@ export interface BsConfig {
|
|
|
138
138
|
* @default true
|
|
139
139
|
*/
|
|
140
140
|
sourceMap?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Allow brighterscript features (classes, interfaces, etc...) to be included in BrightScript (`.brs`) files, and force those files to be transpiled.
|
|
143
|
+
* @default false
|
|
144
|
+
*/
|
|
145
|
+
allowBrighterScriptInBrightScript?: boolean;
|
|
141
146
|
}
|
|
@@ -27,10 +27,10 @@ export declare class DependencyGraph {
|
|
|
27
27
|
removeDependency(key: string, dependencyKey: string): void;
|
|
28
28
|
/**
|
|
29
29
|
* Get a list of the dependencies for the given key, recursively.
|
|
30
|
-
* @param key the key for which to get the dependencies
|
|
30
|
+
* @param key the key (or keys) for which to get the dependencies
|
|
31
31
|
* @param exclude a list of keys to exclude from traversal. Anytime one of these nodes is encountered, it is skipped.
|
|
32
32
|
*/
|
|
33
|
-
getAllDependencies(
|
|
33
|
+
getAllDependencies(keys: string | string[], exclude?: string[]): string[];
|
|
34
34
|
/**
|
|
35
35
|
* Remove the item. This will emit an onchange event for all dependent nodes
|
|
36
36
|
*/
|
package/dist/DependencyGraph.js
CHANGED
|
@@ -60,12 +60,24 @@ class DependencyGraph {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* Get a list of the dependencies for the given key, recursively.
|
|
63
|
-
* @param key the key for which to get the dependencies
|
|
63
|
+
* @param key the key (or keys) for which to get the dependencies
|
|
64
64
|
* @param exclude a list of keys to exclude from traversal. Anytime one of these nodes is encountered, it is skipped.
|
|
65
65
|
*/
|
|
66
|
-
getAllDependencies(
|
|
66
|
+
getAllDependencies(keys, exclude) {
|
|
67
67
|
var _a, _b;
|
|
68
|
-
|
|
68
|
+
if (typeof keys === 'string') {
|
|
69
|
+
return (_b = (_a = this.nodes[keys]) === null || _a === void 0 ? void 0 : _a.getAllDependencies(exclude)) !== null && _b !== void 0 ? _b : [];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
const set = new Set();
|
|
73
|
+
for (const key of keys) {
|
|
74
|
+
const dependencies = this.getAllDependencies(key, exclude);
|
|
75
|
+
for (const dependency of dependencies) {
|
|
76
|
+
set.add(dependency);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return [...set];
|
|
80
|
+
}
|
|
69
81
|
}
|
|
70
82
|
/**
|
|
71
83
|
* Remove the item. This will emit an onchange event for all dependent nodes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DependencyGraph.js","sourceRoot":"","sources":["../src/DependencyGraph.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAC7C;;;GAGG;AACH,MAAa,eAAe;IAA5B;QACI;;WAEG;QACI,UAAK,GAAG,EAA0B,CAAC;QAE1C;;WAEG;QACK,oBAAe,GAAG,IAAI,4BAAY,EAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"DependencyGraph.js","sourceRoot":"","sources":["../src/DependencyGraph.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAC7C;;;GAGG;AACH,MAAa,eAAe;IAA5B;QACI;;WAEG;QACI,UAAK,GAAG,EAA0B,CAAC;QAE1C;;WAEG;QACK,oBAAe,GAAG,IAAI,4BAAY,EAAkC,CAAC;IAuGjF,CAAC;IArGG;;OAEG;IACI,YAAY,CAAC,GAAW,EAAE,YAAuB;;QACpD,uBAAuB;QACvB,YAAY,GAAG,MAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,EAAE,mCAAI,EAAE,CAAC;QAE1C,2BAA2B;QAC3B,MAAA,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,0CAAE,OAAO,EAAE,CAAC;QAE3B,8BAA8B;QAC9B,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC,CAA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AI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACxC,IAAI,IAAI,EAAE;oBACN,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC,CAAC;iBAC9C;aACJ;SACJ;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtC,CAAC;IAEM,OAAO;;QACV,KAAK,IAAI,WAAW,IAAI,MAAA,IAAI,CAAC,aAAa,mCAAI,EAAE,EAAE;YAC9C,WAAW,EAAE,CAAC;SACjB;IACL,CAAC;CACJ;AAlDD,oBAkDC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { BsDiagnostic } from './interfaces';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Project } from './LanguageServer';
|
|
3
3
|
export declare class DiagnosticCollection {
|
|
4
4
|
private previousDiagnosticsByFile;
|
|
5
|
-
getPatch(
|
|
6
|
-
private
|
|
5
|
+
getPatch(projects: Project[]): Promise<Record<string, KeyedDiagnostic[]>>;
|
|
6
|
+
private getDiagnosticsByFileFromProjects;
|
|
7
7
|
/**
|
|
8
8
|
* Get a patch for all the files that have been removed since last time
|
|
9
9
|
*/
|
|
@@ -5,30 +5,30 @@ class DiagnosticCollection {
|
|
|
5
5
|
constructor() {
|
|
6
6
|
this.previousDiagnosticsByFile = {};
|
|
7
7
|
}
|
|
8
|
-
async getPatch(
|
|
9
|
-
const diagnosticsByFile = await this.
|
|
8
|
+
async getPatch(projects) {
|
|
9
|
+
const diagnosticsByFile = await this.getDiagnosticsByFileFromProjects(projects);
|
|
10
10
|
const patch = Object.assign(Object.assign(Object.assign({}, this.getRemovedPatch(diagnosticsByFile)), this.getModifiedPatch(diagnosticsByFile)), this.getAddedPatch(diagnosticsByFile));
|
|
11
11
|
//save the new list of diagnostics
|
|
12
12
|
this.previousDiagnosticsByFile = diagnosticsByFile;
|
|
13
13
|
return patch;
|
|
14
14
|
}
|
|
15
|
-
async
|
|
15
|
+
async getDiagnosticsByFileFromProjects(projects) {
|
|
16
16
|
const result = {};
|
|
17
17
|
//wait for all programs to finish running. This ensures the `Program` exists.
|
|
18
|
-
await Promise.all(
|
|
19
|
-
//get all diagnostics for all
|
|
20
|
-
let diagnostics = Array.prototype.concat.apply([],
|
|
18
|
+
await Promise.all(projects.map(x => x.firstRunPromise));
|
|
19
|
+
//get all diagnostics for all projects
|
|
20
|
+
let diagnostics = Array.prototype.concat.apply([], projects.map((x) => x.builder.getDiagnostics()));
|
|
21
21
|
const keys = {};
|
|
22
22
|
//build the full current set of diagnostics by file
|
|
23
23
|
for (let diagnostic of diagnostics) {
|
|
24
|
-
const
|
|
24
|
+
const srcPath = diagnostic.file.srcPath;
|
|
25
25
|
//ensure the file entry exists
|
|
26
|
-
if (!result[
|
|
27
|
-
result[
|
|
26
|
+
if (!result[srcPath]) {
|
|
27
|
+
result[srcPath] = [];
|
|
28
28
|
}
|
|
29
|
-
const diagnosticMap = result[
|
|
29
|
+
const diagnosticMap = result[srcPath];
|
|
30
30
|
diagnostic.key =
|
|
31
|
-
|
|
31
|
+
srcPath.toLowerCase() + '-' +
|
|
32
32
|
diagnostic.code + '-' +
|
|
33
33
|
diagnostic.range.start.line + '-' +
|
|
34
34
|
diagnostic.range.start.character + '-' +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiagnosticCollection.js","sourceRoot":"","sources":["../src/DiagnosticCollection.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAAjC;QACY,8BAAyB,GAAG,EAAuC,CAAC;IAkHhF,CAAC;IAhHU,KAAK,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"DiagnosticCollection.js","sourceRoot":"","sources":["../src/DiagnosticCollection.ts"],"names":[],"mappings":";;;AAGA,MAAa,oBAAoB;IAAjC;QACY,8BAAyB,GAAG,EAAuC,CAAC;IAkHhF,CAAC;IAhHU,KAAK,CAAC,QAAQ,CAAC,QAAmB;QACrC,M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wB;QAClF,oDAAoD;QACpD,IAAI,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE;YAC/B,OAAO,KAAK,CAAC;SAChB;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACnC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE;gBAC/B,OAAO,KAAK,CAAC;aAChB;SACJ;QAED,6CAA6C;QAC7C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACK,aAAa,CAAC,wBAA2D;QAC7E,MAAM,MAAM,GAAG,EAAuC,CAAC;QACvD,KAAK,MAAM,QAAQ,IAAI,wBAAwB,EAAE;YAC7C,IAAI,CAAC,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,EAAE;gBAC3C,MAAM,CAAC,QAAQ,CAAC,GAAG,wBAAwB,CAAC,QAAQ,CAAC,CAAC;aACzD;SACJ;QACD,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAnHD,oDAmHC"}
|
|
@@ -46,14 +46,15 @@ class DiagnosticFilterer {
|
|
|
46
46
|
* group the diagnostics by file
|
|
47
47
|
*/
|
|
48
48
|
groupByFile(diagnostics) {
|
|
49
|
-
var _a;
|
|
49
|
+
var _a, _b, _c;
|
|
50
50
|
this.byFile = {};
|
|
51
51
|
for (let diagnostic of diagnostics) {
|
|
52
|
+
const srcPath = (_b = (_a = diagnostic === null || diagnostic === void 0 ? void 0 : diagnostic.file) === null || _a === void 0 ? void 0 : _a.srcPath) !== null && _b !== void 0 ? _b : (_c = diagnostic === null || diagnostic === void 0 ? void 0 : diagnostic.file) === null || _c === void 0 ? void 0 : _c.srcPath;
|
|
52
53
|
//skip diagnostics that have issues
|
|
53
|
-
if (!
|
|
54
|
+
if (!srcPath) {
|
|
54
55
|
continue;
|
|
55
56
|
}
|
|
56
|
-
const lowerSrcPath =
|
|
57
|
+
const lowerSrcPath = srcPath.toLowerCase();
|
|
57
58
|
//make a new array for this file if one does not yet exist
|
|
58
59
|
if (!this.byFile[lowerSrcPath]) {
|
|
59
60
|
this.byFile[lowerSrcPath] = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiagnosticFilterer.js","sourceRoot":"","sources":["../src/DiagnosticFilterer.ts"],"names":[],"mappings":";;;AACA,6BAA6B;AAC7B,uCAAuC;AAEvC,iCAA8C;AAE9C,MAAa,kBAAkB;IAK3B;;OAEG;IACI,MAAM,CAAC,OAAiB,EAAE,WAA2B;QACxD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAE/B,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC;QAE9B,KAAK,IAAI,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE;YAC7B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;SAC/B;QACD,IAAI,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAEnC,UAAU;QACV,OAAO,IAAI,CAAC,MAAM,CAAC;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC;QACpB,OAAO,IAAI,CAAC,OAAO,CAAC;QAEpB,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACK,cAAc;QAClB,mCAAmC;QACnC,IAAI,gBAAgB,GAAG,EAAoB,CAAC;QAC5C,KAAK,IAAI,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE;YACzB,IAAI,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACvC,KAAK,IAAI,UAAU,IAAI,eAAe,EAAE;gBACpC,IAAI,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;oBACvC,sCAAsC;iBACzC;qBAAM;oBACH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AAE,CAAC,GAAG,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC/C,IAAI,MAAM,GAAQ,iBAAiB,CAAC,CAAC,CAAC,CAAC;YACvC,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC5B,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBAC/B,SAAS;aACZ;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBACnC,MAAM,GAAG;oBACL,GAAG,EAAE,MAAM;iBACd,CAAC;gBAEF,2FAA2F;aAC9F;iBAAM,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE;gBACpD,iBAAiB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBACxC,SAAS;aACZ;YAED,sCAAsC;YACtC,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,GAAG,MAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,KAAK,CAAA,EAAE;gBAC9B,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACvB;SACJ;QACD,8CAA8C;QAC9C,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9B,MAAM,CAAC,IAAI,CAAC;gBACR,KAAK,EAAE,iBAAiB;aAC3B,CAAC,CAAC;SACN;QACD,OAAO,MAA6D,CAAC;IACzE,CAAC;CACJ;AAtJD,gDAsJC"}
|
package/dist/LanguageServer.d.ts
CHANGED
|
@@ -5,18 +5,18 @@ import { ProgramBuilder } from './ProgramBuilder';
|
|
|
5
5
|
import { Throttler } from './Throttler';
|
|
6
6
|
export declare class LanguageServer {
|
|
7
7
|
private connection;
|
|
8
|
-
|
|
8
|
+
projects: Project[];
|
|
9
9
|
/**
|
|
10
10
|
* The number of milliseconds that should be used for language server typing debouncing
|
|
11
11
|
*/
|
|
12
12
|
private debounceTimeout;
|
|
13
13
|
/**
|
|
14
|
-
* These
|
|
15
|
-
* in any of the workspace projects.
|
|
16
|
-
* Basically these are single-file
|
|
14
|
+
* These projects are created on the fly whenever a file is opened that is not included
|
|
15
|
+
* in any of the workspace-based projects.
|
|
16
|
+
* Basically these are single-file projects to at least get parsing for standalone files.
|
|
17
17
|
* Also, they should only be created when the file is opened, and destroyed when the file is closed.
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
standaloneFileProjects: Record<string, Project>;
|
|
20
20
|
private hasConfigurationCapability;
|
|
21
21
|
/**
|
|
22
22
|
* Indicates whether the client supports workspace folders
|
|
@@ -41,7 +41,27 @@ export declare class LanguageServer {
|
|
|
41
41
|
onInitialize(params: InitializeParams): {
|
|
42
42
|
capabilities: ServerCapabilities<any>;
|
|
43
43
|
};
|
|
44
|
-
private
|
|
44
|
+
private initialProjectsCreated;
|
|
45
|
+
/**
|
|
46
|
+
* Ask the client for the list of `files.exclude` patterns. Useful when determining if we should process a file
|
|
47
|
+
*/
|
|
48
|
+
private getWorkspaceExcludeGlobs;
|
|
49
|
+
/**
|
|
50
|
+
* Scan the workspace for all `bsconfig.json` files. If at least one is found, then only folders who have bsconfig.json are returned.
|
|
51
|
+
* If none are found, then the workspaceFolder itself is treated as a project
|
|
52
|
+
*/
|
|
53
|
+
private getProjectPaths;
|
|
54
|
+
/**
|
|
55
|
+
* Find all folders with bsconfig.json files in them, and treat each as a project.
|
|
56
|
+
* Treat workspaces that don't have a bsconfig.json as a project.
|
|
57
|
+
* Handle situations where bsconfig.json files were added or removed (to elevate/lower workspaceFolder projects accordingly)
|
|
58
|
+
* Leave existing projects alone if they are not affected by these changes
|
|
59
|
+
*/
|
|
60
|
+
private syncProjects;
|
|
61
|
+
/**
|
|
62
|
+
* Get all workspace paths from the client
|
|
63
|
+
*/
|
|
64
|
+
private getWorkspacePaths;
|
|
45
65
|
/**
|
|
46
66
|
* Called when the client has finished initializing
|
|
47
67
|
* @param params
|
|
@@ -54,25 +74,16 @@ export declare class LanguageServer {
|
|
|
54
74
|
/**
|
|
55
75
|
* Wait for all programs' first run to complete
|
|
56
76
|
*/
|
|
57
|
-
private
|
|
58
|
-
/**
|
|
59
|
-
* Create project for each new workspace. If the workspace is already known,
|
|
60
|
-
* it is skipped.
|
|
61
|
-
* @param workspaceFolders
|
|
62
|
-
*/
|
|
63
|
-
private createWorkspaces;
|
|
77
|
+
private waitAllProjectFirstRuns;
|
|
64
78
|
/**
|
|
65
79
|
* Event handler for when the program wants to load file contents.
|
|
66
80
|
* anytime the program wants to load a file, check with our in-memory document cache first
|
|
67
81
|
*/
|
|
68
82
|
private documentFileResolver;
|
|
69
83
|
private getConfigFilePath;
|
|
70
|
-
private
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*/
|
|
74
|
-
private createStandaloneFileWorkspace;
|
|
75
|
-
private getWorkspaces;
|
|
84
|
+
private createProject;
|
|
85
|
+
private createStandaloneFileProject;
|
|
86
|
+
private getProjects;
|
|
76
87
|
/**
|
|
77
88
|
* Provide a list of completion items based on the current cursor position
|
|
78
89
|
* @param textDocumentPosition
|
|
@@ -85,9 +96,13 @@ export declare class LanguageServer {
|
|
|
85
96
|
private onCompletionResolve;
|
|
86
97
|
private onCodeAction;
|
|
87
98
|
/**
|
|
88
|
-
*
|
|
99
|
+
* Remove a project from the language server
|
|
100
|
+
*/
|
|
101
|
+
private removeProject;
|
|
102
|
+
/**
|
|
103
|
+
* Reload each of the specified workspaces
|
|
89
104
|
*/
|
|
90
|
-
private
|
|
105
|
+
private reloadProjects;
|
|
91
106
|
private getRootDir;
|
|
92
107
|
/**
|
|
93
108
|
* Sometimes users will alter their bsconfig files array, and will include standalone files.
|
|
@@ -96,7 +111,7 @@ export declare class LanguageServer {
|
|
|
96
111
|
*
|
|
97
112
|
* Sometimes files that used to be included are now excluded, so those open files need to be re-processed as standalone
|
|
98
113
|
*/
|
|
99
|
-
private
|
|
114
|
+
private synchronizeStandaloneProjects;
|
|
100
115
|
private onDidChangeConfiguration;
|
|
101
116
|
/**
|
|
102
117
|
* Called when watched files changed (add/change/delete).
|
|
@@ -111,7 +126,7 @@ export declare class LanguageServer {
|
|
|
111
126
|
* any file changes you receive with no unexpected side-effects
|
|
112
127
|
* @param changes
|
|
113
128
|
*/
|
|
114
|
-
handleFileChanges(
|
|
129
|
+
handleFileChanges(project: Project, changes: {
|
|
115
130
|
type: FileChangeType;
|
|
116
131
|
srcPath: string;
|
|
117
132
|
}[]): Promise<void>;
|
|
@@ -133,21 +148,28 @@ export declare class LanguageServer {
|
|
|
133
148
|
private onFullSemanticTokens;
|
|
134
149
|
private diagnosticCollection;
|
|
135
150
|
private sendDiagnostics;
|
|
136
|
-
onExecuteCommand(params: ExecuteCommandParams): Promise<
|
|
151
|
+
onExecuteCommand(params: ExecuteCommandParams): Promise<void>;
|
|
137
152
|
/**
|
|
138
153
|
* @param srcPath The absolute path to the source file on disk
|
|
139
154
|
*/
|
|
140
155
|
private transpileFile;
|
|
141
156
|
dispose(): void;
|
|
142
157
|
}
|
|
143
|
-
export interface
|
|
158
|
+
export interface Project {
|
|
144
159
|
firstRunPromise: Promise<any>;
|
|
145
160
|
builder: ProgramBuilder;
|
|
161
|
+
/**
|
|
162
|
+
* The path to where the project resides
|
|
163
|
+
*/
|
|
164
|
+
projectPath: string;
|
|
165
|
+
/**
|
|
166
|
+
* The path to the workspace where this project resides. A workspace can have multiple projects (by adding a bsconfig.json to each folder).
|
|
167
|
+
*/
|
|
146
168
|
workspacePath: string;
|
|
147
169
|
isFirstRunComplete: boolean;
|
|
148
170
|
isFirstRunSuccessful: boolean;
|
|
149
171
|
configFilePath?: string;
|
|
150
|
-
|
|
172
|
+
isStandaloneFileProject: boolean;
|
|
151
173
|
}
|
|
152
174
|
export declare enum CustomCommands {
|
|
153
175
|
TranspileFile = "TranspileFile"
|