@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.
Files changed (76) hide show
  1. package/lib/common/Dev.d.ts +7 -7
  2. package/lib/common/Dev.js +20 -14
  3. package/lib/common/ReadonlyProxy.d.ts +9 -6
  4. package/lib/common/ReadonlyProxy.js +6 -4
  5. package/lib/common/StateProxy.d.ts +11 -11
  6. package/lib/common/StateProxy.js +21 -14
  7. package/lib/common/externals/NodeJsExternals.js +11 -3
  8. package/lib/common/externals/downloader.d.ts +8 -8
  9. package/lib/common/externals/downloader.js +12 -8
  10. package/lib/common/externals/index.d.ts +3 -3
  11. package/lib/common/util.d.ts +23 -21
  12. package/lib/common/util.js +13 -2
  13. package/lib/node/AstNode.d.ts +1 -1
  14. package/lib/node/AstNode.js +3 -1
  15. package/lib/node/CommentNode.d.ts +4 -4
  16. package/lib/node/CommentNode.js +6 -4
  17. package/lib/node/ResourceLocationNode.d.ts +1 -1
  18. package/lib/node/ResourceLocationNode.js +6 -8
  19. package/lib/node/StringNode.d.ts +3 -3
  20. package/lib/node/StringNode.js +4 -1
  21. package/lib/parser/Parser.d.ts +5 -5
  22. package/lib/parser/float.d.ts +1 -1
  23. package/lib/parser/integer.d.ts +1 -1
  24. package/lib/parser/long.d.ts +1 -1
  25. package/lib/parser/resourceLocation.js +1 -1
  26. package/lib/parser/string.js +4 -1
  27. package/lib/parser/util.d.ts +11 -7
  28. package/lib/parser/util.js +17 -2
  29. package/lib/processor/ColorInfoProvider.d.ts +3 -3
  30. package/lib/processor/ColorInfoProvider.js +4 -2
  31. package/lib/processor/InlayHintProvider.d.ts +4 -2
  32. package/lib/processor/SignatureHelpProvider.d.ts +1 -1
  33. package/lib/processor/binder/Binder.d.ts +9 -9
  34. package/lib/processor/binder/Binder.js +18 -12
  35. package/lib/processor/binder/builtin.d.ts +2 -2
  36. package/lib/processor/binder/builtin.js +3 -1
  37. package/lib/processor/binder/index.d.ts +1 -1
  38. package/lib/processor/binder/index.js +1 -1
  39. package/lib/processor/checker/Checker.d.ts +3 -3
  40. package/lib/processor/checker/builtin.d.ts +1 -1
  41. package/lib/processor/checker/builtin.js +2 -1
  42. package/lib/processor/colorizer/Colorizer.d.ts +3 -3
  43. package/lib/processor/completer/Completer.d.ts +1 -1
  44. package/lib/processor/completer/builtin.js +8 -4
  45. package/lib/processor/formatter/Formatter.d.ts +1 -1
  46. package/lib/processor/formatter/Formatter.js +3 -1
  47. package/lib/processor/linter/Linter.d.ts +1 -1
  48. package/lib/processor/util.d.ts +1 -1
  49. package/lib/service/CacheService.d.ts +1 -1
  50. package/lib/service/CacheService.js +2 -2
  51. package/lib/service/Config.d.ts +9 -9
  52. package/lib/service/Config.js +17 -3
  53. package/lib/service/Dependency.d.ts +3 -3
  54. package/lib/service/FileService.d.ts +3 -3
  55. package/lib/service/FileService.js +40 -32
  56. package/lib/service/Project.d.ts +5 -5
  57. package/lib/service/Project.js +9 -5
  58. package/lib/service/Service.js +12 -3
  59. package/lib/service/SymbolRegistrar.d.ts +1 -1
  60. package/lib/service/UriProcessor.d.ts +3 -3
  61. package/lib/service/fileUtil.d.ts +3 -2
  62. package/lib/service/fileUtil.js +4 -0
  63. package/lib/source/IndexMap.d.ts +1 -1
  64. package/lib/source/IndexMap.js +7 -7
  65. package/lib/source/LanguageError.d.ts +4 -4
  66. package/lib/source/LanguageError.js +9 -6
  67. package/lib/source/Location.d.ts +1 -1
  68. package/lib/source/Offset.d.ts +1 -1
  69. package/lib/source/Range.d.ts +1 -1
  70. package/lib/source/Source.d.ts +12 -10
  71. package/lib/source/Source.js +16 -9
  72. package/lib/symbol/Symbol.d.ts +16 -16
  73. package/lib/symbol/Symbol.js +15 -9
  74. package/lib/symbol/SymbolUtil.d.ts +4 -4
  75. package/lib/symbol/SymbolUtil.js +4 -3
  76. package/package.json +5 -3
@@ -86,7 +86,10 @@ export function string(options) {
86
86
  else {
87
87
  ctx.err.report(localize('expected', options.quotes), src);
88
88
  }
89
- ans.valueMap.unshift({ inner: Range.create(0), outer: Range.create(start) });
89
+ ans.valueMap.unshift({
90
+ inner: Range.create(0),
91
+ outer: Range.create(start),
92
+ });
90
93
  if (options.value?.parser) {
91
94
  const valueResult = parseStringValue(options.value.parser, ans.value, ans.valueMap, ctx);
92
95
  /* istanbul ignore else */
@@ -3,11 +3,11 @@ import { SequenceUtil } from '../node/index.js';
3
3
  import type { ParserContext } from '../service/index.js';
4
4
  import type { ErrorSeverity, ReadonlySource, Source } from '../source/index.js';
5
5
  import type { InfallibleParser, Parser, Result, Returnable } from './Parser.js';
6
- declare type ExtractNodeType<P extends Parser<Returnable>> = P extends Parser<infer V> ? V : never;
6
+ type ExtractNodeType<P extends Parser<Returnable>> = P extends Parser<infer V> ? V : never;
7
7
  /**
8
8
  * @template PA Parser array.
9
9
  */
10
- declare type ExtractNodeTypes<PA extends Parser<Returnable>[]> = ExtractNodeType<PA[number]>;
10
+ type ExtractNodeTypes<PA extends Parser<Returnable>[]> = ExtractNodeType<PA[number]>;
11
11
  export interface AttemptResult<N extends Returnable = AstNode> {
12
12
  result: Result<N>;
13
13
  updateSrcAndCtx: () => void;
@@ -27,10 +27,10 @@ interface InfallibleAttemptResult<N extends Returnable = AstNode> extends Attemp
27
27
  */
28
28
  export declare function attempt<N extends Returnable = AstNode>(parser: InfallibleParser<N>, src: Source, ctx: ParserContext): InfallibleAttemptResult<N>;
29
29
  export declare function attempt<N extends Returnable = AstNode>(parser: Parser<N>, src: Source, ctx: ParserContext): AttemptResult<N>;
30
- declare type SP<CN extends AstNode> = SIP<CN> | Parser<CN | SequenceUtil<CN> | undefined> | {
30
+ type SP<CN extends AstNode> = SIP<CN> | Parser<CN | SequenceUtil<CN> | undefined> | {
31
31
  get: (result: SequenceUtil<CN>) => Parser<CN | SequenceUtil<CN> | undefined> | undefined;
32
32
  };
33
- declare type SIP<CN extends AstNode> = InfallibleParser<CN | SequenceUtil<CN> | undefined> | {
33
+ type SIP<CN extends AstNode> = InfallibleParser<CN | SequenceUtil<CN> | undefined> | {
34
34
  get: (result: SequenceUtil<CN>) => InfallibleParser<CN | SequenceUtil<CN> | undefined> | undefined;
35
35
  };
36
36
  /**
@@ -102,13 +102,13 @@ export declare function recover<N extends Returnable>(parser: InfallibleParser<N
102
102
  _inputParserIsInfallible: never;
103
103
  } & void;
104
104
  export declare function recover<N extends Returnable>(parser: Parser<N>, defaultValue: (src: Source, ctx: ParserContext) => N): InfallibleParser<N>;
105
- declare type GettableParser = Parser<Returnable> | {
105
+ type GettableParser = Parser<Returnable> | {
106
106
  get: () => Parser<Returnable>;
107
107
  };
108
- declare type ExtractFromGettableParser<T extends GettableParser> = T extends {
108
+ type ExtractFromGettableParser<T extends GettableParser> = T extends {
109
109
  get: () => infer V;
110
110
  } ? V : T extends Parser<Returnable> ? T : never;
111
- declare type Case = {
111
+ type Case = {
112
112
  predicate?: (this: void, src: ReadonlySource) => boolean;
113
113
  prefix?: string;
114
114
  regex?: RegExp;
@@ -149,5 +149,9 @@ export declare function stopBefore<N extends Returnable>(parser: Parser<N>, ...t
149
149
  export declare function acceptOnly<N extends Returnable>(parser: InfallibleParser<N>, ...characters: (string | readonly string[])[]): InfallibleParser<N>;
150
150
  export declare function acceptOnly<N extends Returnable>(parser: Parser<N>, ...characters: (string | readonly string[])[]): Parser<N>;
151
151
  export declare function acceptIf<P extends Parser<AstNode>>(parser: P, predicate: (this: void, char: string) => boolean): P extends InfallibleParser<infer N> ? InfallibleParser<N> : P extends Parser<infer N> ? Parser<N> : never;
152
+ /**
153
+ * @returns A parser that dumps any parser errors after it finishes parsing.
154
+ */
155
+ export declare function dumpErrors<P extends Parser<AstNode>>(parser: P): P;
152
156
  export {};
153
157
  //# sourceMappingURL=util.d.ts.map
@@ -82,7 +82,10 @@ export function repeat(parser, parseGap) {
82
82
  export function any(parsers, out) {
83
83
  return (src, ctx) => {
84
84
  const results = parsers
85
- .map((parser, i) => ({ attempt: attempt(parser, src, ctx), index: i }))
85
+ .map((parser, i) => ({
86
+ attempt: attempt(parser, src, ctx),
87
+ index: i,
88
+ }))
86
89
  .filter(({ attempt }) => attempt.result !== Failure)
87
90
  .sort((a, b) => b.attempt.endCursor - a.attempt.endCursor ||
88
91
  a.attempt.errorAmount - b.attempt.errorAmount);
@@ -156,7 +159,9 @@ export function select(cases) {
156
159
  (prefix !== undefined ? src.tryPeek(prefix) : undefined) ??
157
160
  (regex && src.matchPattern(regex)) ??
158
161
  true) {
159
- const callableParser = typeof parser === 'object' ? parser.get() : parser;
162
+ const callableParser = typeof parser === 'object'
163
+ ? parser.get()
164
+ : parser;
160
165
  return callableParser(src, ctx);
161
166
  }
162
167
  }
@@ -238,4 +243,14 @@ export function acceptIf(parser, predicate) {
238
243
  return ans;
239
244
  });
240
245
  }
246
+ /**
247
+ * @returns A parser that dumps any parser errors after it finishes parsing.
248
+ */
249
+ export function dumpErrors(parser) {
250
+ return ((src, ctx) => {
251
+ const ans = parser(src, ctx);
252
+ ctx.err.dump();
253
+ return ans;
254
+ });
255
+ }
241
256
  //# sourceMappingURL=util.js.map
@@ -6,7 +6,7 @@ export interface ColorInfo {
6
6
  /**
7
7
  * An array of four decimal numbers within the interval [0, 1] that represent R, G, B, and A respectively.
8
8
  */
9
- export declare type Color = [number, number, number, number];
9
+ export type Color = [number, number, number, number];
10
10
  export declare namespace Color {
11
11
  const NamedColors: Map<string, number>;
12
12
  const ColorNames: string[];
@@ -71,12 +71,12 @@ export declare enum ColorFormat {
71
71
  */
72
72
  CompositeInt = 6
73
73
  }
74
- export declare type FormattableColor = {
74
+ export type FormattableColor = {
75
75
  value: Color;
76
76
  format: ColorFormat[];
77
77
  range?: Range;
78
78
  };
79
- export declare type ColorPresentation = {
79
+ export type ColorPresentation = {
80
80
  label: string;
81
81
  text: string;
82
82
  range: Range;
@@ -140,11 +140,13 @@ export var ColorPresentation;
140
140
  .toString(16)
141
141
  .padStart(8, '0')}`;
142
142
  case ColorFormat.HexRGB:
143
- return `#${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) + color[2] * 255)
143
+ return `#${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) +
144
+ color[2] * 255)
144
145
  .toString(16)
145
146
  .padStart(6, '0')}`;
146
147
  case ColorFormat.CompositeInt:
147
- return `${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) + color[2] * 255)}`;
148
+ return `${Math.round(((color[0] * 255) << 16) + ((color[1] * 255) << 8) +
149
+ color[2] * 255)}`;
148
150
  }
149
151
  }
150
152
  })(ColorPresentation || (ColorPresentation = {}));
@@ -2,8 +2,10 @@ import type { DeepReadonly } from '../common/index.js';
2
2
  import type { AstNode } from '../node/index.js';
3
3
  import type { ProcessorContext } from '../service/index.js';
4
4
  export interface InlayHint {
5
+ label: string;
5
6
  offset: number;
6
- text: string;
7
+ paddingLeft?: boolean;
8
+ paddingRight?: boolean;
7
9
  }
8
- export declare type InlayHintProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ProcessorContext) => readonly InlayHint[];
10
+ export type InlayHintProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ProcessorContext) => readonly InlayHint[];
9
11
  //# sourceMappingURL=InlayHintProvider.d.ts.map
@@ -15,5 +15,5 @@ export interface ParameterInfo {
15
15
  label: [number, number];
16
16
  documentation?: string;
17
17
  }
18
- export declare type SignatureHelpProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: SignatureHelpProviderContext) => SignatureHelp | undefined;
18
+ export type SignatureHelpProvider<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: SignatureHelpProviderContext) => SignatureHelp | undefined;
19
19
  //# sourceMappingURL=SignatureHelpProvider.d.ts.map
@@ -1,26 +1,26 @@
1
1
  import type { AstNode } from '../../node/index.js';
2
2
  import type { BinderContext } from '../../service/index.js';
3
3
  declare const IsAsync: unique symbol;
4
- export declare type Binder<N extends AstNode> = SyncBinder<N> | AsyncBinder<N>;
4
+ export type Binder<N extends AstNode> = SyncBinder<N> | AsyncBinder<N>;
5
5
  export interface SyncBinderInitializer<N extends AstNode> {
6
6
  (node: N, ctx: BinderContext): void;
7
7
  }
8
8
  export interface SyncBinder<N extends AstNode> extends SyncBinderInitializer<N> {
9
9
  [IsAsync]?: never;
10
10
  }
11
- export declare const SyncBinder: Readonly<{
12
- create<N extends AstNode>(binder: SyncBinderInitializer<N>): SyncBinder<N>;
13
- is(binder: Binder<any>): binder is SyncBinder<any>;
14
- }>;
11
+ export declare namespace SyncBinder {
12
+ function create<N extends AstNode>(binder: SyncBinderInitializer<N>): SyncBinder<N>;
13
+ function is(binder: Binder<any>): binder is SyncBinder<any>;
14
+ }
15
15
  interface AsyncBinderInitializer<N extends AstNode> {
16
16
  (node: N, ctx: BinderContext): Promise<void>;
17
17
  }
18
18
  export interface AsyncBinder<N extends AstNode> extends AsyncBinderInitializer<N> {
19
19
  [IsAsync]: true;
20
20
  }
21
- export declare const AsyncBinder: Readonly<{
22
- create<N extends AstNode>(binder: AsyncBinderInitializer<N>): AsyncBinder<N>;
23
- is(binder: Binder<any>): binder is AsyncBinder<any>;
24
- }>;
21
+ export declare namespace AsyncBinder {
22
+ function create<N extends AstNode>(binder: AsyncBinderInitializer<N>): AsyncBinder<N>;
23
+ function is(binder: Binder<any>): binder is AsyncBinder<any>;
24
+ }
25
25
  export {};
26
26
  //# sourceMappingURL=Binder.d.ts.map
@@ -1,18 +1,24 @@
1
1
  const IsAsync = Symbol('IsAsyncBinder');
2
- export const SyncBinder = Object.freeze({
3
- create(binder) {
2
+ export var SyncBinder;
3
+ (function (SyncBinder) {
4
+ function create(binder) {
4
5
  return binder;
5
- },
6
- is(binder) {
6
+ }
7
+ SyncBinder.create = create;
8
+ function is(binder) {
7
9
  return !binder[IsAsync];
8
- },
9
- });
10
- export const AsyncBinder = Object.freeze({
11
- create(binder) {
10
+ }
11
+ SyncBinder.is = is;
12
+ })(SyncBinder || (SyncBinder = {}));
13
+ export var AsyncBinder;
14
+ (function (AsyncBinder) {
15
+ function create(binder) {
12
16
  return Object.assign(binder, { [IsAsync]: true });
13
- },
14
- is(binder) {
17
+ }
18
+ AsyncBinder.create = create;
19
+ function is(binder) {
15
20
  return binder[IsAsync];
16
- },
17
- });
21
+ }
22
+ AsyncBinder.is = is;
23
+ })(AsyncBinder || (AsyncBinder = {}));
18
24
  //# sourceMappingURL=Binder.js.map
@@ -3,13 +3,13 @@ import { ResourceLocationNode } from '../../node/index.js';
3
3
  import type { BinderContext, MetaRegistry } from '../../service/index.js';
4
4
  import type { Binder } from './Binder.js';
5
5
  import { AsyncBinder, SyncBinder } from './Binder.js';
6
- export declare type AttemptResult = {
6
+ export type AttemptResult = {
7
7
  errorAmount: number;
8
8
  totalErrorSpan: number;
9
9
  updateNodeAndCtx: () => void;
10
10
  };
11
11
  export declare function attempt<B extends Binder<never>>(binder: B, node: B extends Binder<infer N extends AstNode> ? N : never, ctx: BinderContext): B extends SyncBinder<any> ? AttemptResult : Promise<AttemptResult>;
12
- declare type ExtractBinder<B extends Binder<never>> = B extends Binder<infer N extends AstNode> ? N : never;
12
+ type ExtractBinder<B extends Binder<never>> = B extends Binder<infer N extends AstNode> ? N : never;
13
13
  export declare function any<Binders extends Binder<never>[]>(binders: Binders): Binders extends SyncBinder<never>[] ? SyncBinder<ExtractBinder<Binders[number]>> : AsyncBinder<ExtractBinder<Binders[number]>>;
14
14
  /**
15
15
  * No operation.
@@ -89,7 +89,9 @@ export const resourceLocation = SyncBinder.create((node, ctx) => {
89
89
  : raw);
90
90
  if (node.options.category) {
91
91
  ctx.symbols
92
- .query(ctx.doc, node.isTag ? `tag/${node.options.category}` : node.options.category, sanitizedRaw)
92
+ .query(ctx.doc, node.isTag
93
+ ? `tag/${node.options.category}`
94
+ : node.options.category, sanitizedRaw)
93
95
  .enter({
94
96
  usage: {
95
97
  type: node.options.usageType,
@@ -1,3 +1,3 @@
1
- export * as binder from './builtin.js';
2
1
  export * from './Binder.js';
2
+ export * as binder from './builtin.js';
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- export * as binder from './builtin.js';
2
1
  export * from './Binder.js';
2
+ export * as binder from './builtin.js';
3
3
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  import type { AstNode } from '../../node/index.js';
2
2
  import type { CheckerContext } from '../../service/index.js';
3
- export declare type Checker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void> | void;
4
- export declare type SyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => void;
5
- export declare type AsyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void>;
3
+ export type Checker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void> | void;
4
+ export type SyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => void;
5
+ export type AsyncChecker<N extends AstNode> = (node: N, ctx: CheckerContext) => PromiseLike<void>;
6
6
  export declare const FallbackChecker: Checker<any>;
7
7
  //# sourceMappingURL=Checker.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import type { AstNode, ResourceLocationNode, SymbolBaseNode } from '../../node/index.js';
2
2
  import type { CheckerContext, MetaRegistry } from '../../service/index.js';
3
3
  import type { Checker, SyncChecker } from './Checker.js';
4
- export declare type AttemptResult = {
4
+ export type AttemptResult = {
5
5
  errorAmount: number;
6
6
  totalErrorSpan: number;
7
7
  updateNodeAndCtx: () => void;
@@ -30,7 +30,8 @@ export function any(checkers) {
30
30
  return (node, ctx) => {
31
31
  const attempts = checkers
32
32
  .map((checker) => attempt(checker, node, ctx))
33
- .sort((a, b) => a.errorAmount - b.errorAmount || a.totalErrorSpan - b.totalErrorSpan);
33
+ .sort((a, b) => a.errorAmount - b.errorAmount ||
34
+ a.totalErrorSpan - b.totalErrorSpan);
34
35
  attempts[0].updateNodeAndCtx();
35
36
  };
36
37
  }
@@ -3,7 +3,7 @@ import type { AstNode } from '../../node/index.js';
3
3
  import type { ColorizerContext } from '../../service/index.js';
4
4
  import type { RangeLike } from '../../source/index.js';
5
5
  import { Range } from '../../source/index.js';
6
- export declare type Colorizer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ColorizerContext) => readonly ColorToken[];
6
+ export type Colorizer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: ColorizerContext) => readonly ColorToken[];
7
7
  export interface ColorToken {
8
8
  range: Range;
9
9
  type: ColorTokenType;
@@ -18,7 +18,7 @@ export declare namespace ColorToken {
18
18
  function fillGap(tokens: readonly ColorToken[], targetRange: Range, type: ColorTokenType, modifiers?: ColorTokenModifier[]): ColorToken[];
19
19
  }
20
20
  export declare const ColorTokenTypes: readonly ["comment", "enum", "enumMember", "function", "keyword", "modifier", "number", "operator", "property", "string", "struct", "type", "type", "variable", "error", "literal", "operator", "resourceLocation", "vector"];
21
- export declare type ColorTokenType = typeof ColorTokenTypes[number];
21
+ export type ColorTokenType = typeof ColorTokenTypes[number];
22
22
  export declare const ColorTokenModifiers: readonly ["declaration", "defaultLibrary", "definition", "deprecated", "documentation", "modification", "readonly"];
23
- export declare type ColorTokenModifier = typeof ColorTokenModifiers[number];
23
+ export type ColorTokenModifier = typeof ColorTokenModifiers[number];
24
24
  //# sourceMappingURL=Colorizer.d.ts.map
@@ -3,7 +3,7 @@ import type { AstNode } from '../../node/index.js';
3
3
  import type { CompleterContext } from '../../service/index.js';
4
4
  import type { RangeLike } from '../../source/index.js';
5
5
  import { Range } from '../../source/index.js';
6
- export declare type Completer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: CompleterContext) => CompletionItem[];
6
+ export type Completer<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: CompleterContext) => CompletionItem[];
7
7
  export declare const enum CompletionKind {
8
8
  Text = 1,
9
9
  Method = 2,
@@ -43,7 +43,8 @@ export const literal = (node) => {
43
43
  ['resourceLocation', 17 /* CompletionKind.File */],
44
44
  ['variable', 6 /* CompletionKind.Variable */],
45
45
  ]).get(node.options.colorTokenType ?? 'keyword') ?? 14 /* CompletionKind.Keyword */;
46
- return (node.options.pool.map((v) => CompletionItem.create(v, node, { kind })) ?? []);
46
+ return (node.options.pool.map((v) => CompletionItem.create(v, node, { kind })) ??
47
+ []);
47
48
  };
48
49
  export const noop = () => [];
49
50
  export function record(o) {
@@ -88,9 +89,12 @@ export function record(o) {
88
89
  }
89
90
  export const resourceLocation = (node, ctx) => {
90
91
  const config = LinterConfigValue.destruct(ctx.config.lint.idOmitDefaultNamespace);
91
- const includeEmptyNamespace = !node.options.isPredicate && node.namespace === '';
92
- const includeDefaultNamespace = node.options.isPredicate || config?.ruleValue !== true;
93
- const excludeDefaultNamespace = !node.options.isPredicate && config?.ruleValue !== false;
92
+ const includeEmptyNamespace = !node.options.isPredicate &&
93
+ node.namespace === '';
94
+ const includeDefaultNamespace = node.options.isPredicate ||
95
+ config?.ruleValue !== true;
96
+ const excludeDefaultNamespace = !node.options.isPredicate &&
97
+ config?.ruleValue !== false;
94
98
  const getPool = (category) => optimizePool(Object.keys(ctx.symbols.getVisibleSymbols(category, ctx.doc.uri)));
95
99
  const optimizePool = (pool) => {
96
100
  const defaultNsPrefix = `${ResourceLocation.DefaultNamespace}${ResourceLocation.NamespacePathSep}`;
@@ -1,7 +1,7 @@
1
1
  import type { DeepReadonly } from '../../common/index.js';
2
2
  import type { AstNode } from '../../node/index.js';
3
3
  import type { FormatterContext } from '../../service/index.js';
4
- export declare type Formatter<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: FormatterContext) => string;
4
+ export type Formatter<N extends AstNode = AstNode> = (node: DeepReadonly<N>, ctx: FormatterContext) => string;
5
5
  export declare function formatterContextIndentation(ctx: FormatterContext, additionalLevels?: number): string;
6
6
  export declare function indentFormatter(ctx: FormatterContext, additionalLevels?: number): FormatterContext;
7
7
  //# sourceMappingURL=Formatter.d.ts.map
@@ -1,6 +1,8 @@
1
1
  export function formatterContextIndentation(ctx, additionalLevels = 0) {
2
2
  const total = ctx.indentLevel + additionalLevels;
3
- return ctx.insertSpaces ? ' '.repeat(total * ctx.tabSize) : '\t'.repeat(total);
3
+ return ctx.insertSpaces
4
+ ? ' '.repeat(total * ctx.tabSize)
5
+ : '\t'.repeat(total);
4
6
  }
5
7
  export function indentFormatter(ctx, additionalLevels = 1) {
6
8
  return {
@@ -1,5 +1,5 @@
1
1
  import type { StateProxy } from '../../index.js';
2
2
  import type { AstNode } from '../../node/index.js';
3
3
  import type { LinterContext } from '../../service/index.js';
4
- export declare type Linter<N extends AstNode> = (node: StateProxy<N>, ctx: LinterContext) => void;
4
+ export type Linter<N extends AstNode> = (node: StateProxy<N>, ctx: LinterContext) => void;
5
5
  //# sourceMappingURL=Linter.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import type { DeepReadonly } from '../index.js';
2
2
  import type { AstNode } from '../node/index.js';
3
- declare type Callback<R> = (this: void, node: AstNode, parents: AstNode[]) => R;
3
+ type Callback<R> = (this: void, node: AstNode, parents: AstNode[]) => R;
4
4
  export declare function traversePreOrder<CN extends AstNode>(node: DeepReadonly<AstNode>, shouldContinue: Callback<unknown>, shouldCallFn: (this: void, node: AstNode, parents: AstNode[]) => node is CN, fn: (this: void, node: CN, parents: AstNode[]) => void): void;
5
5
  export declare function traversePreOrder(node: DeepReadonly<AstNode>, shouldContinue: Callback<unknown>, shouldCallFn: Callback<unknown>, fn: Callback<void>): void;
6
6
  export {};
@@ -19,7 +19,7 @@ interface Checksums {
19
19
  declare namespace Checksums {
20
20
  function create(): Checksums;
21
21
  }
22
- declare type ErrorCache = Record<string, readonly PosRangeLanguageError[]>;
22
+ type ErrorCache = Record<string, readonly PosRangeLanguageError[]>;
23
23
  interface LoadResult {
24
24
  symbols: SymbolTable;
25
25
  }
@@ -36,8 +36,8 @@ export class CacheService {
36
36
  }
37
37
  try {
38
38
  // TODO: Don't update this for every single change.
39
- this.checksums.files[doc.uri] =
40
- await this.project.externals.crypto.getSha1(doc.getText());
39
+ this.checksums.files[doc.uri] = await this.project.externals.crypto
40
+ .getSha1(doc.getText());
41
41
  }
42
42
  catch (e) {
43
43
  if (!this.project.externals.error.isKind(e, 'EISDIR')) {
@@ -13,7 +13,7 @@ export interface Config {
13
13
  */
14
14
  format: FormatterConfig;
15
15
  /**
16
- *t Linter rules.
16
+ * t Linter rules.
17
17
  */
18
18
  lint: LinterConfig;
19
19
  /**
@@ -77,19 +77,19 @@ export interface EnvConfig {
77
77
  permissionLevel: 1 | 2 | 3 | 4;
78
78
  plugins: string[];
79
79
  }
80
- export declare type LinterSeverity = 'hint' | 'information' | 'warning' | 'error';
80
+ export type LinterSeverity = 'hint' | 'information' | 'warning' | 'error';
81
81
  export declare namespace LinterSeverity {
82
82
  function is(value: unknown): value is LinterSeverity;
83
83
  function toErrorSeverity(value: LinterSeverity): ErrorSeverity;
84
84
  }
85
- declare type BracketSpacingConfig = any;
86
- declare type SepSpacingConfig = any;
87
- export declare type QuoteConfig = {
85
+ type BracketSpacingConfig = any;
86
+ type SepSpacingConfig = any;
87
+ export type QuoteConfig = {
88
88
  always?: boolean;
89
89
  avoidEscape?: boolean | null;
90
90
  type?: 'double' | 'single';
91
91
  };
92
- declare type LinterConfigValue<T> = T extends boolean ? null | T | [LinterSeverity, T] | LinterSeverity : null | T | [LinterSeverity, T];
92
+ type LinterConfigValue<T> = T extends boolean ? null | T | [LinterSeverity, T] | LinterSeverity : null | T | [LinterSeverity, T];
93
93
  export declare namespace LinterConfigValue {
94
94
  function destruct(value: LinterConfigValue<boolean | string | number | object>): {
95
95
  ruleSeverity: ErrorSeverity;
@@ -151,7 +151,7 @@ export interface LinterConfig {
151
151
  export interface SnippetsConfig {
152
152
  [label: string]: string;
153
153
  }
154
- export declare type SymbolLinterConfig = Arrayable<SymbolLinterConfig.Complex> | SymbolLinterConfig.Action;
154
+ export type SymbolLinterConfig = Arrayable<SymbolLinterConfig.Complex> | SymbolLinterConfig.Action;
155
155
  export declare namespace SymbolLinterConfig {
156
156
  function is(value: unknown): value is SymbolLinterConfig;
157
157
  interface Complex {
@@ -192,10 +192,10 @@ export declare namespace SymbolLinterConfig {
192
192
  * Config which simulates the default vanilla command system.
193
193
  */
194
194
  export declare const VanillaConfig: Config;
195
- declare type ConfigEvent = {
195
+ type ConfigEvent = {
196
196
  config: Config;
197
197
  };
198
- declare type ErrorEvent = {
198
+ type ErrorEvent = {
199
199
  error: unknown;
200
200
  uri: string;
201
201
  };
@@ -117,7 +117,10 @@ export var SymbolLinterConfig;
117
117
  export const VanillaConfig = {
118
118
  env: {
119
119
  dataSource: 'GitHub',
120
- dependencies: ['@vanilla-mcdoc'],
120
+ dependencies: [
121
+ '@vanilla-datapack',
122
+ '@vanilla-mcdoc',
123
+ ],
121
124
  feature: {
122
125
  codeActions: true,
123
126
  colors: true,
@@ -128,7 +131,16 @@ export const VanillaConfig = {
128
131
  formatting: true,
129
132
  hover: true,
130
133
  inlayHint: {
131
- enabledNodes: ['mcfunction:command_child/unknown'],
134
+ enabledNodes: [
135
+ 'boolean',
136
+ 'double',
137
+ 'float',
138
+ 'integer',
139
+ 'long',
140
+ 'mcfunction:coordinate',
141
+ 'mcfunction:vector',
142
+ 'mcfunction:command_child/unknown',
143
+ ],
132
144
  },
133
145
  semanticColoring: true,
134
146
  selectionRanges: true,
@@ -192,7 +204,9 @@ export const VanillaConfig = {
192
204
  {
193
205
  if: [
194
206
  { category: RegistryCategories, namespace: 'minecraft' },
195
- { category: [...FileCategories, 'bossbar', 'objective', 'team'] },
207
+ {
208
+ category: [...FileCategories, 'bossbar', 'objective', 'team'],
209
+ },
196
210
  ],
197
211
  then: { report: 'warning' },
198
212
  },
@@ -1,10 +1,10 @@
1
- export declare type Dependency = {
1
+ export type Dependency = {
2
2
  uri: string;
3
3
  info?: Record<string, any>;
4
4
  };
5
- export declare type DependencyKey = `@${string}`;
5
+ export type DependencyKey = `@${string}`;
6
6
  export declare namespace DependencyKey {
7
7
  function is(value: string): value is DependencyKey;
8
8
  }
9
- export declare type DependencyProvider = () => PromiseLike<Dependency> | Dependency;
9
+ export type DependencyProvider = () => PromiseLike<Dependency> | Dependency;
10
10
  //# sourceMappingURL=Dependency.d.ts.map
@@ -22,7 +22,7 @@ export interface UriProtocolSupporter {
22
22
  */
23
23
  listRoots(): Iterable<RootUriString>;
24
24
  }
25
- declare type Protocol = `${string}:`;
25
+ type Protocol = `${string}:`;
26
26
  export interface FileService extends UriProtocolSupporter {
27
27
  /**
28
28
  * @param protocol A protocol of URI, including the colon. e.g. `file:`.
@@ -100,7 +100,7 @@ export declare class ArchiveUriSupporter implements UriProtocolSupporter {
100
100
  private static readonly SupportedArchiveExtnames;
101
101
  readonly protocol = "archive:";
102
102
  /**
103
- * @param entries A map from archive URIs to unzipped entries.
103
+ * @param entries A map from archive names to unzipped entries.
104
104
  */
105
105
  private constructor();
106
106
  hash(uri: string): Promise<string>;
@@ -116,7 +116,7 @@ export declare class ArchiveUriSupporter implements UriProtocolSupporter {
116
116
  * @throws When `uri` has the wrong protocol or hostname.
117
117
  */
118
118
  private static decodeUri;
119
- static create(dependencies: readonly Dependency[], externals: Externals, logger: Logger, checksums: Record<RootUriString, string>): Promise<ArchiveUriSupporter>;
119
+ static create(dependencies: readonly Dependency[], externals: Externals, logger: Logger): Promise<ArchiveUriSupporter>;
120
120
  }
121
121
  export {};
122
122
  //# sourceMappingURL=FileService.d.ts.map