@spyglassmc/mcdoc 0.3.43 → 0.3.45
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/binder/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsyncBinder, atArray, Dev, Range, ResourceLocationNode, SymbolUtil, traversePreOrder, } from '@spyglassmc/core';
|
|
1
|
+
import { AsyncBinder, atArray, Dev, ErrorSeverity, Range, ResourceLocationNode, SymbolUtil, traversePreOrder, } from '@spyglassmc/core';
|
|
2
2
|
import { localeQuote, localize } from '@spyglassmc/locales';
|
|
3
3
|
import { AttributeNode, AttributeTreeNamedValuesNode, AttributeTreeNode, AttributeTreePosValuesNode, DispatcherTypeNode, DispatchStatementNode, DocCommentsNode, DynamicIndexNode, EnumBlockNode, EnumFieldNode, EnumInjectionNode, EnumNode, FloatRangeNode, IndexBodyNode, InjectionNode, IntRangeNode, ListTypeNode, LiteralNode, LiteralTypeNode, NumericTypeNode, PathNode, PrimitiveArrayTypeNode, ReferenceTypeNode, StaticIndexNode, StringTypeNode, StructBlockNode, StructMapKeyNode, StructNode, StructPairFieldNode, StructSpreadFieldNode, TopLevelNode, TupleTypeNode, TypeAliasNode, TypeArgBlockNode, TypeBaseNode, TypedNumberNode, TypeParamBlockNode, TypeParamNode, UnionTypeNode, UseStatementNode, } from '../node/index.js';
|
|
4
4
|
var ModuleSymbolData;
|
|
@@ -22,7 +22,7 @@ export var TypeDefSymbolData;
|
|
|
22
22
|
export const fileModule = AsyncBinder.create(async (node, ctx) => {
|
|
23
23
|
const moduleIdentifier = uriToIdentifier(ctx.doc.uri, ctx);
|
|
24
24
|
if (!moduleIdentifier) {
|
|
25
|
-
ctx.err.report(localize('mcdoc.binder.out-of-root', localeQuote(ctx.doc.uri)), Range.Beginning,
|
|
25
|
+
ctx.err.report(localize('mcdoc.binder.out-of-root', localeQuote(ctx.doc.uri)), Range.Beginning, ErrorSeverity.Hint);
|
|
26
26
|
return;
|
|
27
27
|
}
|
|
28
28
|
const mcdocCtx = { ...ctx, moduleIdentifier };
|
|
@@ -273,7 +273,7 @@ async function bindPath(node, ctx) {
|
|
|
273
273
|
const referencedModuleFile = pathArrayToString(identifiers);
|
|
274
274
|
const referencedModuleUri = identifierToUri(referencedModuleFile, ctx);
|
|
275
275
|
if (!referencedModuleUri) {
|
|
276
|
-
ctx.err.report(localize('mcdoc.binder.path.unknown-module', localeQuote(referencedModuleFile)), node,
|
|
276
|
+
ctx.err.report(localize('mcdoc.binder.path.unknown-module', localeQuote(referencedModuleFile)), node, ErrorSeverity.Warning);
|
|
277
277
|
return;
|
|
278
278
|
}
|
|
279
279
|
await ctx.ensureBindingStarted(referencedModuleUri);
|
|
@@ -288,7 +288,7 @@ async function bindPath(node, ctx) {
|
|
|
288
288
|
},
|
|
289
289
|
})).else(() => {
|
|
290
290
|
if (indexRight === 0) {
|
|
291
|
-
ctx.err.report(localize('mcdoc.binder.path.unknown-identifier', localeQuote(atArray(identifiers, -1)), localeQuote(pathArrayToString(identifiers.slice(0, -1)))), node,
|
|
291
|
+
ctx.err.report(localize('mcdoc.binder.path.unknown-identifier', localeQuote(atArray(identifiers, -1)), localeQuote(pathArrayToString(identifiers.slice(0, -1)))), node, ErrorSeverity.Warning);
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
}
|
|
@@ -366,7 +366,7 @@ export function registerMcdocBinders(meta) {
|
|
|
366
366
|
meta.registerBinder('mcdoc:module', fileModule);
|
|
367
367
|
}
|
|
368
368
|
function reportDuplicatedDeclaration(ctx, symbol, range, options = { localeString: 'mcdoc.binder.duplicated-declaration' }) {
|
|
369
|
-
ctx.err.report(localize(options.localeString, localeQuote(symbol.identifier)), range,
|
|
369
|
+
ctx.err.report(localize(options.localeString, localeQuote(symbol.identifier)), range, ErrorSeverity.Warning, {
|
|
370
370
|
related: [{
|
|
371
371
|
location: SymbolUtil.getDeclaredLocation(symbol),
|
|
372
372
|
message: localize(`${options.localeString}.related`, localeQuote(symbol.identifier)),
|
package/lib/parser/index.js
CHANGED
|
@@ -73,7 +73,7 @@ export function registerBuiltinAttributes(meta) {
|
|
|
73
73
|
const value = typeDef.value.value;
|
|
74
74
|
return (node, ctx) => {
|
|
75
75
|
if (value % config !== 0) {
|
|
76
|
-
ctx.err.report(localize('not-divisible-by', value, config), node,
|
|
76
|
+
ctx.err.report(localize('not-divisible-by', value, config), node, core.ErrorSeverity.Warning);
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
},
|
|
@@ -144,7 +144,7 @@ export function registerBuiltinAttributes(meta) {
|
|
|
144
144
|
for (const e of config.exclude ?? []) {
|
|
145
145
|
const excluded = core.ResourceLocation.lengthen(e);
|
|
146
146
|
if (resourceLocation === excluded) {
|
|
147
|
-
ctx.err.report(localize('not-allowed-here', localeQuote(excluded)), node,
|
|
147
|
+
ctx.err.report(localize('not-allowed-here', localeQuote(excluded)), node, core.ErrorSeverity.Warning);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
@@ -193,7 +193,7 @@ export function registerBuiltinAttributes(meta) {
|
|
|
193
193
|
range = core.Range.translate(range, 1, -1);
|
|
194
194
|
}
|
|
195
195
|
if (!inferred.value.value.startsWith('#')) {
|
|
196
|
-
ctx.err.report(localize('expected', localeQuote('#')), range,
|
|
196
|
+
ctx.err.report(localize('expected', localeQuote('#')), range, core.ErrorSeverity.Warning);
|
|
197
197
|
return;
|
|
198
198
|
}
|
|
199
199
|
node.color = {
|
|
@@ -243,7 +243,7 @@ export function registerBuiltinAttributes(meta) {
|
|
|
243
243
|
const error = message
|
|
244
244
|
.replace(/^Invalid regular expression: /, '')
|
|
245
245
|
.replace(/^\/.+\/: /, '');
|
|
246
|
-
ctx.err.report(localize('invalid-regex-pattern', error), node,
|
|
246
|
+
ctx.err.report(localize('invalid-regex-pattern', error), node, core.ErrorSeverity.Warning);
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
},
|
|
@@ -260,7 +260,7 @@ export function registerBuiltinAttributes(meta) {
|
|
|
260
260
|
const regex = RegExp(pattern);
|
|
261
261
|
if (!regex.test(value)) {
|
|
262
262
|
const message = config.message ?? localize('mismatching-regex-pattern', pattern);
|
|
263
|
-
ctx.err.report(message, node,
|
|
263
|
+
ctx.err.report(message, node, core.ErrorSeverity.Warning);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
catch (e) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResourceLocation } from '@spyglassmc/core';
|
|
1
|
+
import { ErrorSeverity, ResourceLocation } from '@spyglassmc/core';
|
|
2
2
|
import { arrayToMessage, localeQuote, localize } from '@spyglassmc/locales';
|
|
3
3
|
import { RangeKind } from '../../node/index.js';
|
|
4
4
|
import { McdocType, NumericRange } from '../../type/index.js';
|
|
@@ -281,7 +281,7 @@ export function getDefaultErrorReporter(ctx, getErrorRange) {
|
|
|
281
281
|
return (error) => {
|
|
282
282
|
const defaultTranslationKey = error.kind.replaceAll('_', '-');
|
|
283
283
|
let localizedText;
|
|
284
|
-
let severity =
|
|
284
|
+
let severity = ErrorSeverity.Error;
|
|
285
285
|
switch (error.kind) {
|
|
286
286
|
case 'unknown_tuple_element':
|
|
287
287
|
localizedText = localize('expected', localize('nothing'));
|
|
@@ -294,7 +294,7 @@ export function getDefaultErrorReporter(ctx, getErrorRange) {
|
|
|
294
294
|
localizedText = localize(defaultTranslationKey, error.node.inferredType.kind === 'literal'
|
|
295
295
|
? localeQuote(error.node.inferredType.value.value.toString())
|
|
296
296
|
: `<${localize(`mcdoc.type.${error.node.inferredType.kind}`)}>`);
|
|
297
|
-
severity =
|
|
297
|
+
severity = ErrorSeverity.Warning;
|
|
298
298
|
}
|
|
299
299
|
break;
|
|
300
300
|
case 'missing_key':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/mcdoc",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.45",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"scripts": {
|
|
13
13
|
"release": "npm publish",
|
|
14
|
-
"release:dry": "npm publish --dry-run"
|
|
14
|
+
"release:dry": "npm publish --tag latest --dry-run"
|
|
15
15
|
},
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"url": "https://github.com/SpyglassMC/Spyglass/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@spyglassmc/core": "0.4.
|
|
29
|
-
"@spyglassmc/locales": "0.3.
|
|
28
|
+
"@spyglassmc/core": "0.4.41",
|
|
29
|
+
"@spyglassmc/locales": "0.3.21"
|
|
30
30
|
}
|
|
31
31
|
}
|