@dancrumb/cant-lsp 0.0.0-stage → 0.10.1
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/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +66 -0
- package/dist/server.js.map +1 -0
- package/dist/workspace.d.ts +51 -0
- package/dist/workspace.d.ts.map +1 -0
- package/dist/workspace.js +414 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +45 -3
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpD,YAAY,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":""}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createConnection, DidChangeWatchedFilesNotification, ProposedFeatures, TextDocuments, TextDocumentSyncKind, } from 'vscode-languageserver/node';
|
|
3
|
+
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
4
|
+
import { Workspace } from './workspace.js';
|
|
5
|
+
/** How long to wait after a change before checking again, so that typing isn't checked key by key. */
|
|
6
|
+
const DEBOUNCE_MS = 200;
|
|
7
|
+
const connection = createConnection(ProposedFeatures.all);
|
|
8
|
+
const documents = new TextDocuments(TextDocument);
|
|
9
|
+
const workspace = new Workspace();
|
|
10
|
+
/** The files last published with problems, so that they can be cleared when they have none. */
|
|
11
|
+
let published = new Set();
|
|
12
|
+
let timer;
|
|
13
|
+
const publish = () => {
|
|
14
|
+
const diagnostics = workspace.diagnostics();
|
|
15
|
+
for (const uri of published) {
|
|
16
|
+
if (!diagnostics.has(uri))
|
|
17
|
+
void connection.sendDiagnostics({ uri, diagnostics: [] });
|
|
18
|
+
}
|
|
19
|
+
for (const [uri, list] of diagnostics)
|
|
20
|
+
void connection.sendDiagnostics({ uri, diagnostics: list });
|
|
21
|
+
published = new Set(diagnostics.keys());
|
|
22
|
+
};
|
|
23
|
+
const schedule = () => {
|
|
24
|
+
if (timer !== undefined)
|
|
25
|
+
clearTimeout(timer);
|
|
26
|
+
timer = setTimeout(() => {
|
|
27
|
+
timer = undefined;
|
|
28
|
+
publish();
|
|
29
|
+
}, DEBOUNCE_MS);
|
|
30
|
+
};
|
|
31
|
+
connection.onInitialize(() => ({
|
|
32
|
+
capabilities: {
|
|
33
|
+
textDocumentSync: TextDocumentSyncKind.Incremental,
|
|
34
|
+
definitionProvider: true,
|
|
35
|
+
referencesProvider: true,
|
|
36
|
+
hoverProvider: true,
|
|
37
|
+
documentSymbolProvider: true,
|
|
38
|
+
completionProvider: { triggerCharacters: [':'] },
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
connection.onInitialized(() => {
|
|
42
|
+
// Files that open documents import can change on disk, as can cant.json.
|
|
43
|
+
void connection.client.register(DidChangeWatchedFilesNotification.type, {
|
|
44
|
+
watchers: [{ globPattern: '**/*.cant' }, { globPattern: '**/cant.json' }],
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
documents.onDidChangeContent(({ document }) => {
|
|
48
|
+
workspace.set(document.uri, document.getText());
|
|
49
|
+
schedule();
|
|
50
|
+
});
|
|
51
|
+
documents.onDidClose(({ document }) => {
|
|
52
|
+
workspace.close(document.uri);
|
|
53
|
+
schedule();
|
|
54
|
+
});
|
|
55
|
+
connection.onDidChangeWatchedFiles(() => {
|
|
56
|
+
workspace.invalidate();
|
|
57
|
+
schedule();
|
|
58
|
+
});
|
|
59
|
+
connection.onDefinition(({ textDocument, position }) => workspace.definition(textDocument.uri, position) ?? null);
|
|
60
|
+
connection.onReferences(({ textDocument, position, context }) => workspace.references(textDocument.uri, position, context.includeDeclaration));
|
|
61
|
+
connection.onHover(({ textDocument, position }) => workspace.hover(textDocument.uri, position) ?? null);
|
|
62
|
+
connection.onDocumentSymbol(({ textDocument }) => workspace.symbols(textDocument.uri));
|
|
63
|
+
connection.onCompletion(({ textDocument, position }) => workspace.completions(textDocument.uri, position));
|
|
64
|
+
documents.listen(connection);
|
|
65
|
+
connection.listen();
|
|
66
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA,OAAO,EACL,gBAAgB,EAChB,iCAAiC,EACjC,gBAAgB,EAChB,aAAa,EACb,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAErD,sGAAsG;AACtG,MAAM,WAAW,GAAG,GAAG,CAAC;AAExB,MAAM,UAAU,GAAG,gBAAgB,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;AAC1D,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,YAAY,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAElC,+FAA+F;AAC/F,IAAI,SAAS,GAAG,IAAI,GAAG,EAAO,CAAC;AAC/B,IAAI,KAAiC,CAAC;AAEtC,MAAM,OAAO,GAAG,GAAS,EAAE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AE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;AACvF,UAAU,CAAC,YAAY,CAAC,CAAC,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;AAE3G,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAC7B,UAAU,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Host } from '@dancrumb/cant-compiler';
|
|
2
|
+
import type { Position as UnistPosition } from 'unist';
|
|
3
|
+
import { type CompletionItem, type Diagnostic, type DocumentSymbol, type Hover, type Location, type Position, type Range } from 'vscode-languageserver/node';
|
|
4
|
+
/** A file's URI, as the editor names it. */
|
|
5
|
+
export type Uri = string;
|
|
6
|
+
/** A unist position, whose lines and columns are 1-based, as an LSP range, whose are 0-based. */
|
|
7
|
+
export declare const toRange: ({ start, end }: UnistPosition) => Range;
|
|
8
|
+
/**
|
|
9
|
+
* The Cant files a language server knows about: the ones open in the editor, whose text may not
|
|
10
|
+
* be saved yet, and the ones on disk that they import. It checks each open file as the entry of
|
|
11
|
+
* a program, and answers questions about positions in them.
|
|
12
|
+
*/
|
|
13
|
+
export declare class Workspace {
|
|
14
|
+
private readonly documents;
|
|
15
|
+
private readonly programs;
|
|
16
|
+
/** The last version of each module that parsed, for completion while a file has a syntax error. */
|
|
17
|
+
private readonly lastParsed;
|
|
18
|
+
private readonly host;
|
|
19
|
+
constructor(disk?: Host);
|
|
20
|
+
/** Open or change a document. */
|
|
21
|
+
set(uri: Uri, text: string): void;
|
|
22
|
+
/** Close a document: it is read from disk again. */
|
|
23
|
+
close(uri: Uri): void;
|
|
24
|
+
/** Forget what was checked, as when files change on disk. */
|
|
25
|
+
invalidate(): void;
|
|
26
|
+
/** The open documents' URIs. */
|
|
27
|
+
get open(): Uri[];
|
|
28
|
+
private program;
|
|
29
|
+
private module;
|
|
30
|
+
/**
|
|
31
|
+
* The problems in every file the open documents' programs use, by URI. A file is listed, with
|
|
32
|
+
* no problems, when it was checked and is fine, so that earlier problems can be cleared.
|
|
33
|
+
*/
|
|
34
|
+
diagnostics(): Map<Uri, Diagnostic[]>;
|
|
35
|
+
/** The name at a position in a document, and what it means. */
|
|
36
|
+
private meaningAt;
|
|
37
|
+
/** Where the name at a position is declared. */
|
|
38
|
+
definition(uri: Uri, position: Position): Location | undefined;
|
|
39
|
+
/** Everywhere the name at a position is used, in the program of the document it is in. */
|
|
40
|
+
references(uri: Uri, position: Position, includeDeclaration: boolean): Location[];
|
|
41
|
+
/** What the name at a position is: its declaration, as it is written. */
|
|
42
|
+
hover(uri: Uri, position: Position): Hover | undefined;
|
|
43
|
+
/** The outline of a document: its top-level declarations, and their parameters, fields and members. */
|
|
44
|
+
symbols(uri: Uri): DocumentSymbol[];
|
|
45
|
+
/**
|
|
46
|
+
* What can be written at a position: keywords, the top-level names the module can see, and
|
|
47
|
+
* the local names declared before the position in the same declaration.
|
|
48
|
+
*/
|
|
49
|
+
completions(uri: Uri, position: Position): CompletionItem[];
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,KAAK,IAAI,EAIV,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAQ,QAAQ,IAAI,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,4BAA4B,CAAC;AAEpC,4CAA4C;AAC5C,MAAM,MAAM,GAAG,GAAG,MAAM,CA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GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,cAAc,EAAE,CAiD1D;CACF"}
|
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
2
|
+
import { checkProgram, fileSystemHost, MAIN_NAMESPACE, symbolOf, } from '@dancrumb/cant-compiler';
|
|
3
|
+
import { KEYWORDS } from '@dancrumb/cant-shared';
|
|
4
|
+
import { CompletionItemKind, DiagnosticSeverity, MarkupKind, SymbolKind, } from 'vscode-languageserver/node';
|
|
5
|
+
const toPath = (uri) => (uri.startsWith('file:') ? fileURLToPath(uri) : undefined);
|
|
6
|
+
const toUri = (path) => pathToFileURL(path).href;
|
|
7
|
+
/** A unist position, whose lines and columns are 1-based, as an LSP range, whose are 0-based. */
|
|
8
|
+
export const toRange = ({ start, end }) => ({
|
|
9
|
+
start: { line: start.line - 1, character: start.column - 1 },
|
|
10
|
+
end: { line: end.line - 1, character: end.column - 1 },
|
|
11
|
+
});
|
|
12
|
+
/** The offset in `source` of an LSP position. */
|
|
13
|
+
const offsetOf = (source, { line, character }) => {
|
|
14
|
+
let offset = 0;
|
|
15
|
+
for (let current = 0; current < line; current++) {
|
|
16
|
+
const next = source.indexOf('\n', offset);
|
|
17
|
+
if (next === -1)
|
|
18
|
+
return source.length;
|
|
19
|
+
offset = next + 1;
|
|
20
|
+
}
|
|
21
|
+
const lineEnd = source.indexOf('\n', offset);
|
|
22
|
+
return Math.min(offset + character, lineEnd === -1 ? source.length : lineEnd);
|
|
23
|
+
};
|
|
24
|
+
const contains = (position, offset) => position?.start.offset !== undefined && position.end.offset !== undefined && position.start.offset <= offset && offset <= position.end.offset;
|
|
25
|
+
/** Every node of a syntax tree, each with its parent, in source order. */
|
|
26
|
+
function* walk(node, parent) {
|
|
27
|
+
if (typeof node !== 'object' || node === null)
|
|
28
|
+
return;
|
|
29
|
+
if (Array.isArray(node)) {
|
|
30
|
+
for (const child of node)
|
|
31
|
+
yield* walk(child, parent);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const typed = node;
|
|
35
|
+
const isNode = typeof typed.type === 'string';
|
|
36
|
+
if (isNode)
|
|
37
|
+
yield { node: node, parent };
|
|
38
|
+
for (const [key, value] of Object.entries(node)) {
|
|
39
|
+
if (key !== 'position')
|
|
40
|
+
yield* walk(value, isNode ? node : parent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const sameSymbol = (a, b) => a.module === b.module && a.name === b.name && a.kind === b.kind;
|
|
44
|
+
const SYMBOL_KINDS = {
|
|
45
|
+
action: SymbolKind.Function,
|
|
46
|
+
model: SymbolKind.Struct,
|
|
47
|
+
enumDeclaration: SymbolKind.Enum,
|
|
48
|
+
entity: SymbolKind.Class,
|
|
49
|
+
errorDeclaration: SymbolKind.Event,
|
|
50
|
+
const: SymbolKind.Constant,
|
|
51
|
+
trigger: SymbolKind.Event,
|
|
52
|
+
permissions: SymbolKind.Key,
|
|
53
|
+
relation: SymbolKind.Interface,
|
|
54
|
+
namespace: SymbolKind.Namespace,
|
|
55
|
+
import: SymbolKind.Module,
|
|
56
|
+
};
|
|
57
|
+
const describeKind = (symbol) => symbol.kind === 'action' ? 'action' : symbol.kind === 'const' ? 'constant' : (symbol.typeKind ?? 'type');
|
|
58
|
+
/** The most lines of a declaration a hover shows. */
|
|
59
|
+
const HOVER_LINES = 12;
|
|
60
|
+
/**
|
|
61
|
+
* The Cant files a language server knows about: the ones open in the editor, whose text may not
|
|
62
|
+
* be saved yet, and the ones on disk that they import. It checks each open file as the entry of
|
|
63
|
+
* a program, and answers questions about positions in them.
|
|
64
|
+
*/
|
|
65
|
+
export class Workspace {
|
|
66
|
+
documents = new Map();
|
|
67
|
+
programs = new Map();
|
|
68
|
+
/** The last version of each module that parsed, for completion while a file has a syntax error. */
|
|
69
|
+
lastParsed = new Map();
|
|
70
|
+
host;
|
|
71
|
+
constructor(disk = fileSystemHost) {
|
|
72
|
+
this.host = {
|
|
73
|
+
readFile: (path) => this.documents.get(path) ?? disk.readFile(path),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/** Open or change a document. */
|
|
77
|
+
set(uri, text) {
|
|
78
|
+
const path = toPath(uri);
|
|
79
|
+
if (path === undefined)
|
|
80
|
+
return;
|
|
81
|
+
this.documents.set(path, text);
|
|
82
|
+
this.programs.clear();
|
|
83
|
+
}
|
|
84
|
+
/** Close a document: it is read from disk again. */
|
|
85
|
+
close(uri) {
|
|
86
|
+
const path = toPath(uri);
|
|
87
|
+
if (path === undefined)
|
|
88
|
+
return;
|
|
89
|
+
this.documents.delete(path);
|
|
90
|
+
this.programs.clear();
|
|
91
|
+
}
|
|
92
|
+
/** Forget what was checked, as when files change on disk. */
|
|
93
|
+
invalidate() {
|
|
94
|
+
this.programs.clear();
|
|
95
|
+
}
|
|
96
|
+
/** The open documents' URIs. */
|
|
97
|
+
get open() {
|
|
98
|
+
return [...this.documents.keys()].map(toUri);
|
|
99
|
+
}
|
|
100
|
+
program(path) {
|
|
101
|
+
let program = this.programs.get(path);
|
|
102
|
+
if (program === undefined) {
|
|
103
|
+
program = checkProgram(path, this.host);
|
|
104
|
+
this.programs.set(path, program);
|
|
105
|
+
for (const module of program.modules.values())
|
|
106
|
+
if (module.program !== undefined)
|
|
107
|
+
this.lastParsed.set(module.path, module);
|
|
108
|
+
}
|
|
109
|
+
return program;
|
|
110
|
+
}
|
|
111
|
+
module(uri) {
|
|
112
|
+
const path = toPath(uri);
|
|
113
|
+
if (path === undefined)
|
|
114
|
+
return undefined;
|
|
115
|
+
const program = this.program(path);
|
|
116
|
+
const module = program.modules.get(path);
|
|
117
|
+
return module === undefined ? undefined : { program, module };
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The problems in every file the open documents' programs use, by URI. A file is listed, with
|
|
121
|
+
* no problems, when it was checked and is fine, so that earlier problems can be cleared.
|
|
122
|
+
*/
|
|
123
|
+
diagnostics() {
|
|
124
|
+
const byFile = new Map();
|
|
125
|
+
const seen = new Set();
|
|
126
|
+
for (const path of this.documents.keys()) {
|
|
127
|
+
const program = this.program(path);
|
|
128
|
+
for (const module of program.modules.keys())
|
|
129
|
+
if (!byFile.has(module))
|
|
130
|
+
byFile.set(module, []);
|
|
131
|
+
for (const diagnostic of program.diagnostics) {
|
|
132
|
+
const file = diagnostic.file ?? path;
|
|
133
|
+
// A module that several open documents import is reported once.
|
|
134
|
+
const key = `${file}:${String(diagnostic.position.start.offset)}:${diagnostic.code}:${diagnostic.message}`;
|
|
135
|
+
if (seen.has(key))
|
|
136
|
+
continue;
|
|
137
|
+
seen.add(key);
|
|
138
|
+
let list = byFile.get(file);
|
|
139
|
+
if (list === undefined)
|
|
140
|
+
byFile.set(file, (list = []));
|
|
141
|
+
list.push(toDiagnostic(diagnostic));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return new Map([...byFile].map(([path, list]) => [toUri(path), list]));
|
|
145
|
+
}
|
|
146
|
+
/** The name at a position in a document, and what it means. */
|
|
147
|
+
meaningAt(uri, position) {
|
|
148
|
+
const found = this.module(uri);
|
|
149
|
+
if (found?.module.program === undefined)
|
|
150
|
+
return undefined;
|
|
151
|
+
const { module, program } = found;
|
|
152
|
+
const offset = offsetOf(module.source, position);
|
|
153
|
+
let best;
|
|
154
|
+
for (const { node, parent } of walk(module.program)) {
|
|
155
|
+
if ((node.type === 'identifier' || node.type === 'qualifiedIdentifier') && contains(node.position, offset)) {
|
|
156
|
+
// The innermost name wins, except that a part of a qualified name means the whole.
|
|
157
|
+
if (best?.node.type === 'qualifiedIdentifier' && node.type === 'identifier' && parent === best.node)
|
|
158
|
+
continue;
|
|
159
|
+
best = { node: node, parent };
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (best === undefined)
|
|
163
|
+
return undefined;
|
|
164
|
+
return { module, program, name: best, meaning: meaning(module, program, best) };
|
|
165
|
+
}
|
|
166
|
+
/** Where the name at a position is declared. */
|
|
167
|
+
definition(uri, position) {
|
|
168
|
+
const found = this.meaningAt(uri, position);
|
|
169
|
+
if (found?.meaning === undefined)
|
|
170
|
+
return undefined;
|
|
171
|
+
if (found.meaning.kind === 'local')
|
|
172
|
+
return { uri, range: toRange(found.meaning.binding.declaration.position) };
|
|
173
|
+
const { symbol } = found.meaning;
|
|
174
|
+
if (symbol.declaration === undefined)
|
|
175
|
+
return undefined;
|
|
176
|
+
return { uri: toUri(symbol.module), range: toRange(symbol.declaration.name.position) };
|
|
177
|
+
}
|
|
178
|
+
/** Everywhere the name at a position is used, in the program of the document it is in. */
|
|
179
|
+
references(uri, position, includeDeclaration) {
|
|
180
|
+
const found = this.meaningAt(uri, position);
|
|
181
|
+
if (found?.meaning === undefined)
|
|
182
|
+
return [];
|
|
183
|
+
const { meaning, program } = found;
|
|
184
|
+
const locations = [];
|
|
185
|
+
if (meaning.kind === 'local') {
|
|
186
|
+
for (const [identifier, binding] of program.locals) {
|
|
187
|
+
if (binding.declaration !== meaning.binding.declaration)
|
|
188
|
+
continue;
|
|
189
|
+
if (identifier === binding.declaration && !includeDeclaration)
|
|
190
|
+
continue;
|
|
191
|
+
locations.push({ uri, range: toRange(identifier.position) });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
const { symbol } = meaning;
|
|
196
|
+
if (includeDeclaration && symbol.declaration !== undefined) {
|
|
197
|
+
locations.push({ uri: toUri(symbol.module), range: toRange(symbol.declaration.name.position) });
|
|
198
|
+
}
|
|
199
|
+
for (const module of program.modules.values()) {
|
|
200
|
+
for (const { node } of walk(module.program)) {
|
|
201
|
+
if (node.type !== 'identifier' && node.type !== 'qualifiedIdentifier')
|
|
202
|
+
continue;
|
|
203
|
+
const referred = program.references.get(node);
|
|
204
|
+
if (referred !== undefined && sameSymbol(referred, symbol)) {
|
|
205
|
+
locations.push({ uri: toUri(module.path), range: toRange(node.position) });
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return locations.sort((a, b) => a.uri.localeCompare(b.uri) || a.range.start.line - b.range.start.line || a.range.start.character - b.range.start.character);
|
|
211
|
+
}
|
|
212
|
+
/** What the name at a position is: its declaration, as it is written. */
|
|
213
|
+
hover(uri, position) {
|
|
214
|
+
const found = this.meaningAt(uri, position);
|
|
215
|
+
if (found?.meaning === undefined)
|
|
216
|
+
return undefined;
|
|
217
|
+
const { meaning, program, module, name } = found;
|
|
218
|
+
const range = toRange(name.node.position);
|
|
219
|
+
if (meaning.kind === 'local') {
|
|
220
|
+
const declared = declarationOfLocal(module, meaning.binding);
|
|
221
|
+
return markdown(`(${meaning.binding.kind}) ${meaning.binding.declaration.value}`, declared, range);
|
|
222
|
+
}
|
|
223
|
+
const { symbol } = meaning;
|
|
224
|
+
const where = symbol.declaration === undefined ? 'the standard library' : symbol.module === module.path ? undefined : symbol.module;
|
|
225
|
+
const title = `(${describeKind(symbol)}) ${symbol.name}${where === undefined ? '' : ` — from ${where.startsWith('cant::') ? symbol.module : where}`}`;
|
|
226
|
+
if (symbol.declaration === undefined)
|
|
227
|
+
return markdown(title, undefined, range);
|
|
228
|
+
const source = program.modules.get(symbol.module)?.source;
|
|
229
|
+
return markdown(title, source === undefined ? undefined : declarationText(source, symbol.declaration), range);
|
|
230
|
+
}
|
|
231
|
+
/** The outline of a document: its top-level declarations, and their parameters, fields and members. */
|
|
232
|
+
symbols(uri) {
|
|
233
|
+
const found = this.module(uri);
|
|
234
|
+
if (found?.module.program === undefined)
|
|
235
|
+
return [];
|
|
236
|
+
const symbols = [];
|
|
237
|
+
for (const declaration of found.module.program.children) {
|
|
238
|
+
const kind = SYMBOL_KINDS[declaration.type];
|
|
239
|
+
if (kind === undefined)
|
|
240
|
+
continue;
|
|
241
|
+
const range = toRange(declaration.position);
|
|
242
|
+
const symbol = (name, selection, children = []) => ({
|
|
243
|
+
name,
|
|
244
|
+
kind,
|
|
245
|
+
range,
|
|
246
|
+
selectionRange: toRange(selection),
|
|
247
|
+
children,
|
|
248
|
+
});
|
|
249
|
+
const child = (name, childKind, position) => ({
|
|
250
|
+
name: name.value,
|
|
251
|
+
kind: childKind,
|
|
252
|
+
range: toRange(position),
|
|
253
|
+
selectionRange: toRange(name.position),
|
|
254
|
+
});
|
|
255
|
+
switch (declaration.type) {
|
|
256
|
+
case 'action':
|
|
257
|
+
symbols.push(symbol(declaration.name.value, declaration.name.position, declaration.parameters.map((parameter) => child(parameter.name, SymbolKind.Variable, parameter.position))));
|
|
258
|
+
break;
|
|
259
|
+
case 'model':
|
|
260
|
+
symbols.push(symbol(declaration.name.value, declaration.name.position, declaration.fields.map((field) => child(field.name, SymbolKind.Field, field.position))));
|
|
261
|
+
break;
|
|
262
|
+
case 'errorDeclaration':
|
|
263
|
+
symbols.push(symbol(declaration.name.value, declaration.name.position, Array.isArray(declaration.data) ? declaration.data.map((field) => child(field.name, SymbolKind.Field, field.position)) : []));
|
|
264
|
+
break;
|
|
265
|
+
case 'enumDeclaration':
|
|
266
|
+
symbols.push(symbol(declaration.name.value, declaration.name.position, declaration.members.map((member) => child(member.name, SymbolKind.EnumMember, member.position))));
|
|
267
|
+
break;
|
|
268
|
+
case 'entity':
|
|
269
|
+
case 'const':
|
|
270
|
+
case 'namespace':
|
|
271
|
+
symbols.push(symbol(declaration.name.value, declaration.name.position));
|
|
272
|
+
break;
|
|
273
|
+
case 'trigger':
|
|
274
|
+
symbols.push(symbol(`${nameText(declaration.action)} on ${declaration.source.value}`, declaration.action.position));
|
|
275
|
+
break;
|
|
276
|
+
case 'permissions':
|
|
277
|
+
symbols.push(symbol(`permissions ${declaration.group.value}${declaration.role === undefined ? '' : ` has ${declaration.role.value}`}`, declaration.group.position));
|
|
278
|
+
break;
|
|
279
|
+
case 'relation':
|
|
280
|
+
symbols.push(symbol(`${nameText(declaration.left.entity)}[${declaration.left.field.value}] — ${nameText(declaration.right.entity)}[${declaration.right.field.value}]`, declaration.left.entity.position));
|
|
281
|
+
break;
|
|
282
|
+
default:
|
|
283
|
+
break;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return symbols;
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* What can be written at a position: keywords, the top-level names the module can see, and
|
|
290
|
+
* the local names declared before the position in the same declaration.
|
|
291
|
+
*/
|
|
292
|
+
completions(uri, position) {
|
|
293
|
+
const path = toPath(uri);
|
|
294
|
+
if (path === undefined)
|
|
295
|
+
return [];
|
|
296
|
+
const current = this.module(uri)?.module;
|
|
297
|
+
const module = current?.program === undefined ? this.lastParsed.get(path) : current;
|
|
298
|
+
const items = new Map();
|
|
299
|
+
const add = (item) => {
|
|
300
|
+
if (!items.has(item.label))
|
|
301
|
+
items.set(item.label, item);
|
|
302
|
+
};
|
|
303
|
+
for (const keyword of KEYWORDS)
|
|
304
|
+
add({ label: keyword, kind: CompletionItemKind.Keyword });
|
|
305
|
+
if (module === undefined)
|
|
306
|
+
return [...items.values()];
|
|
307
|
+
const prefix = (namespace) => (namespace === MAIN_NAMESPACE ? '' : `${namespace}::`);
|
|
308
|
+
for (const [namespace, declared] of module.symbols?.namespaces ?? []) {
|
|
309
|
+
for (const name of declared.types.keys())
|
|
310
|
+
add({ label: prefix(namespace) + name, kind: CompletionItemKind.Class });
|
|
311
|
+
for (const name of declared.actions.keys())
|
|
312
|
+
add({ label: prefix(namespace) + name, kind: CompletionItemKind.Function });
|
|
313
|
+
for (const name of declared.constants.keys())
|
|
314
|
+
add({ label: prefix(namespace) + name, kind: CompletionItemKind.Constant });
|
|
315
|
+
}
|
|
316
|
+
for (const [namespace, imported] of module.imported) {
|
|
317
|
+
for (const [name, { symbol }] of imported) {
|
|
318
|
+
add({
|
|
319
|
+
label: prefix(namespace) + name,
|
|
320
|
+
kind: symbol.kind === 'action'
|
|
321
|
+
? CompletionItemKind.Function
|
|
322
|
+
: symbol.kind === 'const'
|
|
323
|
+
? CompletionItemKind.Constant
|
|
324
|
+
: CompletionItemKind.Class,
|
|
325
|
+
detail: symbol.module,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
// Locals: only from a module checked as it is now, whose positions match the text.
|
|
330
|
+
const program = current?.program === undefined ? undefined : this.program(path);
|
|
331
|
+
if (program !== undefined && module.program !== undefined) {
|
|
332
|
+
const offset = offsetOf(module.source, position);
|
|
333
|
+
const enclosing = module.program.children.find((declaration) => contains(declaration.position, offset));
|
|
334
|
+
if (enclosing !== undefined) {
|
|
335
|
+
for (const binding of program.locals.values()) {
|
|
336
|
+
const declared = binding.declaration.position;
|
|
337
|
+
if (contains(enclosing.position, declared.start.offset ?? -1) && (declared.end.offset ?? Infinity) <= offset) {
|
|
338
|
+
add({ label: binding.declaration.value, kind: CompletionItemKind.Variable, detail: binding.kind });
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return [...items.values()];
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
const toDiagnostic = (diagnostic) => ({
|
|
347
|
+
range: toRange(diagnostic.position),
|
|
348
|
+
severity: DiagnosticSeverity.Error,
|
|
349
|
+
code: diagnostic.code,
|
|
350
|
+
source: 'cant',
|
|
351
|
+
message: diagnostic.message,
|
|
352
|
+
});
|
|
353
|
+
const nameText = (name) => (name.type === 'qualifiedIdentifier' ? `${name.namespace.value}::${name.name.value}` : name.value);
|
|
354
|
+
/** What a name means: the symbol it refers to, the local it is, or the symbol it declares. */
|
|
355
|
+
function meaning(module, program, { node, parent }) {
|
|
356
|
+
const symbol = program.references.get(node);
|
|
357
|
+
if (symbol !== undefined)
|
|
358
|
+
return { kind: 'symbol', symbol };
|
|
359
|
+
if (node.type === 'identifier') {
|
|
360
|
+
const binding = program.locals.get(node);
|
|
361
|
+
if (binding !== undefined)
|
|
362
|
+
return { kind: 'local', binding };
|
|
363
|
+
}
|
|
364
|
+
// The name a top-level declaration declares.
|
|
365
|
+
const declaration = module.program?.children.find((child) => child === parent);
|
|
366
|
+
switch (declaration?.type) {
|
|
367
|
+
case 'action':
|
|
368
|
+
case 'const':
|
|
369
|
+
case 'model':
|
|
370
|
+
case 'entity':
|
|
371
|
+
case 'enumDeclaration':
|
|
372
|
+
case 'errorDeclaration':
|
|
373
|
+
if (declaration.name === node)
|
|
374
|
+
return { kind: 'symbol', symbol: symbolOf(module.path, declaration) };
|
|
375
|
+
break;
|
|
376
|
+
default:
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
return undefined;
|
|
380
|
+
}
|
|
381
|
+
/** A declaration's text: an action's signature, or the first lines of anything else. */
|
|
382
|
+
function declarationText(source, declaration) {
|
|
383
|
+
const { start, end } = declaration.position ?? {};
|
|
384
|
+
if (start?.offset === undefined || end?.offset === undefined)
|
|
385
|
+
return undefined;
|
|
386
|
+
const lines = source.slice(start.offset, end.offset).split(/\r?\n/);
|
|
387
|
+
if (declaration.type === 'action')
|
|
388
|
+
return lines[0];
|
|
389
|
+
const shown = lines.slice(0, HOVER_LINES);
|
|
390
|
+
if (lines.length > HOVER_LINES)
|
|
391
|
+
shown.push(' …');
|
|
392
|
+
return shown.join('\n');
|
|
393
|
+
}
|
|
394
|
+
/** The line that declares a local: its parameter or field, or the statement that assigns it. */
|
|
395
|
+
function declarationOfLocal(module, binding) {
|
|
396
|
+
for (const { node, parent } of walk(module.program)) {
|
|
397
|
+
if (node !== binding.declaration || parent?.position?.start.offset === undefined)
|
|
398
|
+
continue;
|
|
399
|
+
if (parent.type === 'parameter' || parent.type === 'field') {
|
|
400
|
+
return module.source.slice(parent.position.start.offset, parent.position.end.offset);
|
|
401
|
+
}
|
|
402
|
+
break;
|
|
403
|
+
}
|
|
404
|
+
const line = module.source.split(/\r?\n/)[binding.declaration.position.start.line - 1];
|
|
405
|
+
return line?.trim();
|
|
406
|
+
}
|
|
407
|
+
const markdown = (title, code, range) => ({
|
|
408
|
+
contents: {
|
|
409
|
+
kind: MarkupKind.Markdown,
|
|
410
|
+
value: code === undefined ? title : `${title}\n\n\`\`\`cant\n${code}\n\`\`\``,
|
|
411
|
+
},
|
|
412
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,KAAK,CAAC,MAAM,KAAK,SAAS;YAAE,SAAS;QAC3F,IAAI,MAAM,CAAC,IAAI,KAAK,WAAW,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3D,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACvF,CAAC;QACD,MAAM;IACR,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IACvF,OAAO,IAAI,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAwB,EAAE,KAAY,EAAS,EAAE,CAAC,CAAC;IAClF,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU,CAAC,QAAQ;QACzB,KAAK,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,mBAAmB,IAAI,UAAU;KAC9E;IACD,KAAK;CACN,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dancrumb/cant-lsp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.10.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/dancrumb/cant.git",
|
|
7
|
+
"directory": "packages/lsp"
|
|
8
|
+
},
|
|
9
|
+
"description": "The cant language server",
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./server": "./dist/server.js"
|
|
18
|
+
},
|
|
19
|
+
"bin": {
|
|
20
|
+
"cant-lsp": "./dist/server.js"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"dist",
|
|
24
|
+
"!dist/**/*.test.*"
|
|
25
|
+
],
|
|
26
|
+
"engines": {
|
|
27
|
+
"node": ">=22"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@dancrumb/cant-compiler": "^0.10.1",
|
|
31
|
+
"@dancrumb/cant-shared": "^0.10.1",
|
|
32
|
+
"vscode-languageserver": "^11.0.0",
|
|
33
|
+
"vscode-languageserver-textdocument": "^1.0.16"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/unist": "^3.0.3"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsc",
|
|
43
|
+
"typecheck": "tsc --noEmit",
|
|
44
|
+
"clean": "rm -rf dist",
|
|
45
|
+
"lint": "eslint .",
|
|
46
|
+
"test": "node --test \"dist/**/*.test.js\""
|
|
47
|
+
}
|
|
6
48
|
}
|
package/README.md
DELETED