@mongodb-js/compass-editor 0.66.1 → 0.68.0
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/dist/codemirror/ace-compat-autocompleter.d.ts +1 -2
- package/dist/codemirror/ace-compat-autocompleter.d.ts.map +1 -1
- package/dist/codemirror/ace-compat-autocompleter.js +1 -38
- package/dist/codemirror/ace-compat-autocompleter.js.map +1 -1
- package/dist/codemirror/query-autocompleter.d.ts +2 -2
- package/dist/codemirror/query-autocompleter.d.ts.map +1 -1
- package/dist/codemirror/query-autocompleter.js +33 -12
- package/dist/codemirror/query-autocompleter.js.map +1 -1
- package/dist/codemirror/query-history-autocompleter.d.ts +2 -2
- package/dist/codemirror/query-history-autocompleter.d.ts.map +1 -1
- package/dist/codemirror/query-history-autocompleter.js +145 -85
- package/dist/codemirror/query-history-autocompleter.js.map +1 -1
- package/dist/codemirror/stage-autocompleter.d.ts.map +1 -1
- package/dist/codemirror/stage-autocompleter.js +1 -0
- package/dist/codemirror/stage-autocompleter.js.map +1 -1
- package/dist/codemirror/utils.d.ts +4 -1
- package/dist/codemirror/utils.d.ts.map +1 -1
- package/dist/codemirror/utils.js +62 -0
- package/dist/codemirror/utils.js.map +1 -1
- package/dist/editor.d.ts +3 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +7 -2
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/use-json-schema-autocompleter.d.ts +42 -0
- package/dist/use-json-schema-autocompleter.d.ts.map +1 -0
- package/dist/use-json-schema-autocompleter.js +446 -0
- package/dist/use-json-schema-autocompleter.js.map +1 -0
- package/package.json +20 -10
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useJsonSchemaAutocompleter = useJsonSchemaAutocompleter;
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const vscode_json_languageservice_1 = require("vscode-json-languageservice");
|
|
9
|
+
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
10
|
+
const autocomplete_1 = require("@codemirror/autocomplete");
|
|
11
|
+
const view_1 = require("@codemirror/view");
|
|
12
|
+
const compass_components_1 = require("@mongodb-js/compass-components");
|
|
13
|
+
const unified_1 = require("unified");
|
|
14
|
+
const remark_parse_1 = __importDefault(require("remark-parse"));
|
|
15
|
+
const remark_rehype_1 = __importDefault(require("remark-rehype"));
|
|
16
|
+
const rehype_sanitize_1 = __importDefault(require("rehype-sanitize"));
|
|
17
|
+
const rehype_stringify_1 = __importDefault(require("rehype-stringify"));
|
|
18
|
+
// The URI we use for the schema
|
|
19
|
+
const SCHEMA_URI = 'inmemory://json-schema.json';
|
|
20
|
+
// The URI we use for the current document being edited
|
|
21
|
+
const DOCUMENT_URI = 'file:///json-schema-document.json';
|
|
22
|
+
// Create markdown parser using remark for rendering hover tooltips
|
|
23
|
+
const markdownParser = (0, unified_1.unified)()
|
|
24
|
+
.use(remark_parse_1.default)
|
|
25
|
+
.use(remark_rehype_1.default, {
|
|
26
|
+
handlers: {
|
|
27
|
+
// Custom handler for links to add target="_blank" and rel="noopener noreferrer"
|
|
28
|
+
link(state, node) {
|
|
29
|
+
const result = {
|
|
30
|
+
type: 'element',
|
|
31
|
+
tagName: 'a',
|
|
32
|
+
properties: {
|
|
33
|
+
href: node.url,
|
|
34
|
+
target: '_blank',
|
|
35
|
+
rel: 'noopener noreferrer',
|
|
36
|
+
...(node.title ? { title: node.title } : {}),
|
|
37
|
+
},
|
|
38
|
+
children: state.all(node),
|
|
39
|
+
};
|
|
40
|
+
return result;
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
})
|
|
44
|
+
.use(() => {
|
|
45
|
+
// Custom rehype plugin to unwrap paragraph tags (render inline without <p>)
|
|
46
|
+
return (tree) => {
|
|
47
|
+
tree.children = tree.children.flatMap((node) => node.type === 'element' && node.tagName === 'p' ? node.children : [node]);
|
|
48
|
+
};
|
|
49
|
+
})
|
|
50
|
+
.use(rehype_sanitize_1.default)
|
|
51
|
+
.use(rehype_stringify_1.default);
|
|
52
|
+
// Shared tooltip styles for hover and lint tooltips
|
|
53
|
+
const tooltipStyles = {
|
|
54
|
+
padding: `${compass_components_1.spacing[200]}px`,
|
|
55
|
+
maxWidth: '300px',
|
|
56
|
+
whiteSpace: 'pre-wrap',
|
|
57
|
+
wordBreak: 'break-word',
|
|
58
|
+
};
|
|
59
|
+
const hoverTooltipStyles = (0, compass_components_1.css)(tooltipStyles);
|
|
60
|
+
// Theme extension to style tooltips - override fixed height on parent container
|
|
61
|
+
const tooltipTheme = view_1.EditorView.theme({
|
|
62
|
+
'.cm-tooltip-hover': {
|
|
63
|
+
height: 'auto !important',
|
|
64
|
+
},
|
|
65
|
+
'.cm-tooltip-lint': tooltipStyles,
|
|
66
|
+
});
|
|
67
|
+
// CompletionItemKind and InsertTextFormat are numeric enums in LSP
|
|
68
|
+
// Values from https://microsoft.github.io/language-server-protocol/specifications/specification-current/
|
|
69
|
+
const CompletionItemKindMap = {
|
|
70
|
+
Text: 1,
|
|
71
|
+
Method: 2,
|
|
72
|
+
Function: 3,
|
|
73
|
+
Constructor: 4,
|
|
74
|
+
Field: 5,
|
|
75
|
+
Variable: 6,
|
|
76
|
+
Class: 7,
|
|
77
|
+
Interface: 8,
|
|
78
|
+
Module: 9,
|
|
79
|
+
Property: 10,
|
|
80
|
+
Unit: 11,
|
|
81
|
+
Value: 12,
|
|
82
|
+
Enum: 13,
|
|
83
|
+
Keyword: 14,
|
|
84
|
+
Snippet: 15,
|
|
85
|
+
Color: 16,
|
|
86
|
+
File: 17,
|
|
87
|
+
Reference: 18,
|
|
88
|
+
Folder: 19,
|
|
89
|
+
EnumMember: 20,
|
|
90
|
+
Constant: 21,
|
|
91
|
+
Struct: 22,
|
|
92
|
+
};
|
|
93
|
+
const InsertTextFormatMap = {
|
|
94
|
+
PlainText: 1,
|
|
95
|
+
Snippet: 2,
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Gets a cached JSON document from a text document, parsing it if necessary.
|
|
99
|
+
*/
|
|
100
|
+
function getJsonDocument(languageService, document, cache) {
|
|
101
|
+
const content = document.getText();
|
|
102
|
+
if (cache.content === content && cache.jsonDoc) {
|
|
103
|
+
return cache.jsonDoc;
|
|
104
|
+
}
|
|
105
|
+
cache.jsonDoc = languageService.parseJSONDocument(document);
|
|
106
|
+
cache.content = content;
|
|
107
|
+
return cache.jsonDoc;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Creates a JSON language service configured with the provided schema.
|
|
111
|
+
*/
|
|
112
|
+
function createJsonLanguageService(schema) {
|
|
113
|
+
const schemaContent = JSON.stringify(schema);
|
|
114
|
+
const languageService = (0, vscode_json_languageservice_1.getLanguageService)({
|
|
115
|
+
schemaRequestService: (uri) => {
|
|
116
|
+
if (uri === SCHEMA_URI) {
|
|
117
|
+
return Promise.resolve(schemaContent);
|
|
118
|
+
}
|
|
119
|
+
return Promise.reject(new Error(`Unable to load schema at ${uri}`));
|
|
120
|
+
},
|
|
121
|
+
});
|
|
122
|
+
languageService.configure({
|
|
123
|
+
allowComments: true,
|
|
124
|
+
schemas: [
|
|
125
|
+
{
|
|
126
|
+
uri: SCHEMA_URI,
|
|
127
|
+
fileMatch: ['*'],
|
|
128
|
+
},
|
|
129
|
+
],
|
|
130
|
+
});
|
|
131
|
+
return languageService;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Converts LSP CompletionItemKind to CodeMirror completion type.
|
|
135
|
+
*/
|
|
136
|
+
function fromCompletionItemKind(kind) {
|
|
137
|
+
if (kind === undefined)
|
|
138
|
+
return undefined;
|
|
139
|
+
switch (kind) {
|
|
140
|
+
case CompletionItemKindMap.Text:
|
|
141
|
+
case CompletionItemKindMap.Snippet:
|
|
142
|
+
return 'text';
|
|
143
|
+
case CompletionItemKindMap.Method:
|
|
144
|
+
return 'method';
|
|
145
|
+
case CompletionItemKindMap.Function:
|
|
146
|
+
return 'function';
|
|
147
|
+
case CompletionItemKindMap.Constructor:
|
|
148
|
+
case CompletionItemKindMap.Class:
|
|
149
|
+
return 'class';
|
|
150
|
+
case CompletionItemKindMap.Field:
|
|
151
|
+
case CompletionItemKindMap.Property:
|
|
152
|
+
return 'property';
|
|
153
|
+
case CompletionItemKindMap.Variable:
|
|
154
|
+
case CompletionItemKindMap.Value:
|
|
155
|
+
return 'variable';
|
|
156
|
+
case CompletionItemKindMap.Interface:
|
|
157
|
+
case CompletionItemKindMap.Struct:
|
|
158
|
+
return 'type';
|
|
159
|
+
case CompletionItemKindMap.Module:
|
|
160
|
+
return 'namespace';
|
|
161
|
+
case CompletionItemKindMap.Enum:
|
|
162
|
+
case CompletionItemKindMap.EnumMember:
|
|
163
|
+
return 'enum';
|
|
164
|
+
case CompletionItemKindMap.Keyword:
|
|
165
|
+
return 'keyword';
|
|
166
|
+
case CompletionItemKindMap.Constant:
|
|
167
|
+
return 'constant';
|
|
168
|
+
default:
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Hook that provides JSON schema-based autocompletion, validation, and hover tooltips.
|
|
174
|
+
*
|
|
175
|
+
* This hook manages the state "above" the editor, following Compass patterns where
|
|
176
|
+
* the parent component owns validation state and provides annotations down to the editor.
|
|
177
|
+
*
|
|
178
|
+
* @param schema - JSON Schema to validate and autocomplete against
|
|
179
|
+
* @param text - Current editor text content (for validation)
|
|
180
|
+
* @returns Object with completer, extensions, annotations, and hasErrors state
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```tsx
|
|
184
|
+
* const { completer, extensions, annotations, hasErrors } = useJsonSchemaAutocompleter(schema, text);
|
|
185
|
+
* return (
|
|
186
|
+
* <>
|
|
187
|
+
* <CodemirrorMultilineEditor
|
|
188
|
+
* text={text}
|
|
189
|
+
* completer={completer}
|
|
190
|
+
* customExtensions={extensions}
|
|
191
|
+
* annotations={annotations}
|
|
192
|
+
* />
|
|
193
|
+
* <Button disabled={hasErrors}>Save</Button>
|
|
194
|
+
* </>
|
|
195
|
+
* );
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
function useJsonSchemaAutocompleter(schema, text) {
|
|
199
|
+
const [editorConfig, setEditorConfig] = (0, react_1.useState)({ completer: undefined, extensions: [] });
|
|
200
|
+
const [annotations, setAnnotations] = (0, react_1.useState)([]);
|
|
201
|
+
const languageServiceRef = (0, react_1.useRef)(null);
|
|
202
|
+
// Per-instance cache for parsed JSON documents in case we need to support multiple editors
|
|
203
|
+
const jsonDocCacheRef = (0, react_1.useRef)({
|
|
204
|
+
content: null,
|
|
205
|
+
jsonDoc: null,
|
|
206
|
+
});
|
|
207
|
+
// Load extensions and language service when schema changes
|
|
208
|
+
(0, react_1.useEffect)(() => {
|
|
209
|
+
if (!schema) {
|
|
210
|
+
setEditorConfig({ completer: undefined, extensions: [] });
|
|
211
|
+
languageServiceRef.current = null;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
// schema is already checked above in the if(!schema) guard
|
|
215
|
+
const languageService = createJsonLanguageService(schema);
|
|
216
|
+
languageServiceRef.current = languageService;
|
|
217
|
+
// Capture cache reference for use in closures
|
|
218
|
+
const jsonDocCache = jsonDocCacheRef.current;
|
|
219
|
+
// Helper to create a TextDocument from content
|
|
220
|
+
const createTextDoc = (content) => {
|
|
221
|
+
return vscode_languageserver_textdocument_1.TextDocument.create(DOCUMENT_URI, 'json', 0, content);
|
|
222
|
+
};
|
|
223
|
+
// Create completion source for autocompletion
|
|
224
|
+
const completionSource = async (context) => {
|
|
225
|
+
// Don't auto-trigger right after comma (user just finished a value)
|
|
226
|
+
if (!context.explicit) {
|
|
227
|
+
const currentLine = context.state.doc.lineAt(context.pos);
|
|
228
|
+
const textBeforeCursor = context.state.sliceDoc(currentLine.from, context.pos);
|
|
229
|
+
if (textBeforeCursor.trimEnd().endsWith(',')) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
const content = context.state.doc.toString();
|
|
234
|
+
const textDoc = createTextDoc(content);
|
|
235
|
+
const jsonDocument = getJsonDocument(languageService, textDoc, jsonDocCache);
|
|
236
|
+
// Calculate LSP position
|
|
237
|
+
const line = context.state.doc.lineAt(context.pos);
|
|
238
|
+
const position = {
|
|
239
|
+
line: line.number - 1,
|
|
240
|
+
character: context.pos - line.from,
|
|
241
|
+
};
|
|
242
|
+
const completions = await languageService.doComplete(textDoc, position, jsonDocument);
|
|
243
|
+
if (!completions || completions.items.length === 0) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
// Use a token-based range that includes punctuation e.g. lucene.xxxx
|
|
247
|
+
// eslint-disable-next-line no-useless-escape
|
|
248
|
+
const word = context.matchBefore(/[^\s"'`:;,=()\[\]{}]*$/);
|
|
249
|
+
const filterFrom = word ? word.from : context.pos;
|
|
250
|
+
const options = [];
|
|
251
|
+
for (const item of completions.items) {
|
|
252
|
+
const { detail, documentation, kind, label, textEdit, insertText } = item;
|
|
253
|
+
// Strip surrounding quotes from the label so that CodeMirror's
|
|
254
|
+
// prefix filtering matches the text the user is actually typing
|
|
255
|
+
// (the filtering range starts after the opening quote).
|
|
256
|
+
const displayLabel = label.replace(/^"(.*)"$/, '$1');
|
|
257
|
+
const completion = {
|
|
258
|
+
label: displayLabel,
|
|
259
|
+
detail,
|
|
260
|
+
type: fromCompletionItemKind(kind),
|
|
261
|
+
info: documentation && typeof documentation === 'string'
|
|
262
|
+
? documentation
|
|
263
|
+
: documentation &&
|
|
264
|
+
typeof documentation === 'object' &&
|
|
265
|
+
'value' in documentation
|
|
266
|
+
? documentation.value
|
|
267
|
+
: undefined,
|
|
268
|
+
};
|
|
269
|
+
if (textEdit && 'range' in textEdit) {
|
|
270
|
+
const insert = textEdit.newText;
|
|
271
|
+
const insertTextFormat = item.insertTextFormat;
|
|
272
|
+
completion.apply = (view, _completion, from, to) => {
|
|
273
|
+
// Swallow a preceding double quote if present. This handles two cases:
|
|
274
|
+
// 1. Key completions: insert starts with '"', avoid doubling it.
|
|
275
|
+
// 2. Non-string value completions (numbers, booleans): the user typed
|
|
276
|
+
// '"' but the LSP returns an unquoted value like `1`, so we need to
|
|
277
|
+
// remove the quote the user already typed.
|
|
278
|
+
let adjFrom = from;
|
|
279
|
+
if (from > 0 && view.state.sliceDoc(from - 1, from) === '"') {
|
|
280
|
+
adjFrom = from - 1;
|
|
281
|
+
}
|
|
282
|
+
// Also swallow a trailing quote right at `to` if present. This covers the
|
|
283
|
+
// common case where closeBrackets auto-inserts the closing quote and the
|
|
284
|
+
// cursor is still before it ("fie|"), otherwise we'd leave an extra '"'.
|
|
285
|
+
let adjTo = to;
|
|
286
|
+
const next = view.state.sliceDoc(to, to + 1);
|
|
287
|
+
if (next === '"') {
|
|
288
|
+
adjTo = to + 1;
|
|
289
|
+
}
|
|
290
|
+
if (insertTextFormat === InsertTextFormatMap.Snippet) {
|
|
291
|
+
(0, autocomplete_1.snippet)(insert.replaceAll(/\$(\d+)/g, '$${$1}'))(view, completion, adjFrom, adjTo);
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
view.dispatch((0, autocomplete_1.insertCompletionText)(view.state, insert, adjFrom, adjTo));
|
|
295
|
+
}
|
|
296
|
+
// Close the completion popup to prevent it from re-triggering
|
|
297
|
+
// immediately after applying.
|
|
298
|
+
(0, autocomplete_1.closeCompletion)(view);
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
else if (insertText) {
|
|
302
|
+
completion.apply = insertText;
|
|
303
|
+
}
|
|
304
|
+
options.push(completion);
|
|
305
|
+
}
|
|
306
|
+
return {
|
|
307
|
+
from: filterFrom,
|
|
308
|
+
to: context.pos,
|
|
309
|
+
options,
|
|
310
|
+
// Keep list active while typing token characters including punctuation
|
|
311
|
+
// eslint-disable-next-line no-useless-escape
|
|
312
|
+
validFor: /[^\s"'`:;,=()\[\]{}]*/,
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
// Create hover tooltip source
|
|
316
|
+
const hoverSource = async (view, pos) => {
|
|
317
|
+
const content = view.state.doc.toString();
|
|
318
|
+
const textDoc = createTextDoc(content);
|
|
319
|
+
const jsonDocument = getJsonDocument(languageService, textDoc, jsonDocCache);
|
|
320
|
+
// Calculate LSP position
|
|
321
|
+
const line = view.state.doc.lineAt(pos);
|
|
322
|
+
const position = {
|
|
323
|
+
line: line.number - 1,
|
|
324
|
+
character: pos - line.from,
|
|
325
|
+
};
|
|
326
|
+
const hover = await languageService.doHover(textDoc, position, jsonDocument);
|
|
327
|
+
if (!hover || !hover.contents) {
|
|
328
|
+
return null;
|
|
329
|
+
}
|
|
330
|
+
let start = pos;
|
|
331
|
+
let end;
|
|
332
|
+
if (hover.range) {
|
|
333
|
+
start = textDoc.offsetAt(hover.range.start);
|
|
334
|
+
end = textDoc.offsetAt(hover.range.end);
|
|
335
|
+
}
|
|
336
|
+
// Extract the text content from the hover
|
|
337
|
+
let hoverText = '';
|
|
338
|
+
const contents = hover.contents;
|
|
339
|
+
if (typeof contents === 'string') {
|
|
340
|
+
hoverText = contents;
|
|
341
|
+
}
|
|
342
|
+
else if (Array.isArray(contents)) {
|
|
343
|
+
hoverText = contents
|
|
344
|
+
.map((c) => (typeof c === 'string' ? c : c.value))
|
|
345
|
+
.join('\n\n');
|
|
346
|
+
}
|
|
347
|
+
else if ('value' in contents) {
|
|
348
|
+
hoverText = contents.value;
|
|
349
|
+
}
|
|
350
|
+
if (!hoverText) {
|
|
351
|
+
return null;
|
|
352
|
+
}
|
|
353
|
+
const tooltipView = {
|
|
354
|
+
dom: (() => {
|
|
355
|
+
const div = document.createElement('div');
|
|
356
|
+
div.className = hoverTooltipStyles;
|
|
357
|
+
div.dataset.testid = 'json-schema-hover-tooltip';
|
|
358
|
+
div.innerHTML = String(markdownParser.processSync(hoverText));
|
|
359
|
+
return div;
|
|
360
|
+
})(),
|
|
361
|
+
};
|
|
362
|
+
return {
|
|
363
|
+
pos: start,
|
|
364
|
+
end,
|
|
365
|
+
create: () => tooltipView,
|
|
366
|
+
};
|
|
367
|
+
};
|
|
368
|
+
// Extension to trigger completions on specific JSON characters
|
|
369
|
+
const triggerCompletionOnType = view_1.EditorView.updateListener.of((update) => {
|
|
370
|
+
if (!update.docChanged)
|
|
371
|
+
return;
|
|
372
|
+
update.changes.iterChanges((_fromA, _toA, _fromB, _toB, inserted) => {
|
|
373
|
+
const insertedText = inserted.toString();
|
|
374
|
+
const shouldTrigger = insertedText === ':' || insertedText.startsWith('\n');
|
|
375
|
+
if (shouldTrigger) {
|
|
376
|
+
(0, autocomplete_1.startCompletion)(update.view);
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
});
|
|
380
|
+
setEditorConfig({
|
|
381
|
+
completer: completionSource,
|
|
382
|
+
extensions: [
|
|
383
|
+
tooltipTheme,
|
|
384
|
+
triggerCompletionOnType,
|
|
385
|
+
(0, view_1.hoverTooltip)(hoverSource),
|
|
386
|
+
],
|
|
387
|
+
});
|
|
388
|
+
}, [schema]);
|
|
389
|
+
// Validate text against schema whenever text or extensions change
|
|
390
|
+
(0, react_1.useEffect)(() => {
|
|
391
|
+
if (!schema ||
|
|
392
|
+
!languageServiceRef.current ||
|
|
393
|
+
editorConfig.extensions.length === 0) {
|
|
394
|
+
setAnnotations([]);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
let aborted = false;
|
|
398
|
+
async function validate() {
|
|
399
|
+
const languageService = languageServiceRef.current;
|
|
400
|
+
if (!languageService)
|
|
401
|
+
return;
|
|
402
|
+
const textDoc = vscode_languageserver_textdocument_1.TextDocument.create(DOCUMENT_URI, 'json', 0, text);
|
|
403
|
+
const jsonDocument = getJsonDocument(languageService, textDoc, jsonDocCacheRef.current);
|
|
404
|
+
const diagnostics = await languageService.doValidation(textDoc, jsonDocument);
|
|
405
|
+
if (aborted)
|
|
406
|
+
return;
|
|
407
|
+
const results = diagnostics.map((diagnostic) => {
|
|
408
|
+
const { message, range, severity } = diagnostic;
|
|
409
|
+
const from = textDoc.offsetAt(range.start);
|
|
410
|
+
const to = textDoc.offsetAt(range.end);
|
|
411
|
+
return {
|
|
412
|
+
message,
|
|
413
|
+
from,
|
|
414
|
+
to,
|
|
415
|
+
severity: severity === 4
|
|
416
|
+
? 'hint'
|
|
417
|
+
: severity === 3
|
|
418
|
+
? 'info'
|
|
419
|
+
: severity === 2
|
|
420
|
+
? 'warning'
|
|
421
|
+
: 'error',
|
|
422
|
+
};
|
|
423
|
+
});
|
|
424
|
+
setAnnotations(results);
|
|
425
|
+
}
|
|
426
|
+
validate().catch(() => {
|
|
427
|
+
// Ignore validation errors
|
|
428
|
+
});
|
|
429
|
+
return () => {
|
|
430
|
+
aborted = true;
|
|
431
|
+
};
|
|
432
|
+
}, [schema, text, editorConfig.extensions.length]);
|
|
433
|
+
// Compute hasErrors from annotations - both error and warning severity block validation
|
|
434
|
+
// Note: vscode-json-languageservice reports schema violations (missing required fields,
|
|
435
|
+
// type mismatches, etc.) as warnings, so we include them in validation blocking
|
|
436
|
+
const hasErrors = (0, react_1.useMemo)(() => {
|
|
437
|
+
return annotations.some((a) => a.severity === 'error' || a.severity === 'warning');
|
|
438
|
+
}, [annotations]);
|
|
439
|
+
return {
|
|
440
|
+
completer: editorConfig.completer,
|
|
441
|
+
extensions: editorConfig.extensions,
|
|
442
|
+
annotations,
|
|
443
|
+
hasErrors,
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
//# sourceMappingURL=use-json-schema-autocompleter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-json-schema-autocompleter.js","sourceRoot":"","sources":["../src/use-json-schema-autocompleter.ts"],"names":[],"mappings":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AAC,OAAO;iBACd,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,cAAc,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC;QAED,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YACpB,2BAA2B;QAC7B,CAAC,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAEnD,wFAAwF;IACxF,wFAAwF;IACxF,gFAAgF;IAChF,MAAM,SAAS,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC7B,OAAO,WAAW,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,CAC1D,CAAC;IACJ,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,OAAO;QACL,SAAS,EAAE,YAAY,CAAC,SAAS;QACjC,UAAU,EAAE,YAAY,CAAC,UAAU;QACnC,WAAW;QACX,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"email": "compass@mongodb.com"
|
|
14
14
|
},
|
|
15
15
|
"homepage": "https://github.com/mongodb-js/compass",
|
|
16
|
-
"version": "0.
|
|
16
|
+
"version": "0.68.0",
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "https://github.com/mongodb-js/compass.git"
|
|
@@ -46,12 +46,13 @@
|
|
|
46
46
|
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@mongodb-js/eslint-config-compass": "^1.4.
|
|
50
|
-
"@mongodb-js/mocha-config-compass": "^1.
|
|
49
|
+
"@mongodb-js/eslint-config-compass": "^1.4.21",
|
|
50
|
+
"@mongodb-js/mocha-config-compass": "^1.8.0",
|
|
51
51
|
"@mongodb-js/prettier-config-compass": "^1.2.9",
|
|
52
|
-
"@mongodb-js/testing-library-compass": "^1.5.
|
|
53
|
-
"@mongodb-js/tsconfig-compass": "^1.
|
|
52
|
+
"@mongodb-js/testing-library-compass": "^1.5.5",
|
|
53
|
+
"@mongodb-js/tsconfig-compass": "^1.3.0",
|
|
54
54
|
"@types/chai": "^4.2.21",
|
|
55
|
+
"@types/hast": "^3.0.4",
|
|
55
56
|
"@types/mocha": "^9.0.0",
|
|
56
57
|
"@types/prettier": "^2.7.1",
|
|
57
58
|
"@types/sinon-chai": "^3.2.5",
|
|
@@ -72,12 +73,21 @@
|
|
|
72
73
|
"@codemirror/state": "^6.5.2",
|
|
73
74
|
"@codemirror/view": "^6.38.0",
|
|
74
75
|
"@lezer/highlight": "^1.2.1",
|
|
75
|
-
"@mongodb-js/compass-components": "^1.
|
|
76
|
-
"@mongodb-js/mongodb-constants": "^0.
|
|
77
|
-
"
|
|
76
|
+
"@mongodb-js/compass-components": "^1.66.0",
|
|
77
|
+
"@mongodb-js/mongodb-constants": "^0.21.0",
|
|
78
|
+
"hast": "^0.0.2",
|
|
79
|
+
"json-schema": "^0.4.0",
|
|
80
|
+
"mongodb-query-parser": "^4.7.7",
|
|
78
81
|
"polished": "^4.2.2",
|
|
79
82
|
"prettier": "^2.7.1",
|
|
80
|
-
"react": "^17.0.2"
|
|
83
|
+
"react": "^17.0.2",
|
|
84
|
+
"rehype-sanitize": "^5.0.1",
|
|
85
|
+
"rehype-stringify": "^9.0.4",
|
|
86
|
+
"remark-parse": "^10.0.0",
|
|
87
|
+
"remark-rehype": "^10.0.0",
|
|
88
|
+
"unified": "^10.0.0",
|
|
89
|
+
"vscode-json-languageservice": "^5.7.2",
|
|
90
|
+
"vscode-languageserver-textdocument": "^1.0.12"
|
|
81
91
|
},
|
|
82
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "770074ed08cbb77c1b71282393d285d3bcf7f024"
|
|
83
93
|
}
|