@spyglassmc/core 0.4.1 → 0.4.3
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/Dev.d.ts +7 -7
- package/lib/common/Dev.js +20 -14
- package/lib/common/ReadonlyProxy.d.ts +9 -6
- package/lib/common/ReadonlyProxy.js +6 -4
- package/lib/common/StateProxy.d.ts +11 -11
- package/lib/common/StateProxy.js +21 -14
- package/lib/common/externals/NodeJsExternals.js +11 -3
- package/lib/common/externals/downloader.d.ts +8 -8
- package/lib/common/externals/downloader.js +12 -8
- package/lib/common/externals/index.d.ts +3 -3
- package/lib/common/util.d.ts +23 -21
- package/lib/common/util.js +13 -2
- package/lib/node/AstNode.d.ts +1 -1
- package/lib/node/AstNode.js +3 -1
- package/lib/node/CommentNode.d.ts +4 -4
- package/lib/node/CommentNode.js +6 -4
- package/lib/node/ResourceLocationNode.d.ts +1 -1
- package/lib/node/ResourceLocationNode.js +6 -8
- package/lib/node/StringNode.d.ts +3 -3
- package/lib/node/StringNode.js +4 -1
- package/lib/parser/Parser.d.ts +5 -5
- package/lib/parser/float.d.ts +1 -1
- package/lib/parser/integer.d.ts +1 -1
- package/lib/parser/long.d.ts +1 -1
- package/lib/parser/resourceLocation.js +1 -1
- package/lib/parser/string.js +4 -1
- package/lib/parser/util.d.ts +11 -7
- package/lib/parser/util.js +17 -2
- package/lib/processor/ColorInfoProvider.d.ts +3 -3
- package/lib/processor/ColorInfoProvider.js +4 -2
- package/lib/processor/InlayHintProvider.d.ts +4 -2
- package/lib/processor/SignatureHelpProvider.d.ts +1 -1
- package/lib/processor/binder/Binder.d.ts +9 -9
- package/lib/processor/binder/Binder.js +18 -12
- package/lib/processor/binder/builtin.d.ts +2 -2
- package/lib/processor/binder/builtin.js +3 -1
- package/lib/processor/binder/index.d.ts +1 -1
- package/lib/processor/binder/index.js +1 -1
- package/lib/processor/checker/Checker.d.ts +3 -3
- package/lib/processor/checker/builtin.d.ts +1 -1
- package/lib/processor/checker/builtin.js +2 -1
- package/lib/processor/colorizer/Colorizer.d.ts +3 -3
- package/lib/processor/completer/Completer.d.ts +1 -1
- package/lib/processor/completer/builtin.js +8 -4
- package/lib/processor/formatter/Formatter.d.ts +1 -1
- package/lib/processor/formatter/Formatter.js +3 -1
- package/lib/processor/linter/Linter.d.ts +1 -1
- package/lib/processor/util.d.ts +1 -1
- package/lib/service/CacheService.d.ts +1 -1
- package/lib/service/CacheService.js +2 -2
- package/lib/service/Config.d.ts +9 -9
- package/lib/service/Config.js +17 -3
- package/lib/service/Dependency.d.ts +3 -3
- package/lib/service/FileService.d.ts +3 -3
- package/lib/service/FileService.js +40 -32
- package/lib/service/Project.d.ts +5 -5
- package/lib/service/Project.js +9 -5
- package/lib/service/Service.js +12 -3
- package/lib/service/SymbolRegistrar.d.ts +1 -1
- package/lib/service/UriProcessor.d.ts +3 -3
- package/lib/service/fileUtil.d.ts +3 -2
- package/lib/service/fileUtil.js +4 -0
- package/lib/source/IndexMap.d.ts +1 -1
- package/lib/source/IndexMap.js +7 -7
- package/lib/source/LanguageError.d.ts +4 -4
- package/lib/source/LanguageError.js +9 -6
- package/lib/source/Location.d.ts +1 -1
- package/lib/source/Offset.d.ts +1 -1
- package/lib/source/Range.d.ts +1 -1
- package/lib/source/Source.d.ts +12 -10
- package/lib/source/Source.js +16 -9
- package/lib/symbol/Symbol.d.ts +16 -16
- package/lib/symbol/Symbol.js +15 -9
- package/lib/symbol/SymbolUtil.d.ts +4 -4
- package/lib/symbol/SymbolUtil.js +4 -3
- package/package.json +5 -3
package/lib/symbol/Symbol.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import rfdc from 'rfdc';
|
|
2
2
|
import { isIterable } from '../common/index.js';
|
|
3
3
|
import { Location, PositionRange, Range } from '../source/index.js';
|
|
4
|
-
|
|
4
|
+
// #region Mcdoc Categories
|
|
5
5
|
export const McdocCategories = Object.freeze([
|
|
6
6
|
'mcdoc',
|
|
7
7
|
'mcdoc/dispatcher',
|
|
8
8
|
]);
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// #endregion
|
|
10
|
+
// #region Registry Categories
|
|
11
11
|
// Data in `java-edition/src/binder/index.ts` may need to be updated when this section is changed.
|
|
12
12
|
export const RegistryCategories = Object.freeze([
|
|
13
13
|
'activity',
|
|
@@ -50,7 +50,7 @@ export const RegistryCategories = Object.freeze([
|
|
|
50
50
|
'villager_profession',
|
|
51
51
|
'villager_type',
|
|
52
52
|
'worldgen/biome_source',
|
|
53
|
-
'worldgen/block_placer_type',
|
|
53
|
+
'worldgen/block_placer_type', // Removed from Minecraft at some point. Still used by JSON checkers.
|
|
54
54
|
'worldgen/block_state_provider_type',
|
|
55
55
|
'worldgen/carver',
|
|
56
56
|
'worldgen/chunk_generator',
|
|
@@ -65,12 +65,12 @@ export const RegistryCategories = Object.freeze([
|
|
|
65
65
|
'worldgen/structure_piece',
|
|
66
66
|
'worldgen/structure_pool_element',
|
|
67
67
|
'worldgen/structure_processor',
|
|
68
|
-
'worldgen/surface_builder',
|
|
68
|
+
'worldgen/surface_builder', // Removed from Minecraft at some point. Still used by JSON checkers.
|
|
69
69
|
'worldgen/tree_decorator_type',
|
|
70
70
|
'worldgen/trunk_placer_type',
|
|
71
71
|
]);
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
// #endregion
|
|
73
|
+
// #region Data Pack Categories
|
|
74
74
|
export const WorldgenFileCategories = Object.freeze([
|
|
75
75
|
'worldgen/biome',
|
|
76
76
|
'worldgen/configured_carver',
|
|
@@ -92,6 +92,8 @@ export const TaggableResourceLocationCategories = Object.freeze([
|
|
|
92
92
|
export const TagFileCategories = Object.freeze(TaggableResourceLocationCategories.map((key) => `tag/${key}`));
|
|
93
93
|
export const FileCategories = Object.freeze([
|
|
94
94
|
'advancement',
|
|
95
|
+
'chat_type',
|
|
96
|
+
'damage_type',
|
|
95
97
|
'dimension',
|
|
96
98
|
'dimension_type',
|
|
97
99
|
'function',
|
|
@@ -100,6 +102,8 @@ export const FileCategories = Object.freeze([
|
|
|
100
102
|
'predicate',
|
|
101
103
|
'recipe',
|
|
102
104
|
'structure',
|
|
105
|
+
'trim_material',
|
|
106
|
+
'trim_pattern',
|
|
103
107
|
...TagFileCategories,
|
|
104
108
|
...WorldgenFileCategories,
|
|
105
109
|
]);
|
|
@@ -116,7 +120,7 @@ export const DatapackCategories = Object.freeze([
|
|
|
116
120
|
...FileCategories,
|
|
117
121
|
...MiscCategories,
|
|
118
122
|
]);
|
|
119
|
-
|
|
123
|
+
// #endregion
|
|
120
124
|
export const AllCategories = Object.freeze([
|
|
121
125
|
...DatapackCategories,
|
|
122
126
|
...McdocCategories,
|
|
@@ -139,7 +143,9 @@ export var ResourceLocationCategory;
|
|
|
139
143
|
export var SymbolPath;
|
|
140
144
|
(function (SymbolPath) {
|
|
141
145
|
function fromSymbol(symbol) {
|
|
142
|
-
return symbol
|
|
146
|
+
return symbol
|
|
147
|
+
? { category: symbol.category, path: symbol.path }
|
|
148
|
+
: undefined;
|
|
143
149
|
}
|
|
144
150
|
SymbolPath.fromSymbol = fromSymbol;
|
|
145
151
|
/**
|
|
@@ -213,7 +213,7 @@ interface SymbolAddition {
|
|
|
213
213
|
data?: SymbolMetadata;
|
|
214
214
|
usage?: SymbolAdditionUsage;
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
type SymbolAdditionUsage = SymbolAdditionUsageWithRange | SymbolAdditionUsageWithNode;
|
|
217
217
|
interface SymbolAdditionUsageBase extends SymbolLocationMetadata {
|
|
218
218
|
/**
|
|
219
219
|
* The type of this usage. Use `definition` when the usage consists both a `declaration` and an `implementation`.
|
|
@@ -269,9 +269,9 @@ declare namespace SymbolAdditionUsageWithNode {
|
|
|
269
269
|
* which is accessible by any later elements but not saved to the global `SymbolTable`.
|
|
270
270
|
* Later elements represent different levels of `Block` visibility scopes.
|
|
271
271
|
*/
|
|
272
|
-
export
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
export type SymbolStack = [SymbolTable, ...SymbolTable[]];
|
|
273
|
+
type QueryCallback<S extends Symbol | undefined = Symbol | undefined> = (this: SymbolQuery, symbol: S, query: SymbolQuery) => unknown;
|
|
274
|
+
type QueryMemberCallback = (this: void, query: SymbolQuery) => unknown;
|
|
275
275
|
export declare class SymbolQuery {
|
|
276
276
|
#private;
|
|
277
277
|
readonly category: string;
|
package/lib/symbol/SymbolUtil.js
CHANGED
|
@@ -42,8 +42,8 @@ export class SymbolUtil {
|
|
|
42
42
|
this.#trimmableSymbols.delete(SymbolPath.toString(symbol));
|
|
43
43
|
})
|
|
44
44
|
.on('symbolLocationCreated', ({ symbol, location }) => {
|
|
45
|
-
const cache = (this.#cache[location.contributor ?? 'undefined'] ??=
|
|
46
|
-
|
|
45
|
+
const cache = (this.#cache[location.contributor ?? 'undefined'] ??= Object
|
|
46
|
+
.create(null));
|
|
47
47
|
const fileSymbols = (cache[location.uri] ??= new Set());
|
|
48
48
|
const path = SymbolPath.toString(symbol);
|
|
49
49
|
fileSymbols.add(path);
|
|
@@ -763,7 +763,8 @@ export class SymbolQuery {
|
|
|
763
763
|
if (this.#symbol === undefined) {
|
|
764
764
|
throw new Error(`Tried to query member symbol “${identifier}” from an undefined symbol (path “${this.path.join('.')}”)`);
|
|
765
765
|
}
|
|
766
|
-
const memberDoc = typeof doc === 'string' && doc === this.#doc.uri &&
|
|
766
|
+
const memberDoc = typeof doc === 'string' && doc === this.#doc.uri &&
|
|
767
|
+
!this.#createdWithUri
|
|
767
768
|
? this.#doc
|
|
768
769
|
: doc;
|
|
769
770
|
const memberMap = this.#symbol.members;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/core",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -23,12 +23,14 @@
|
|
|
23
23
|
"pako": "^2.0.4",
|
|
24
24
|
"rfdc": "^1.3.0",
|
|
25
25
|
"vscode-languageserver-textdocument": "^1.0.4",
|
|
26
|
-
"
|
|
26
|
+
"whatwg-url": "^14.0.0",
|
|
27
|
+
"@spyglassmc/locales": "0.3.3"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@types/decompress": "^4.2.3",
|
|
30
31
|
"@types/follow-redirects": "^1.14.1",
|
|
31
|
-
"@types/pako": "^2.0.0"
|
|
32
|
+
"@types/pako": "^2.0.0",
|
|
33
|
+
"@types/whatwg-url": "^11.0.4"
|
|
32
34
|
},
|
|
33
35
|
"publishConfig": {
|
|
34
36
|
"access": "public"
|