@spyglassmc/core 0.1.1 → 0.1.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/lib/common/TwoWayMap.d.ts +21 -0
- package/lib/common/TwoWayMap.js +75 -0
- package/lib/common/index.js +5 -1
- package/lib/common/util.d.ts +3 -20
- package/lib/common/util.js +6 -40
- package/lib/index.js +5 -1
- package/lib/node/LiteralNode.d.ts +1 -1
- package/lib/node/LiteralNode.js +1 -1
- package/lib/node/ResourceLocationNode.d.ts +2 -4
- package/lib/node/Sequence.d.ts +2 -1
- package/lib/node/Sequence.js +3 -2
- package/lib/node/SymbolNode.d.ts +1 -1
- package/lib/node/SymbolNode.js +1 -1
- package/lib/node/index.js +5 -1
- package/lib/parser/float.js +1 -1
- package/lib/parser/index.js +5 -1
- package/lib/parser/integer.js +1 -1
- package/lib/parser/long.js +1 -1
- package/lib/parser/string.js +4 -2
- package/lib/parser/util.d.ts +25 -7
- package/lib/parser/util.js +50 -17
- package/lib/processor/checker/builtin.js +1 -1
- package/lib/processor/checker/index.js +5 -1
- package/lib/processor/colorizer/index.js +5 -1
- package/lib/processor/completer/builtin.js +16 -16
- package/lib/processor/completer/index.js +5 -1
- package/lib/processor/formatter/index.js +5 -1
- package/lib/processor/index.js +5 -1
- package/lib/processor/linter/builtin/undeclaredSymbol.js +3 -3
- package/lib/processor/linter/builtin.js +1 -1
- package/lib/processor/linter/index.js +5 -1
- package/lib/service/Config.d.ts +6 -4
- package/lib/service/Config.js +6 -6
- package/lib/service/Context.d.ts +2 -2
- package/lib/service/Context.js +1 -0
- package/lib/service/Downloader.d.ts +1 -0
- package/lib/service/Downloader.js +4 -0
- package/lib/service/ErrorReporter.js +1 -1
- package/lib/service/FileService.d.ts +29 -4
- package/lib/service/FileService.js +82 -19
- package/lib/service/Project.d.ts +1 -0
- package/lib/service/Project.js +23 -11
- package/lib/service/Service.d.ts +2 -2
- package/lib/service/Service.js +25 -15
- package/lib/service/fileUtil.d.ts +15 -5
- package/lib/service/fileUtil.js +39 -4
- package/lib/service/index.js +5 -1
- package/lib/source/LanguageError.js +1 -1
- package/lib/source/Source.d.ts +6 -1
- package/lib/source/Source.js +30 -2
- package/lib/source/index.js +5 -1
- package/lib/symbol/Symbol.d.ts +10 -10
- package/lib/symbol/Symbol.js +7 -6
- package/lib/symbol/SymbolUtil.d.ts +1 -8
- package/lib/symbol/SymbolUtil.js +12 -12
- package/lib/symbol/index.js +5 -1
- package/package.json +2 -2
package/lib/symbol/Symbol.js
CHANGED
|
@@ -9,14 +9,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
};
|
|
10
10
|
var _SymbolPathCollector_set;
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.SymbolTable = exports.SymbolLocation = exports.Symbol = exports.SymbolUsageType = exports.SymbolUsageTypes = exports.SymbolPathCollector = exports.SymbolPath = exports.ResourceLocationCategory = exports.ResourceLocationCategories = exports.AllCategories = exports.DatapackCategories = exports.MiscCategories = exports.FileCategories = exports.TagFileCategories = exports.TaggableResourceLocationCategories = exports.WorldgenFileCategories = exports.RegistryCategories = exports.
|
|
12
|
+
exports.SymbolTable = exports.SymbolLocation = exports.Symbol = exports.SymbolUsageType = exports.SymbolUsageTypes = exports.SymbolPathCollector = exports.SymbolPath = exports.ResourceLocationCategory = exports.ResourceLocationCategories = exports.AllCategories = exports.DatapackCategories = exports.MiscCategories = exports.FileCategories = exports.TagFileCategories = exports.TaggableResourceLocationCategories = exports.WorldgenFileCategories = exports.RegistryCategories = exports.McdocCategories = void 0;
|
|
13
13
|
const rfdc_1 = __importDefault(require("rfdc"));
|
|
14
14
|
const common_1 = require("../common");
|
|
15
15
|
const source_1 = require("../source");
|
|
16
|
-
//#region
|
|
17
|
-
exports.
|
|
18
|
-
'
|
|
19
|
-
'
|
|
16
|
+
//#region Mcdoc Categories
|
|
17
|
+
exports.McdocCategories = Object.freeze([
|
|
18
|
+
'mcdoc',
|
|
19
|
+
'mcdoc/dispatcher',
|
|
20
20
|
]);
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region Registry Categories
|
|
@@ -130,12 +130,13 @@ exports.DatapackCategories = Object.freeze([
|
|
|
130
130
|
//#endregion
|
|
131
131
|
exports.AllCategories = Object.freeze([
|
|
132
132
|
...exports.DatapackCategories,
|
|
133
|
-
...exports.
|
|
133
|
+
...exports.McdocCategories,
|
|
134
134
|
...exports.RegistryCategories,
|
|
135
135
|
]);
|
|
136
136
|
exports.ResourceLocationCategories = Object.freeze([
|
|
137
137
|
'bossbar',
|
|
138
138
|
'storage',
|
|
139
|
+
'mcdoc/dispatcher',
|
|
139
140
|
...exports.FileCategories,
|
|
140
141
|
...exports.RegistryCategories,
|
|
141
142
|
]);
|
|
@@ -223,14 +223,7 @@ interface SymbolAdditionUsageBase extends SymbolLocationMetadata {
|
|
|
223
223
|
*/
|
|
224
224
|
type?: SymbolUsageType;
|
|
225
225
|
/**
|
|
226
|
-
*
|
|
227
|
-
* nbtdoc code,
|
|
228
|
-
* ```nbtdoc
|
|
229
|
-
* 0123456789012345
|
|
230
|
-
* compound Foo {}
|
|
231
|
-
* ```
|
|
232
|
-
*
|
|
233
|
-
* The `range` for the Symbol `Foo` is `[9, 12)`, while the `fullRange` for it is `[0, 15)`.
|
|
226
|
+
* @see {@link SymbolLocation.fullRange}
|
|
234
227
|
*/
|
|
235
228
|
fullRange?: RangeLike;
|
|
236
229
|
}
|
package/lib/symbol/SymbolUtil.js
CHANGED
|
@@ -315,7 +315,7 @@ class SymbolUtil extends events_1.default {
|
|
|
315
315
|
if ('visibility' in addition) {
|
|
316
316
|
// Visibility changes are only accepted if the change wouldn't result in the
|
|
317
317
|
// symbol being stored in a different symbol table.
|
|
318
|
-
const inGlobalTable = (v) => v === undefined || v === 2 /* Public */ || v === 3 /* Restricted */;
|
|
318
|
+
const inGlobalTable = (v) => v === undefined || v === 2 /* SymbolVisibility.Public */ || v === 3 /* SymbolVisibility.Restricted */;
|
|
319
319
|
if (symbol.visibility === addition.visibility || (inGlobalTable(symbol.visibility) && inGlobalTable(addition.visibility))) {
|
|
320
320
|
symbol.visibility = addition.visibility;
|
|
321
321
|
}
|
|
@@ -369,11 +369,11 @@ class SymbolUtil extends events_1.default {
|
|
|
369
369
|
}
|
|
370
370
|
static isVisible(symbol, _uri) {
|
|
371
371
|
switch (symbol.visibility) {
|
|
372
|
-
case 3 /* Restricted */:
|
|
372
|
+
case 3 /* SymbolVisibility.Restricted */:
|
|
373
373
|
return false; // FIXME: check with workspace root URIs.
|
|
374
|
-
case 0 /* Block */:
|
|
375
|
-
case 1 /* File */:
|
|
376
|
-
case 2 /* Public */:
|
|
374
|
+
case 0 /* SymbolVisibility.Block */:
|
|
375
|
+
case 1 /* SymbolVisibility.File */:
|
|
376
|
+
case 2 /* SymbolVisibility.Public */:
|
|
377
377
|
default:
|
|
378
378
|
return true;
|
|
379
379
|
}
|
|
@@ -433,12 +433,12 @@ class SymbolUtil extends events_1.default {
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
static isVisibilityInGlobal(v) {
|
|
436
|
-
return v === undefined || v === 2 /* Public */ || v === 3 /* Restricted */;
|
|
436
|
+
return v === undefined || v === 2 /* SymbolVisibility.Public */ || v === 3 /* SymbolVisibility.Restricted */;
|
|
437
437
|
}
|
|
438
438
|
static areVisibilitiesCompatible(v1, v2) {
|
|
439
439
|
return ((this.isVisibilityInGlobal(v1) && this.isVisibilityInGlobal(v2)) ||
|
|
440
|
-
(v1 === 0 /* Block */ && v2 === 0 /* Block */) ||
|
|
441
|
-
(v1 === 1 /* File */ && v2 === 1 /* File */));
|
|
440
|
+
(v1 === 0 /* SymbolVisibility.Block */ && v2 === 0 /* SymbolVisibility.Block */) ||
|
|
441
|
+
(v1 === 1 /* SymbolVisibility.File */ && v2 === 1 /* SymbolVisibility.File */));
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
_SymbolUtil_global = new WeakMap(), _SymbolUtil_trimmableSymbols = new WeakMap(), _SymbolUtil_cache = new WeakMap(), _SymbolUtil_currentContributor = new WeakMap();
|
|
@@ -615,7 +615,7 @@ class SymbolQuery {
|
|
|
615
615
|
if (SymbolUtil.isVisibilityInGlobal(addition.data?.visibility)) {
|
|
616
616
|
table = this.util.global;
|
|
617
617
|
}
|
|
618
|
-
else if (addition.data?.visibility === 1 /* File */) {
|
|
618
|
+
else if (addition.data?.visibility === 1 /* SymbolVisibility.File */) {
|
|
619
619
|
if (!__classPrivateFieldGet(this, _SymbolQuery_node, "f")) {
|
|
620
620
|
throw new Error(`Cannot enter “${this.getPath()}” with ${SymbolFormatter.stringifyVisibility(addition.data?.visibility)} visibility as no node is supplied`);
|
|
621
621
|
}
|
|
@@ -826,13 +826,13 @@ var SymbolFormatter;
|
|
|
826
826
|
let stringVisibility;
|
|
827
827
|
// Const enums cannot be indexed even if `--preserveConstEnums` is on: https://github.com/microsoft/TypeScript/issues/31353
|
|
828
828
|
switch (visibility) {
|
|
829
|
-
case 0 /* Block */:
|
|
829
|
+
case 0 /* SymbolVisibility.Block */:
|
|
830
830
|
stringVisibility = 'Block';
|
|
831
831
|
break;
|
|
832
|
-
case 1 /* File */:
|
|
832
|
+
case 1 /* SymbolVisibility.File */:
|
|
833
833
|
stringVisibility = 'File';
|
|
834
834
|
break;
|
|
835
|
-
case 3 /* Restricted */:
|
|
835
|
+
case 3 /* SymbolVisibility.Restricted */:
|
|
836
836
|
stringVisibility = 'Restricted';
|
|
837
837
|
break;
|
|
838
838
|
default:
|
package/lib/symbol/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"author": "SPGoding",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"p-limit": "^3.1.0",
|
|
22
22
|
"rfdc": "^1.3.0",
|
|
23
23
|
"vscode-languageserver-textdocument": "^1.0.4",
|
|
24
|
-
"@spyglassmc/locales": "0.1.
|
|
24
|
+
"@spyglassmc/locales": "0.1.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@types/decompress": "^4.2.3",
|