Skip to content

Commit 900a092

Browse files
committed
Remove annotatedWith for SchemaDocument
1 parent efff60f commit 900a092

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

language-server/src/features/deprecated.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ export default {
1212

1313
onInitialized() {
1414
subscribe("diagnostics", async (_message, { schemaDocument, diagnostics }) => {
15-
for (const deprecated of schemaDocument.annotatedWith("deprecated", annotationDialectUri)) {
16-
if (JsonNode.annotation(deprecated, "deprecated", annotationDialectUri).some((deprecated) => deprecated)) {
17-
diagnostics.push({
18-
instance: deprecated.parent,
19-
message: JsonNode.annotation(deprecated, "x-deprecationMessage", annotationDialectUri).join("\n") || "deprecated",
20-
severity: DiagnosticSeverity.Warning,
21-
tags: [DiagnosticTag.Deprecated]
22-
});
15+
for (const { schemaResource } of schemaDocument.schemaResources) {
16+
for (const deprecated of JsonNode.annotatedWith(schemaResource, "deprecated", annotationDialectUri)) {
17+
if (JsonNode.annotation(deprecated, "deprecated", annotationDialectUri).some((deprecated) => deprecated)) {
18+
diagnostics.push({
19+
instance: deprecated.parent,
20+
message: JsonNode.annotation(deprecated, "x-deprecationMessage", annotationDialectUri).join("\n") || "deprecated",
21+
severity: DiagnosticSeverity.Warning,
22+
tags: [DiagnosticTag.Deprecated]
23+
});
24+
}
2325
}
2426
}
2527
});

language-server/src/json-schema-document.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,16 +168,6 @@ export class JsonSchemaDocument {
168168
return jsonNode;
169169
}
170170

171-
* annotatedWith(keyword, dialectId = "https://json-schema.org/draft/2020-12/schema") {
172-
for (const { schemaResource } of this.schemaResources) {
173-
for (const node of JsonNode.allNodes(schemaResource)) {
174-
if (JsonNode.annotation(node, keyword, dialectId).length > 0) {
175-
yield node;
176-
}
177-
}
178-
}
179-
}
180-
181171
findNodeAtOffset(offset) {
182172
for (const { schemaResource } of this.schemaResources) {
183173
const node = _findNodeAtOffset(schemaResource, offset);

0 commit comments

Comments
 (0)