@spyglassmc/language-server 0.1.2 → 0.3.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/bin/server +1 -1
- package/lib/server.d.ts +1 -1
- package/lib/server.js +75 -98
- package/lib/util/index.d.ts +3 -3
- package/lib/util/index.js +3 -32
- package/lib/util/toCore.d.ts +1 -1
- package/lib/util/toCore.js +4 -33
- package/lib/util/toLS.d.ts +2 -2
- package/lib/util/toLS.js +42 -104
- package/lib/util/types.d.ts +1 -1
- package/lib/util/types.js +1 -2
- package/package.json +6 -5
package/bin/server
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import '../lib/server.js'
|
package/lib/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './util/types';
|
|
1
|
+
export * from './util/types.js';
|
|
2
2
|
//# sourceMappingURL=server.d.ts.map
|
package/lib/server.js
CHANGED
|
@@ -1,55 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
33
|
-
const je = __importStar(require("@spyglassmc/java-edition"));
|
|
34
|
-
const locales = __importStar(require("@spyglassmc/locales"));
|
|
35
|
-
const mcdoc = __importStar(require("@spyglassmc/mcdoc"));
|
|
36
|
-
const env_paths_1 = __importDefault(require("env-paths"));
|
|
37
|
-
const util = __importStar(require("util"));
|
|
38
|
-
const ls = __importStar(require("vscode-languageserver/node"));
|
|
39
|
-
const util_1 = require("./util");
|
|
40
|
-
__exportStar(require("./util/types"), exports);
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import { fileUtil } from '@spyglassmc/core';
|
|
3
|
+
import { NodeJsExternals } from '@spyglassmc/core/lib/nodejs.js';
|
|
4
|
+
import * as je from '@spyglassmc/java-edition';
|
|
5
|
+
import * as locales from '@spyglassmc/locales';
|
|
6
|
+
import * as mcdoc from '@spyglassmc/mcdoc';
|
|
7
|
+
import envPaths from 'env-paths';
|
|
8
|
+
import url from 'url';
|
|
9
|
+
import * as util from 'util';
|
|
10
|
+
import * as ls from 'vscode-languageserver/node.js';
|
|
11
|
+
import { toCore, toLS } from './util/index.js';
|
|
12
|
+
export * from './util/types.js';
|
|
41
13
|
if (process.argv.length === 2) {
|
|
42
14
|
// When the server is launched from the cmd script, the process arguments
|
|
43
15
|
// are wiped. I don't know why it happens, but this is what it is.
|
|
44
16
|
// Therefore, we push a '--stdio' if the argument list is too short.
|
|
45
17
|
process.argv.push('--stdio');
|
|
46
18
|
}
|
|
47
|
-
const { cache: cacheRoot } = (
|
|
19
|
+
const { cache: cacheRoot } = envPaths('spyglassmc');
|
|
48
20
|
const connection = ls.createConnection();
|
|
49
21
|
let capabilities;
|
|
50
22
|
let workspaceFolders;
|
|
51
23
|
let hasShutdown = false;
|
|
52
24
|
let progressReporter;
|
|
25
|
+
const externals = NodeJsExternals;
|
|
53
26
|
const logger = {
|
|
54
27
|
error: (msg, ...args) => connection.console.error(util.format(msg, ...args)),
|
|
55
28
|
info: (msg, ...args) => connection.console.info(util.format(msg, ...args)),
|
|
@@ -80,25 +53,29 @@ connection.onInitialize(async (params) => {
|
|
|
80
53
|
}
|
|
81
54
|
try {
|
|
82
55
|
service = new core.Service({
|
|
83
|
-
|
|
84
|
-
initializers: [
|
|
85
|
-
mcdoc.initialize,
|
|
86
|
-
je.initialize,
|
|
87
|
-
],
|
|
88
|
-
isDebugging: false,
|
|
56
|
+
isDebugging: initializationOptions?.inDevelopmentMode && false,
|
|
89
57
|
logger,
|
|
90
58
|
profilers: new core.ProfilerFactory(logger, [
|
|
91
59
|
'cache#load',
|
|
92
60
|
'cache#save',
|
|
93
61
|
'project#init',
|
|
94
62
|
'project#ready',
|
|
63
|
+
'project#ready#bind',
|
|
95
64
|
]),
|
|
96
|
-
|
|
65
|
+
project: {
|
|
66
|
+
cacheRoot: fileUtil.ensureEndingSlash(url.pathToFileURL(cacheRoot).toString()),
|
|
67
|
+
externals,
|
|
68
|
+
initializers: [
|
|
69
|
+
mcdoc.initialize,
|
|
70
|
+
je.initialize,
|
|
71
|
+
],
|
|
72
|
+
projectRoot: core.fileUtil.ensureEndingSlash(workspaceFolders[0].uri),
|
|
73
|
+
},
|
|
97
74
|
});
|
|
98
75
|
service.project
|
|
99
76
|
.on('documentErrorred', ({ doc, errors }) => {
|
|
100
77
|
connection.sendDiagnostics({
|
|
101
|
-
diagnostics:
|
|
78
|
+
diagnostics: toLS.diagnostics(errors, doc),
|
|
102
79
|
uri: doc.uri,
|
|
103
80
|
version: doc.version,
|
|
104
81
|
});
|
|
@@ -141,8 +118,8 @@ connection.onInitialize(async (params) => {
|
|
|
141
118
|
},
|
|
142
119
|
hoverProvider: {},
|
|
143
120
|
semanticTokensProvider: {
|
|
144
|
-
documentSelector:
|
|
145
|
-
legend:
|
|
121
|
+
documentSelector: toLS.documentSelector(service.project.meta),
|
|
122
|
+
legend: toLS.semanticTokensLegend(),
|
|
146
123
|
full: { delta: false },
|
|
147
124
|
range: true,
|
|
148
125
|
},
|
|
@@ -179,10 +156,10 @@ connection.onInitialized(async () => {
|
|
|
179
156
|
}
|
|
180
157
|
});
|
|
181
158
|
connection.onDidOpenTextDocument(({ textDocument: { text, uri, version, languageId: languageID } }) => {
|
|
182
|
-
service.project.onDidOpen(uri, languageID, version, text);
|
|
159
|
+
return service.project.onDidOpen(uri, languageID, version, text);
|
|
183
160
|
});
|
|
184
161
|
connection.onDidChangeTextDocument(({ contentChanges, textDocument: { uri, version } }) => {
|
|
185
|
-
service.project.onDidChange(uri, contentChanges, version);
|
|
162
|
+
return service.project.onDidChange(uri, contentChanges, version);
|
|
186
163
|
});
|
|
187
164
|
connection.onDidCloseTextDocument(({ textDocument: { uri } }) => {
|
|
188
165
|
service.project.onDidClose(uri);
|
|
@@ -190,115 +167,115 @@ connection.onDidCloseTextDocument(({ textDocument: { uri } }) => {
|
|
|
190
167
|
connection.workspace.onDidRenameFiles(({}) => {
|
|
191
168
|
});
|
|
192
169
|
connection.onColorPresentation(async ({ textDocument: { uri }, color, range }) => {
|
|
193
|
-
const docAndNode = await service.project.
|
|
170
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
194
171
|
if (!docAndNode) {
|
|
195
172
|
return undefined;
|
|
196
173
|
}
|
|
197
174
|
const { doc, node } = docAndNode;
|
|
198
|
-
const presentation = service.getColorPresentation(node, doc,
|
|
199
|
-
return
|
|
175
|
+
const presentation = service.getColorPresentation(node, doc, toCore.range(range, doc), toCore.color(color));
|
|
176
|
+
return toLS.colorPresentationArray(presentation, doc);
|
|
200
177
|
});
|
|
201
178
|
connection.onDocumentColor(async ({ textDocument: { uri } }) => {
|
|
202
|
-
const docAndNode = await service.project.
|
|
179
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
203
180
|
if (!docAndNode) {
|
|
204
181
|
return undefined;
|
|
205
182
|
}
|
|
206
183
|
const { doc, node } = docAndNode;
|
|
207
184
|
const info = service.getColorInfo(node, doc);
|
|
208
|
-
return
|
|
185
|
+
return toLS.colorInformationArray(info, doc);
|
|
209
186
|
});
|
|
210
187
|
connection.onCompletion(async ({ textDocument: { uri }, position, context }) => {
|
|
211
|
-
const docAndNode = await service.project.
|
|
188
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
212
189
|
if (!docAndNode) {
|
|
213
190
|
return undefined;
|
|
214
191
|
}
|
|
215
192
|
const { doc, node } = docAndNode;
|
|
216
|
-
const offset =
|
|
193
|
+
const offset = toCore.offset(position, doc);
|
|
217
194
|
const items = service.complete(node, doc, offset, context?.triggerCharacter);
|
|
218
|
-
return items.map(item =>
|
|
195
|
+
return items.map(item => toLS.completionItem(item, doc, offset, capabilities.textDocument?.completion?.completionItem?.insertReplaceSupport));
|
|
219
196
|
});
|
|
220
197
|
connection.onRequest('spyglassmc/dataHackPubify', ({ initialism }) => {
|
|
221
198
|
return service.dataHackPubify(initialism);
|
|
222
199
|
});
|
|
223
200
|
connection.onDeclaration(async ({ textDocument: { uri }, position }) => {
|
|
224
|
-
const docAndNode = await service.project.
|
|
201
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
225
202
|
if (!docAndNode) {
|
|
226
203
|
return undefined;
|
|
227
204
|
}
|
|
228
205
|
const { doc, node } = docAndNode;
|
|
229
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
230
|
-
return
|
|
206
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), ['declaration', 'definition']);
|
|
207
|
+
return toLS.locationLink(ans, doc, capabilities.textDocument?.declaration?.linkSupport);
|
|
231
208
|
});
|
|
232
209
|
connection.onDefinition(async ({ textDocument: { uri }, position }) => {
|
|
233
|
-
const docAndNode = await service.project.
|
|
210
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
234
211
|
if (!docAndNode) {
|
|
235
212
|
return undefined;
|
|
236
213
|
}
|
|
237
214
|
const { doc, node } = docAndNode;
|
|
238
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
239
|
-
return
|
|
215
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), ['definition', 'declaration', 'implementation', 'typeDefinition']);
|
|
216
|
+
return toLS.locationLink(ans, doc, capabilities.textDocument?.definition?.linkSupport);
|
|
240
217
|
});
|
|
241
218
|
connection.onImplementation(async ({ textDocument: { uri }, position }) => {
|
|
242
|
-
const docAndNode = await service.project.
|
|
219
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
243
220
|
if (!docAndNode) {
|
|
244
221
|
return undefined;
|
|
245
222
|
}
|
|
246
223
|
const { doc, node } = docAndNode;
|
|
247
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
248
|
-
return
|
|
224
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), ['implementation', 'definition']);
|
|
225
|
+
return toLS.locationLink(ans, doc, capabilities.textDocument?.implementation?.linkSupport);
|
|
249
226
|
});
|
|
250
227
|
connection.onReferences(async ({ textDocument: { uri }, position, context: { includeDeclaration } }) => {
|
|
251
|
-
const docAndNode = await service.project.
|
|
228
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
252
229
|
if (!docAndNode) {
|
|
253
230
|
return undefined;
|
|
254
231
|
}
|
|
255
232
|
const { doc, node } = docAndNode;
|
|
256
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
257
|
-
return
|
|
233
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), includeDeclaration ? undefined : ['reference']);
|
|
234
|
+
return toLS.locationLink(ans, doc, false);
|
|
258
235
|
});
|
|
259
236
|
connection.onTypeDefinition(async ({ textDocument: { uri }, position }) => {
|
|
260
|
-
const docAndNode = await service.project.
|
|
237
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
261
238
|
if (!docAndNode) {
|
|
262
239
|
return undefined;
|
|
263
240
|
}
|
|
264
241
|
const { doc, node } = docAndNode;
|
|
265
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
266
|
-
return
|
|
242
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), ['typeDefinition']);
|
|
243
|
+
return toLS.locationLink(ans, doc, capabilities.textDocument?.typeDefinition?.linkSupport);
|
|
267
244
|
});
|
|
268
245
|
connection.onDocumentHighlight(async ({ textDocument: { uri }, position }) => {
|
|
269
|
-
const docAndNode = await service.project.
|
|
246
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
270
247
|
if (!docAndNode) {
|
|
271
248
|
return undefined;
|
|
272
249
|
}
|
|
273
250
|
const { doc, node } = docAndNode;
|
|
274
|
-
const ans = await service.getSymbolLocations(node, doc,
|
|
275
|
-
return
|
|
251
|
+
const ans = await service.getSymbolLocations(node, doc, toCore.offset(position, doc), undefined, true);
|
|
252
|
+
return toLS.documentHighlight(ans);
|
|
276
253
|
});
|
|
277
254
|
connection.onDocumentSymbol(async ({ textDocument: { uri } }) => {
|
|
278
|
-
const docAndNode = await service.project.
|
|
255
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
279
256
|
if (!docAndNode) {
|
|
280
257
|
return undefined;
|
|
281
258
|
}
|
|
282
259
|
const { doc, node } = docAndNode;
|
|
283
|
-
return
|
|
260
|
+
return toLS.documentSymbolsFromTables([service.project.symbols.global, ...core.AstNode.getLocalsToLeaves(node)], doc, capabilities.textDocument?.documentSymbol?.hierarchicalDocumentSymbolSupport, capabilities.textDocument?.documentSymbol?.symbolKind?.valueSet);
|
|
284
261
|
});
|
|
285
262
|
connection.onHover(async ({ textDocument: { uri }, position }) => {
|
|
286
|
-
const docAndNode = await service.project.
|
|
263
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
287
264
|
if (!docAndNode) {
|
|
288
265
|
return undefined;
|
|
289
266
|
}
|
|
290
267
|
const { doc, node } = docAndNode;
|
|
291
|
-
const ans = service.getHover(node, doc,
|
|
292
|
-
return ans ?
|
|
268
|
+
const ans = service.getHover(node, doc, toCore.offset(position, doc));
|
|
269
|
+
return ans ? toLS.hover(ans, doc) : undefined;
|
|
293
270
|
});
|
|
294
271
|
connection.onRequest('spyglassmc/inlayHints', async ({ textDocument: { uri }, range }) => {
|
|
295
|
-
const docAndNode = await service.project.
|
|
272
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
296
273
|
if (!docAndNode) {
|
|
297
274
|
return [];
|
|
298
275
|
}
|
|
299
276
|
const { doc, node } = docAndNode;
|
|
300
|
-
const hints = service.getInlayHints(node, doc,
|
|
301
|
-
return
|
|
277
|
+
const hints = service.getInlayHints(node, doc, toCore.range(range, doc));
|
|
278
|
+
return toLS.inlayHints(hints, doc);
|
|
302
279
|
});
|
|
303
280
|
connection.onRequest('spyglassmc/resetProjectCache', async () => {
|
|
304
281
|
service.project.resetCache();
|
|
@@ -308,37 +285,37 @@ connection.onRequest('spyglassmc/showCacheRoot', async () => {
|
|
|
308
285
|
return service.project.showCacheRoot();
|
|
309
286
|
});
|
|
310
287
|
connection.languages.semanticTokens.on(async ({ textDocument: { uri } }) => {
|
|
311
|
-
const docAndNode = await service.project.
|
|
288
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
312
289
|
if (!docAndNode) {
|
|
313
290
|
return { data: [] };
|
|
314
291
|
}
|
|
315
292
|
const { doc, node } = docAndNode;
|
|
316
293
|
const tokens = service.colorize(node, doc);
|
|
317
|
-
return
|
|
294
|
+
return toLS.semanticTokens(tokens, doc, capabilities.textDocument?.semanticTokens?.multilineTokenSupport);
|
|
318
295
|
});
|
|
319
296
|
connection.languages.semanticTokens.onRange(async ({ textDocument: { uri }, range }) => {
|
|
320
|
-
const docAndNode = await service.project.
|
|
297
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
321
298
|
if (!docAndNode) {
|
|
322
299
|
return { data: [] };
|
|
323
300
|
}
|
|
324
301
|
const { doc, node } = docAndNode;
|
|
325
|
-
const tokens = service.colorize(node, doc,
|
|
326
|
-
return
|
|
302
|
+
const tokens = service.colorize(node, doc, toCore.range(range, doc));
|
|
303
|
+
return toLS.semanticTokens(tokens, doc, capabilities.textDocument?.semanticTokens?.multilineTokenSupport);
|
|
327
304
|
});
|
|
328
305
|
connection.onSignatureHelp(async ({ textDocument: { uri }, position }) => {
|
|
329
|
-
const docAndNode = await service.project.
|
|
306
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
330
307
|
if (!docAndNode) {
|
|
331
308
|
return undefined;
|
|
332
309
|
}
|
|
333
310
|
const { doc, node } = docAndNode;
|
|
334
|
-
const help = service.getSignatureHelp(node, doc,
|
|
335
|
-
return
|
|
311
|
+
const help = service.getSignatureHelp(node, doc, toCore.offset(position, doc));
|
|
312
|
+
return toLS.signatureHelp(help);
|
|
336
313
|
});
|
|
337
314
|
connection.onWorkspaceSymbol(({ query }) => {
|
|
338
|
-
return
|
|
315
|
+
return toLS.symbolInformationArrayFromTable(service.project.symbols.global, query, capabilities.textDocument?.documentSymbol?.symbolKind?.valueSet);
|
|
339
316
|
});
|
|
340
317
|
connection.onDocumentFormatting(async ({ textDocument: { uri }, options }) => {
|
|
341
|
-
const docAndNode = await service.project.
|
|
318
|
+
const docAndNode = await service.project.ensureClientManagedChecked(uri);
|
|
342
319
|
if (!docAndNode) {
|
|
343
320
|
return undefined;
|
|
344
321
|
}
|
|
@@ -347,7 +324,7 @@ connection.onDocumentFormatting(async ({ textDocument: { uri }, options }) => {
|
|
|
347
324
|
if (options.insertFinalNewline && text.charAt(text.length - 1) !== '\n') {
|
|
348
325
|
text += '\n';
|
|
349
326
|
}
|
|
350
|
-
return [
|
|
327
|
+
return [toLS.textEdit(node.range, text, doc)];
|
|
351
328
|
});
|
|
352
329
|
connection.onShutdown(async () => {
|
|
353
330
|
await service.project.close();
|
package/lib/util/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * as toCore from './toCore';
|
|
2
|
-
export * as toLS from './toLS';
|
|
3
|
-
export * from './types';
|
|
1
|
+
export * as toCore from './toCore.js';
|
|
2
|
+
export * as toLS from './toLS.js';
|
|
3
|
+
export * from './types.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/util/index.js
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.toLS = exports.toCore = void 0;
|
|
30
|
-
exports.toCore = __importStar(require("./toCore"));
|
|
31
|
-
exports.toLS = __importStar(require("./toLS"));
|
|
32
|
-
__exportStar(require("./types"), exports);
|
|
1
|
+
export * as toCore from './toCore.js';
|
|
2
|
+
export * as toLS from './toLS.js';
|
|
3
|
+
export * from './types.js';
|
|
33
4
|
//# sourceMappingURL=index.js.map
|
package/lib/util/toCore.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as core from '@spyglassmc/core';
|
|
2
2
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import type * as ls from 'vscode-languageserver/node';
|
|
3
|
+
import type * as ls from 'vscode-languageserver/node.js';
|
|
4
4
|
export declare function offset(position: ls.Position, doc: TextDocument): number;
|
|
5
5
|
export declare function range(range: ls.Range, doc: TextDocument): core.Range;
|
|
6
6
|
export declare function color(color: ls.Color): core.Color;
|
package/lib/util/toCore.js
CHANGED
|
@@ -1,45 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* A series of functions that can transform `vscode-languageserver` types to `@spyglassmc/core` types.
|
|
4
3
|
*
|
|
5
4
|
* Functions are named after types in `@spyglassmc/core`.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
-
if (mod && mod.__esModule) return mod;
|
|
25
|
-
var result = {};
|
|
26
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
-
__setModuleDefault(result, mod);
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.color = exports.range = exports.offset = void 0;
|
|
32
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
33
|
-
function offset(position, doc) {
|
|
6
|
+
import * as core from '@spyglassmc/core';
|
|
7
|
+
export function offset(position, doc) {
|
|
34
8
|
return doc.offsetAt(position);
|
|
35
9
|
}
|
|
36
|
-
|
|
37
|
-
function range(range, doc) {
|
|
10
|
+
export function range(range, doc) {
|
|
38
11
|
return core.Range.create(offset(range.start, doc), offset(range.end, doc));
|
|
39
12
|
}
|
|
40
|
-
|
|
41
|
-
function color(color) {
|
|
13
|
+
export function color(color) {
|
|
42
14
|
return [color.red, color.green, color.blue, color.alpha];
|
|
43
15
|
}
|
|
44
|
-
exports.color = color;
|
|
45
16
|
//# sourceMappingURL=toCore.js.map
|
package/lib/util/toLS.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as core from '@spyglassmc/core';
|
|
2
2
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
|
-
import * as ls from 'vscode-languageserver/node';
|
|
4
|
-
import type { MyLspInlayHint } from './types';
|
|
3
|
+
import * as ls from 'vscode-languageserver/node.js';
|
|
4
|
+
import type { MyLspInlayHint } from './types.js';
|
|
5
5
|
export declare function color(color: core.Color): ls.Color;
|
|
6
6
|
export declare function colorInformation(info: core.ColorInfo, doc: TextDocument): ls.ColorInformation;
|
|
7
7
|
export declare function colorInformationArray(info: core.ColorInfo[], doc: TextDocument): ls.ColorInformation[];
|
package/lib/util/toLS.js
CHANGED
|
@@ -1,67 +1,36 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/*
|
|
3
2
|
* A series of functions that can transform `@spyglassmc/core` types to `vscode-languageserver` types.
|
|
4
3
|
*
|
|
5
4
|
* Functions are named after types in `vscode-languageserver`.
|
|
6
5
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(o, k2, desc);
|
|
14
|
-
}) : (function(o, m, k, k2) {
|
|
15
|
-
if (k2 === undefined) k2 = k;
|
|
16
|
-
o[k2] = m[k];
|
|
17
|
-
}));
|
|
18
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
-
}) : function(o, v) {
|
|
21
|
-
o["default"] = v;
|
|
22
|
-
});
|
|
23
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
24
|
-
if (mod && mod.__esModule) return mod;
|
|
25
|
-
var result = {};
|
|
26
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
27
|
-
__setModuleDefault(result, mod);
|
|
28
|
-
return result;
|
|
29
|
-
};
|
|
30
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.textEdit = exports.symbolKind = exports.symbolInformationArrayFromTable = exports.symbolInformationArray = exports.symbolInformation = exports.parameterInformation = exports.signatureInformation = exports.signatureHelp = exports.semanticTokenType = exports.semanticTokensLegend = exports.semanticTokens = exports.semanticTokenModifiers = exports.semanticTokenModifier = exports.range = exports.position = exports.markupContent = exports.locationLink = exports.location = exports.completionItem = exports.inlayHints = exports.inlayHint = exports.hover = exports.documentSymbolsFromTables = exports.documentSymbolsFromTable = exports.documentSymbols = exports.documentSymbol = exports.documentSelector = exports.documentHighlight = exports.diagnosticSeverity = exports.diagnostics = exports.diagnostic = exports.colorPresentationArray = exports.colorPresentation = exports.colorInformationArray = exports.colorInformation = exports.color = void 0;
|
|
32
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
33
|
-
const ls = __importStar(require("vscode-languageserver/node"));
|
|
34
|
-
const node_1 = require("vscode-languageserver/node");
|
|
6
|
+
import * as core from '@spyglassmc/core';
|
|
7
|
+
import * as ls from 'vscode-languageserver/node.js';
|
|
8
|
+
import { InsertTextFormat } from 'vscode-languageserver/node.js';
|
|
35
9
|
const ZeroPosition = { line: 0, character: 0 };
|
|
36
10
|
const ZeroRange = { start: ZeroPosition, end: ZeroPosition };
|
|
37
|
-
function color(color) {
|
|
11
|
+
export function color(color) {
|
|
38
12
|
return ls.Color.create(...color);
|
|
39
13
|
}
|
|
40
|
-
|
|
41
|
-
function colorInformation(info, doc) {
|
|
14
|
+
export function colorInformation(info, doc) {
|
|
42
15
|
return ls.ColorInformation.create(range(info.range, doc), color(info.color));
|
|
43
16
|
}
|
|
44
|
-
|
|
45
|
-
function colorInformationArray(info, doc) {
|
|
17
|
+
export function colorInformationArray(info, doc) {
|
|
46
18
|
return info.map(i => colorInformation(i, doc));
|
|
47
19
|
}
|
|
48
|
-
|
|
49
|
-
function colorPresentation(presentation, doc) {
|
|
20
|
+
export function colorPresentation(presentation, doc) {
|
|
50
21
|
const edit = ls.TextEdit.replace(range(presentation.range, doc), presentation.text);
|
|
51
22
|
return ls.ColorPresentation.create(presentation.label, edit);
|
|
52
23
|
}
|
|
53
|
-
|
|
54
|
-
function colorPresentationArray(presentation, doc) {
|
|
24
|
+
export function colorPresentationArray(presentation, doc) {
|
|
55
25
|
return presentation.map(p => colorPresentation(p, doc));
|
|
56
26
|
}
|
|
57
|
-
|
|
58
|
-
function diagnostic(error, doc) {
|
|
27
|
+
export function diagnostic(error, doc) {
|
|
59
28
|
const ans = ls.Diagnostic.create(range(error.range, doc), error.message, diagnosticSeverity(error.severity), undefined, 'spyglassmc');
|
|
60
29
|
if (error.info?.deprecated) {
|
|
61
|
-
(ans.tags
|
|
30
|
+
(ans.tags ??= [])?.push(ls.DiagnosticTag.Deprecated);
|
|
62
31
|
}
|
|
63
32
|
if (error.info?.unnecessary) {
|
|
64
|
-
(ans.tags
|
|
33
|
+
(ans.tags ??= [])?.push(ls.DiagnosticTag.Unnecessary);
|
|
65
34
|
}
|
|
66
35
|
if (error.info?.codeAction) {
|
|
67
36
|
ans.data = {
|
|
@@ -76,12 +45,10 @@ function diagnostic(error, doc) {
|
|
|
76
45
|
}
|
|
77
46
|
return ans;
|
|
78
47
|
}
|
|
79
|
-
|
|
80
|
-
function diagnostics(errors, doc) {
|
|
48
|
+
export function diagnostics(errors, doc) {
|
|
81
49
|
return errors.map(e => diagnostic(e, doc));
|
|
82
50
|
}
|
|
83
|
-
|
|
84
|
-
function diagnosticSeverity(severity) {
|
|
51
|
+
export function diagnosticSeverity(severity) {
|
|
85
52
|
switch (severity) {
|
|
86
53
|
case 0 /* core.ErrorSeverity.Hint */:
|
|
87
54
|
return ls.DiagnosticSeverity.Hint;
|
|
@@ -93,19 +60,16 @@ function diagnosticSeverity(severity) {
|
|
|
93
60
|
return ls.DiagnosticSeverity.Error;
|
|
94
61
|
}
|
|
95
62
|
}
|
|
96
|
-
|
|
97
|
-
function documentHighlight(locations) {
|
|
63
|
+
export function documentHighlight(locations) {
|
|
98
64
|
return locations?.locations
|
|
99
65
|
?.filter(loc => loc.posRange)
|
|
100
66
|
?.map(loc => ({ range: loc.posRange }));
|
|
101
67
|
}
|
|
102
|
-
|
|
103
|
-
function documentSelector(meta) {
|
|
68
|
+
export function documentSelector(meta) {
|
|
104
69
|
const ans = meta.getLanguages().map(id => ({ language: id }));
|
|
105
70
|
return ans;
|
|
106
71
|
}
|
|
107
|
-
|
|
108
|
-
function documentSymbol(symbol, symLoc, doc, hierarchicalSupport, supportedKinds = []) {
|
|
72
|
+
export function documentSymbol(symbol, symLoc, doc, hierarchicalSupport, supportedKinds = []) {
|
|
109
73
|
return {
|
|
110
74
|
name: symbol.identifier,
|
|
111
75
|
kind: symbolKind(symbol.category, symbol.subcategory, supportedKinds),
|
|
@@ -114,46 +78,39 @@ function documentSymbol(symbol, symLoc, doc, hierarchicalSupport, supportedKinds
|
|
|
114
78
|
children: hierarchicalSupport ? documentSymbols(symbol.members, doc, hierarchicalSupport, supportedKinds) : undefined,
|
|
115
79
|
};
|
|
116
80
|
}
|
|
117
|
-
|
|
118
|
-
function documentSymbols(map = {}, doc, hierarchicalSupport, supportedKinds = []) {
|
|
81
|
+
export function documentSymbols(map = {}, doc, hierarchicalSupport, supportedKinds = []) {
|
|
119
82
|
return Object.values(map)
|
|
120
83
|
.map(s => [s, [...s.declaration ?? [], ...s.definition ?? [], ...s.implementation ?? [], ...s.typeDefinition ?? []].find(l => l.uri === doc.uri)])
|
|
121
84
|
.filter(([_s, l]) => !!l)
|
|
122
85
|
.map(([s, l]) => documentSymbol(s, l, doc, hierarchicalSupport, supportedKinds));
|
|
123
86
|
}
|
|
124
|
-
|
|
125
|
-
function documentSymbolsFromTable(table, doc, hierarchicalSupport, supportedKinds = []) {
|
|
87
|
+
export function documentSymbolsFromTable(table, doc, hierarchicalSupport, supportedKinds = []) {
|
|
126
88
|
return Object.values(table)
|
|
127
89
|
.map(m => documentSymbols(m, doc, hierarchicalSupport, supportedKinds))
|
|
128
90
|
.flat();
|
|
129
91
|
}
|
|
130
|
-
|
|
131
|
-
function documentSymbolsFromTables(tables, doc, hierarchicalSupport, supportedKinds = []) {
|
|
92
|
+
export function documentSymbolsFromTables(tables, doc, hierarchicalSupport, supportedKinds = []) {
|
|
132
93
|
return tables
|
|
133
94
|
.map(t => documentSymbolsFromTable(t, doc, hierarchicalSupport, supportedKinds))
|
|
134
95
|
.flat();
|
|
135
96
|
}
|
|
136
|
-
|
|
137
|
-
function hover(hover, doc) {
|
|
97
|
+
export function hover(hover, doc) {
|
|
138
98
|
const ans = {
|
|
139
99
|
contents: markupContent(hover.markdown),
|
|
140
100
|
range: range(hover.range, doc),
|
|
141
101
|
};
|
|
142
102
|
return ans;
|
|
143
103
|
}
|
|
144
|
-
|
|
145
|
-
function inlayHint(hint, doc) {
|
|
104
|
+
export function inlayHint(hint, doc) {
|
|
146
105
|
return {
|
|
147
106
|
position: doc.positionAt(hint.offset),
|
|
148
107
|
text: hint.text,
|
|
149
108
|
};
|
|
150
109
|
}
|
|
151
|
-
|
|
152
|
-
function inlayHints(hints, doc) {
|
|
110
|
+
export function inlayHints(hints, doc) {
|
|
153
111
|
return hints.map(h => inlayHint(h, doc));
|
|
154
112
|
}
|
|
155
|
-
|
|
156
|
-
function completionItem(completion, doc, requestedOffset, insertReplaceSupport) {
|
|
113
|
+
export function completionItem(completion, doc, requestedOffset, insertReplaceSupport) {
|
|
157
114
|
const insertText = completion.insertText ?? completion.label;
|
|
158
115
|
const canInsertReplace = insertReplaceSupport && ![core.CR, core.LF, core.CRLF].includes(insertText);
|
|
159
116
|
const textEdit = canInsertReplace
|
|
@@ -169,21 +126,19 @@ function completionItem(completion, doc, requestedOffset, insertReplaceSupport)
|
|
|
169
126
|
filterText: completion.filterText,
|
|
170
127
|
sortText: completion.sortText,
|
|
171
128
|
textEdit,
|
|
172
|
-
insertTextFormat:
|
|
129
|
+
insertTextFormat: InsertTextFormat.Snippet,
|
|
173
130
|
insertTextMode: ls.InsertTextMode.adjustIndentation,
|
|
174
131
|
...completion.deprecated ? { tags: [ls.CompletionItemTag.Deprecated] } : {},
|
|
175
132
|
};
|
|
176
133
|
return ans;
|
|
177
134
|
}
|
|
178
|
-
|
|
179
|
-
function location(location) {
|
|
135
|
+
export function location(location) {
|
|
180
136
|
return {
|
|
181
137
|
uri: location.uri,
|
|
182
138
|
range: location.posRange,
|
|
183
139
|
};
|
|
184
140
|
}
|
|
185
|
-
|
|
186
|
-
function locationLink(locations, doc, linkSupport) {
|
|
141
|
+
export function locationLink(locations, doc, linkSupport) {
|
|
187
142
|
return locations?.locations
|
|
188
143
|
? linkSupport
|
|
189
144
|
? locations.locations.map(loc => ({
|
|
@@ -195,36 +150,30 @@ function locationLink(locations, doc, linkSupport) {
|
|
|
195
150
|
: (locations.locations).map(loc => location({ uri: loc.uri, posRange: loc.posRange ?? ZeroRange }))
|
|
196
151
|
: undefined;
|
|
197
152
|
}
|
|
198
|
-
|
|
199
|
-
function markupContent(value) {
|
|
153
|
+
export function markupContent(value) {
|
|
200
154
|
return {
|
|
201
155
|
kind: ls.MarkupKind.Markdown,
|
|
202
156
|
value: value,
|
|
203
157
|
};
|
|
204
158
|
}
|
|
205
|
-
|
|
206
|
-
function position(offset, doc) {
|
|
159
|
+
export function position(offset, doc) {
|
|
207
160
|
return doc.positionAt(offset);
|
|
208
161
|
}
|
|
209
|
-
|
|
210
|
-
function range(range, doc) {
|
|
162
|
+
export function range(range, doc) {
|
|
211
163
|
return ls.Range.create(position(range.start, doc), position(range.end, doc));
|
|
212
164
|
}
|
|
213
|
-
|
|
214
|
-
function semanticTokenModifier(modifier) {
|
|
165
|
+
export function semanticTokenModifier(modifier) {
|
|
215
166
|
return core.ColorTokenModifiers.indexOf(modifier);
|
|
216
167
|
}
|
|
217
|
-
|
|
218
|
-
function semanticTokenModifiers(modifiers = []) {
|
|
168
|
+
export function semanticTokenModifiers(modifiers = []) {
|
|
219
169
|
let ans = 0;
|
|
220
170
|
for (const modifier of modifiers) {
|
|
221
171
|
ans += 1 << semanticTokenModifier(modifier);
|
|
222
172
|
}
|
|
223
173
|
return ans;
|
|
224
174
|
}
|
|
225
|
-
exports.semanticTokenModifiers = semanticTokenModifiers;
|
|
226
175
|
const MaxCharacterNumber = 2147483647;
|
|
227
|
-
function semanticTokens(tokens, doc, multilineSupport) {
|
|
176
|
+
export function semanticTokens(tokens, doc, multilineSupport) {
|
|
228
177
|
const builder = new ls.SemanticTokensBuilder();
|
|
229
178
|
for (const token of tokens) {
|
|
230
179
|
const pos = position(token.range.start, doc);
|
|
@@ -248,20 +197,17 @@ function semanticTokens(tokens, doc, multilineSupport) {
|
|
|
248
197
|
}
|
|
249
198
|
return builder.build();
|
|
250
199
|
}
|
|
251
|
-
|
|
252
|
-
function semanticTokensLegend() {
|
|
200
|
+
export function semanticTokensLegend() {
|
|
253
201
|
const ans = {
|
|
254
202
|
tokenTypes: core.ColorTokenTypes,
|
|
255
203
|
tokenModifiers: core.ColorTokenModifiers,
|
|
256
204
|
};
|
|
257
205
|
return ans;
|
|
258
206
|
}
|
|
259
|
-
|
|
260
|
-
function semanticTokenType(type) {
|
|
207
|
+
export function semanticTokenType(type) {
|
|
261
208
|
return core.ColorTokenTypes.indexOf(type);
|
|
262
209
|
}
|
|
263
|
-
|
|
264
|
-
function signatureHelp(help) {
|
|
210
|
+
export function signatureHelp(help) {
|
|
265
211
|
if (!help || help.signatures.length === 0) {
|
|
266
212
|
return undefined;
|
|
267
213
|
}
|
|
@@ -271,8 +217,7 @@ function signatureHelp(help) {
|
|
|
271
217
|
activeSignature: help.activeSignature,
|
|
272
218
|
};
|
|
273
219
|
}
|
|
274
|
-
|
|
275
|
-
function signatureInformation(info) {
|
|
220
|
+
export function signatureInformation(info) {
|
|
276
221
|
return {
|
|
277
222
|
label: info.label,
|
|
278
223
|
activeParameter: info.activeParameter,
|
|
@@ -280,37 +225,32 @@ function signatureInformation(info) {
|
|
|
280
225
|
parameters: info.parameters.map(parameterInformation),
|
|
281
226
|
};
|
|
282
227
|
}
|
|
283
|
-
|
|
284
|
-
function parameterInformation(info) {
|
|
228
|
+
export function parameterInformation(info) {
|
|
285
229
|
return {
|
|
286
230
|
label: info.label,
|
|
287
231
|
documentation: info.documentation ? markupContent(info.documentation) : undefined,
|
|
288
232
|
};
|
|
289
233
|
}
|
|
290
|
-
|
|
291
|
-
function symbolInformation(symbol, symLoc, supportedKinds = []) {
|
|
234
|
+
export function symbolInformation(symbol, symLoc, supportedKinds = []) {
|
|
292
235
|
return {
|
|
293
236
|
name: symbol.identifier,
|
|
294
237
|
kind: symbolKind(symbol.category, symbol.subcategory, supportedKinds),
|
|
295
238
|
location: location({ uri: symLoc.uri, posRange: symLoc.fullPosRange ?? symLoc.posRange ?? ZeroRange }),
|
|
296
239
|
};
|
|
297
240
|
}
|
|
298
|
-
|
|
299
|
-
function symbolInformationArray(map = {}, query, supportedKinds = []) {
|
|
241
|
+
export function symbolInformationArray(map = {}, query, supportedKinds = []) {
|
|
300
242
|
return Object.values(map)
|
|
301
243
|
.filter(s => s.identifier.includes(query))
|
|
302
244
|
.map(s => [s, [...s.declaration ?? [], ...s.definition ?? [], ...s.implementation ?? [], ...s.typeDefinition ?? []][0]])
|
|
303
245
|
.filter(([_s, l]) => !!l)
|
|
304
246
|
.map(([s, l]) => symbolInformation(s, l, supportedKinds));
|
|
305
247
|
}
|
|
306
|
-
|
|
307
|
-
function symbolInformationArrayFromTable(table, query, supportedKinds = []) {
|
|
248
|
+
export function symbolInformationArrayFromTable(table, query, supportedKinds = []) {
|
|
308
249
|
return Object.values(table)
|
|
309
250
|
.map(m => symbolInformationArray(m, query, supportedKinds))
|
|
310
251
|
.flat();
|
|
311
252
|
}
|
|
312
|
-
|
|
313
|
-
function symbolKind(category, subcategory = '', supportedKinds = []) {
|
|
253
|
+
export function symbolKind(category, subcategory = '', supportedKinds = []) {
|
|
314
254
|
const UltimateFallback = ls.SymbolKind.Variable;
|
|
315
255
|
const getKind = (kind, fallback) => supportedKinds?.includes(kind) ? kind : fallback;
|
|
316
256
|
if (core.ResourceLocationCategory.is(category)) {
|
|
@@ -336,9 +276,7 @@ function symbolKind(category, subcategory = '', supportedKinds = []) {
|
|
|
336
276
|
]);
|
|
337
277
|
return map.get(category) ?? UltimateFallback;
|
|
338
278
|
}
|
|
339
|
-
|
|
340
|
-
function textEdit(editRange, text, doc) {
|
|
279
|
+
export function textEdit(editRange, text, doc) {
|
|
341
280
|
return ls.TextEdit.replace(range(editRange, doc), text);
|
|
342
281
|
}
|
|
343
|
-
exports.textEdit = textEdit;
|
|
344
282
|
//# sourceMappingURL=toLS.js.map
|
package/lib/util/types.d.ts
CHANGED
package/lib/util/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/language-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"main": "lib/server.js",
|
|
5
6
|
"types": "lib/server.d.ts",
|
|
6
7
|
"author": "SPGoding",
|
|
@@ -20,10 +21,10 @@
|
|
|
20
21
|
"env-paths": "^2.2.1",
|
|
21
22
|
"vscode-languageserver": "^7.0.0",
|
|
22
23
|
"vscode-languageserver-textdocument": "^1.0.1",
|
|
23
|
-
"@spyglassmc/core": "0.
|
|
24
|
-
"@spyglassmc/java-edition": "0.
|
|
25
|
-
"@spyglassmc/locales": "0.
|
|
26
|
-
"@spyglassmc/mcdoc": "0.
|
|
24
|
+
"@spyglassmc/core": "0.3.0",
|
|
25
|
+
"@spyglassmc/java-edition": "0.3.0",
|
|
26
|
+
"@spyglassmc/locales": "0.3.0",
|
|
27
|
+
"@spyglassmc/mcdoc": "0.3.0"
|
|
27
28
|
},
|
|
28
29
|
"publishConfig": {
|
|
29
30
|
"access": "public"
|