astn 0.110.16 → 1.20.5
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/.eslintignore +5 -0
- package/.eslintrc.js +20 -0
- package/.vscode/extensions.json +9 -0
- package/.vscode/launch.json +39 -0
- package/.vscode/settings.json +8 -0
- package/.vscode/tasks.json +33 -0
- package/.vscodeignore +15 -0
- package/LICENSE.md +204 -0
- package/README.md +3 -410
- package/backend/package-lock.json +123 -0
- package/backend/package.json +6 -0
- package/backend/src/index.ts +133 -0
- package/backend/tsconfig.json +16 -0
- package/client/package-lock.json +581 -0
- package/client/package.json +23 -0
- package/client/src/extension.ts +249 -0
- package/client/src/test/completion.test.ts +43 -0
- package/client/src/test/diagnostics.test.ts +41 -0
- package/client/src/test/helper.ts +47 -0
- package/client/src/test/index.ts +43 -0
- package/client/src/test/runTest.ts +27 -0
- package/client/testFixture/diagnostics.txt +1 -0
- package/client/tsconfig.json +12 -0
- package/client/tsconfig.tsbuildinfo +1 -0
- package/development.md +12 -0
- package/images/icon.png +0 -0
- package/language-configuration.json +36 -0
- package/package.json +102 -58
- package/scripts/e2e.sh +6 -0
- package/server/package-lock.json +127 -0
- package/server/package.json +22 -0
- package/server/src/backend.ts +53 -0
- package/server/src/backendapi.ts +66 -0
- package/server/src/server.ts +296 -0
- package/server/tsconfig.json +14 -0
- package/server/tsconfig.tsbuildinfo +1 -0
- package/syntaxes/astn.tmLanguage.json +320 -0
- package/tsconfig.json +21 -0
- package/LICENSE +0 -17
- package/dist/bin/convert_to_json.d.ts +0 -2
- package/dist/bin/convert_to_json.js +0 -63
- package/dist/bin/validate_astn.d.ts +0 -2
- package/dist/bin/validate_astn.js +0 -58
- package/dist/generated/generic/resolve.d.ts +0 -90
- package/dist/generated/generic/resolve.js +0 -259
- package/dist/generated/implementation/schemas/ast/migration_boilerplate.d.ts +0 -14
- package/dist/generated/implementation/schemas/ast/migration_boilerplate.js +0 -179
- package/dist/generated/implementation/schemas/ide/migration_boilerplate.d.ts +0 -2
- package/dist/generated/implementation/schemas/ide/migration_boilerplate.js +0 -56
- package/dist/generated/implementation/schemas/parse_result/migration_boilerplate.d.ts +0 -6
- package/dist/generated/implementation/schemas/parse_result/migration_boilerplate.js +0 -136
- package/dist/generated/implementation/schemas/target/migration_boilerplate.d.ts +0 -3
- package/dist/generated/implementation/schemas/target/migration_boilerplate.js +0 -73
- package/dist/generated/implementation/schemas/target_json/migration_boilerplate.d.ts +0 -3
- package/dist/generated/implementation/schemas/target_json/migration_boilerplate.js +0 -67
- package/dist/generated/interface/core/poormans_parser.d.ts +0 -184
- package/dist/generated/interface/core/poormans_parser.js +0 -3
- package/dist/generated/interface/core/resolved.d.ts +0 -100
- package/dist/generated/interface/core/resolved.js +0 -3
- package/dist/generated/interface/core/unresolved.d.ts +0 -35
- package/dist/generated/interface/core/unresolved.js +0 -3
- package/dist/generated/interface/schemas/ast/migration_boilerplate.d.ts +0 -288
- package/dist/generated/interface/schemas/ast/migration_boilerplate.js +0 -3
- package/dist/generated/interface/schemas/ast/poormans_parser.d.ts +0 -1108
- package/dist/generated/interface/schemas/ast/poormans_parser.js +0 -3
- package/dist/generated/interface/schemas/ast/resolved.d.ts +0 -1108
- package/dist/generated/interface/schemas/ast/resolved.js +0 -3
- package/dist/generated/interface/schemas/ast/unresolved.d.ts +0 -1108
- package/dist/generated/interface/schemas/ast/unresolved.js +0 -3
- package/dist/generated/interface/schemas/ide/migration_boilerplate.d.ts +0 -24
- package/dist/generated/interface/schemas/ide/migration_boilerplate.js +0 -3
- package/dist/generated/interface/schemas/ide/poormans_parser.d.ts +0 -161
- package/dist/generated/interface/schemas/ide/poormans_parser.js +0 -3
- package/dist/generated/interface/schemas/ide/resolved.d.ts +0 -161
- package/dist/generated/interface/schemas/ide/resolved.js +0 -3
- package/dist/generated/interface/schemas/ide/unresolved.d.ts +0 -161
- package/dist/generated/interface/schemas/ide/unresolved.js +0 -3
- package/dist/generated/interface/schemas/parse_result/migration_boilerplate.d.ts +0 -112
- package/dist/generated/interface/schemas/parse_result/migration_boilerplate.js +0 -3
- package/dist/generated/interface/schemas/parse_result/poormans_parser.d.ts +0 -416
- package/dist/generated/interface/schemas/parse_result/poormans_parser.js +0 -3
- package/dist/generated/interface/schemas/parse_result/resolved.d.ts +0 -416
- package/dist/generated/interface/schemas/parse_result/resolved.js +0 -3
- package/dist/generated/interface/schemas/parse_result/unresolved.d.ts +0 -416
- package/dist/generated/interface/schemas/parse_result/unresolved.js +0 -3
- package/dist/generated/interface/schemas/target/migration_boilerplate.d.ts +0 -46
- package/dist/generated/interface/schemas/target/migration_boilerplate.js +0 -3
- package/dist/generated/interface/schemas/target/poormans_parser.d.ts +0 -186
- package/dist/generated/interface/schemas/target/poormans_parser.js +0 -3
- package/dist/generated/interface/schemas/target/resolved.d.ts +0 -186
- package/dist/generated/interface/schemas/target/resolved.js +0 -3
- package/dist/generated/interface/schemas/target/unresolved.d.ts +0 -186
- package/dist/generated/interface/schemas/target/unresolved.js +0 -3
- package/dist/generated/interface/schemas/target_json/migration_boilerplate.d.ts +0 -46
- package/dist/generated/interface/schemas/target_json/migration_boilerplate.js +0 -3
- package/dist/generated/interface/schemas/target_json/poormans_parser.d.ts +0 -169
- package/dist/generated/interface/schemas/target_json/poormans_parser.js +0 -3
- package/dist/generated/interface/schemas/target_json/resolved.d.ts +0 -169
- package/dist/generated/interface/schemas/target_json/resolved.js +0 -3
- package/dist/generated/interface/schemas/target_json/unresolved.d.ts +0 -169
- package/dist/generated/interface/schemas/target_json/unresolved.js +0 -3
- package/dist/globals.d.ts +0 -24
- package/dist/globals.js +0 -2
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -43
- package/dist/lib/globals.d.ts +0 -24
- package/dist/lib/globals.js +0 -2
- package/dist/lib/transformations/create_error_message.d.ts +0 -5
- package/dist/lib/transformations/create_error_message.js +0 -89
- package/dist/lib/transformations/format.d.ts +0 -42
- package/dist/lib/transformations/format.js +0 -166
- package/dist/lib/transformations/fountain_pen/astn.d.ts +0 -11
- package/dist/lib/transformations/fountain_pen/astn.js +0 -156
- package/dist/lib/transformations/fountain_pen/json.d.ts +0 -4
- package/dist/lib/transformations/fountain_pen/json.js +0 -113
- package/dist/lib/transformations/parse.d.ts +0 -11
- package/dist/lib/transformations/parse.js +0 -257
- package/dist/lib/transformations/parse_generic.d.ts +0 -43
- package/dist/lib/transformations/parse_generic.js +0 -644
- package/dist/parse/parse.d.ts +0 -11
- package/dist/parse/parse.js +0 -267
- package/dist/parse/parse_generic.d.ts +0 -43
- package/dist/parse/parse_generic.js +0 -656
- package/dist/serializers/astn.js +0 -28
- package/dist/serializers/json.d.ts +0 -5
- package/dist/serializers/json.js +0 -46
- package/dist/serializers/parse_result.d.ts +0 -5
- package/dist/serializers/parse_result.js +0 -99
- package/dist/transformations/ast/ide.d.ts +0 -42
- package/dist/transformations/ast/ide.js +0 -176
- package/dist/transformations/ast/json_target.d.ts +0 -6
- package/dist/transformations/ast/json_target.js +0 -88
- package/dist/transformations/create_error_message.d.ts +0 -5
- package/dist/transformations/create_error_message.js +0 -89
- package/dist/transformations/format.d.ts +0 -42
- package/dist/transformations/format.js +0 -166
- package/dist/transformations/fountain_pen/astn.d.ts +0 -11
- package/dist/transformations/fountain_pen/astn.js +0 -166
- package/dist/transformations/fountain_pen/json.d.ts +0 -4
- package/dist/transformations/fountain_pen/json.js +0 -123
- package/dist/transformations/parse.d.ts +0 -11
- package/dist/transformations/parse.js +0 -257
- package/dist/transformations/parse_generic.d.ts +0 -43
- package/dist/transformations/parse_generic.js +0 -644
- package/dist/transformations/target/fountain_pen/astn.d.ts +0 -11
- package/dist/transformations/target/fountain_pen/astn.js +0 -156
- package/dist/transformations/target/fountain_pen/json.d.ts +0 -4
- package/dist/transformations/target/fountain_pen/json.js +0 -113
- package/dist/transformations/target/fountain_pen_block.d.ts +0 -11
- package/dist/transformations/target/fountain_pen_block.js +0 -166
- package/dist/transformations/target_json/fountain_pen_block.d.ts +0 -4
- package/dist/transformations/target_json/fountain_pen_block.js +0 -101
- package/documentation/railroad_diagram/diagram/apostrophed_string.png +0 -0
- package/documentation/railroad_diagram/diagram/astn_document.png +0 -0
- package/documentation/railroad_diagram/diagram/backticked_string.png +0 -0
- package/documentation/railroad_diagram/diagram/comment.png +0 -0
- package/documentation/railroad_diagram/diagram/concise_group.png +0 -0
- package/documentation/railroad_diagram/diagram/content.png +0 -0
- package/documentation/railroad_diagram/diagram/dictionary.png +0 -0
- package/documentation/railroad_diagram/diagram/elements.png +0 -0
- package/documentation/railroad_diagram/diagram/escaped_character.png +0 -0
- package/documentation/railroad_diagram/diagram/four_hexadecimal_digits.png +0 -0
- package/documentation/railroad_diagram/diagram/header.png +0 -0
- package/documentation/railroad_diagram/diagram/hexadecimal_digit.png +0 -0
- package/documentation/railroad_diagram/diagram/ignorable.png +0 -0
- package/documentation/railroad_diagram/diagram/include.png +0 -0
- package/documentation/railroad_diagram/diagram/key_value_pairs.png +0 -0
- package/documentation/railroad_diagram/diagram/line_comment.png +0 -0
- package/documentation/railroad_diagram/diagram/list.png +0 -0
- package/documentation/railroad_diagram/diagram/newline_character.png +0 -0
- package/documentation/railroad_diagram/diagram/normal_character.png +0 -0
- package/documentation/railroad_diagram/diagram/normal_or_newline_character.png +0 -0
- package/documentation/railroad_diagram/diagram/quoted_string.png +0 -0
- package/documentation/railroad_diagram/diagram/rr-2.5.png +0 -0
- package/documentation/railroad_diagram/diagram/set_optional_value.png +0 -0
- package/documentation/railroad_diagram/diagram/string.png +0 -0
- package/documentation/railroad_diagram/diagram/string_content_character.png +0 -0
- package/documentation/railroad_diagram/diagram/tagged_value.png +0 -0
- package/documentation/railroad_diagram/diagram/traditional_comment.png +0 -0
- package/documentation/railroad_diagram/diagram/undelimited_string.png +0 -0
- package/documentation/railroad_diagram/diagram/value.png +0 -0
- package/documentation/railroad_diagram/diagram/verbose_group.png +0 -0
- package/documentation/railroad_diagram/diagram/whitespace.png +0 -0
- package/documentation/railroad_diagram/index.md +0 -425
- /package/{dist/serializers/astn.d.ts → client/testFixture/completion.txt} +0 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/* --------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
* ------------------------------------------------------------------------------------------ */
|
|
5
|
+
import {
|
|
6
|
+
createConnection,
|
|
7
|
+
TextDocuments,
|
|
8
|
+
Diagnostic,
|
|
9
|
+
DiagnosticSeverity,
|
|
10
|
+
ProposedFeatures,
|
|
11
|
+
InitializeParams,
|
|
12
|
+
DidChangeConfigurationNotification,
|
|
13
|
+
CompletionItem,
|
|
14
|
+
CompletionItemKind,
|
|
15
|
+
TextDocumentPositionParams,
|
|
16
|
+
TextDocumentSyncKind,
|
|
17
|
+
InitializeResult,
|
|
18
|
+
DocumentDiagnosticReportKind,
|
|
19
|
+
Position,
|
|
20
|
+
type DocumentDiagnosticReport,
|
|
21
|
+
} from 'vscode-languageserver/node';
|
|
22
|
+
|
|
23
|
+
import * as vscode_types from 'vscode-languageserver-types';
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
import {
|
|
27
|
+
TextDocument
|
|
28
|
+
} from 'vscode-languageserver-textdocument';
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
import { $ as be } from "./backend"
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
import * as backend from "../../backend/dist"
|
|
35
|
+
|
|
36
|
+
// Create a connection for the server, using Node's IPC as a transport.
|
|
37
|
+
// Also include all preview / proposed LSP features.
|
|
38
|
+
const connection = createConnection(ProposedFeatures.all);
|
|
39
|
+
|
|
40
|
+
// Create a simple text document manager.
|
|
41
|
+
const documents: TextDocuments<TextDocument> = new TextDocuments(TextDocument);
|
|
42
|
+
|
|
43
|
+
let hasConfigurationCapability = false;
|
|
44
|
+
let hasWorkspaceFolderCapability = false;
|
|
45
|
+
let hasDiagnosticRelatedInformationCapability = false;
|
|
46
|
+
|
|
47
|
+
connection.onInitialize((params: InitializeParams) => {
|
|
48
|
+
const capabilities = params.capabilities;
|
|
49
|
+
|
|
50
|
+
// Does the client support the `workspace/configuration` request?
|
|
51
|
+
// If not, we fall back using global settings.
|
|
52
|
+
hasConfigurationCapability = !!(
|
|
53
|
+
capabilities.workspace && !!capabilities.workspace.configuration
|
|
54
|
+
);
|
|
55
|
+
hasWorkspaceFolderCapability = !!(
|
|
56
|
+
capabilities.workspace && !!capabilities.workspace.workspaceFolders
|
|
57
|
+
);
|
|
58
|
+
hasDiagnosticRelatedInformationCapability = !!(
|
|
59
|
+
capabilities.textDocument &&
|
|
60
|
+
capabilities.textDocument.publishDiagnostics &&
|
|
61
|
+
capabilities.textDocument.publishDiagnostics.relatedInformation
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const result: InitializeResult = {
|
|
65
|
+
capabilities: {
|
|
66
|
+
textDocumentSync: TextDocumentSyncKind.Incremental,
|
|
67
|
+
// Tell the client that this server supports code completion.
|
|
68
|
+
completionProvider: {
|
|
69
|
+
resolveProvider: true
|
|
70
|
+
},
|
|
71
|
+
diagnosticProvider: {
|
|
72
|
+
interFileDependencies: false,
|
|
73
|
+
workspaceDiagnostics: false
|
|
74
|
+
},
|
|
75
|
+
hoverProvider: true,
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
if (hasWorkspaceFolderCapability) {
|
|
79
|
+
result.capabilities.workspace = {
|
|
80
|
+
workspaceFolders: {
|
|
81
|
+
supported: true
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return result;
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
connection.onInitialized(() => {
|
|
89
|
+
if (hasConfigurationCapability) {
|
|
90
|
+
// Register for all configuration changes.
|
|
91
|
+
connection.client.register(DidChangeConfigurationNotification.type, undefined);
|
|
92
|
+
}
|
|
93
|
+
if (hasWorkspaceFolderCapability) {
|
|
94
|
+
connection.workspace.onDidChangeWorkspaceFolders(_event => {
|
|
95
|
+
connection.console.log('Workspace folder change event received.');
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// The example settings
|
|
101
|
+
interface ExampleSettings {
|
|
102
|
+
maxNumberOfProblems: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// The global settings, used when the `workspace/configuration` request is not supported by the client.
|
|
106
|
+
// Please note that this is not the case when using this server with the client provided in this example
|
|
107
|
+
// but could happen with other clients.
|
|
108
|
+
const defaultSettings: ExampleSettings = { maxNumberOfProblems: 1000 };
|
|
109
|
+
let globalSettings: ExampleSettings = defaultSettings;
|
|
110
|
+
|
|
111
|
+
// Cache the settings of all open documents
|
|
112
|
+
const documentSettings: Map<string, Thenable<ExampleSettings>> = new Map();
|
|
113
|
+
|
|
114
|
+
connection.onDidChangeConfiguration(change => {
|
|
115
|
+
if (hasConfigurationCapability) {
|
|
116
|
+
// Reset all cached document settings
|
|
117
|
+
documentSettings.clear();
|
|
118
|
+
} else {
|
|
119
|
+
globalSettings = <ExampleSettings>(
|
|
120
|
+
(change.settings.languageServerExample || defaultSettings)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
// Refresh the diagnostics since the `maxNumberOfProblems` could have changed.
|
|
124
|
+
// We could optimize things here and re-fetch the setting first can compare it
|
|
125
|
+
// to the existing setting, but this is out of scope for this example.
|
|
126
|
+
connection.languages.diagnostics.refresh();
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
function getDocumentSettings(resource: string): Thenable<ExampleSettings> {
|
|
130
|
+
if (!hasConfigurationCapability) {
|
|
131
|
+
return Promise.resolve(globalSettings);
|
|
132
|
+
}
|
|
133
|
+
let result = documentSettings.get(resource);
|
|
134
|
+
if (!result) {
|
|
135
|
+
result = connection.workspace.getConfiguration({
|
|
136
|
+
scopeUri: resource,
|
|
137
|
+
section: 'languageServerExample'
|
|
138
|
+
});
|
|
139
|
+
documentSettings.set(resource, result);
|
|
140
|
+
}
|
|
141
|
+
return result;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Only keep settings for open documents
|
|
145
|
+
documents.onDidClose(e => {
|
|
146
|
+
documentSettings.delete(e.document.uri);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
connection.languages.diagnostics.on(async (params) => {
|
|
151
|
+
const document = documents.get(params.textDocument.uri);
|
|
152
|
+
if (document !== undefined) {
|
|
153
|
+
return {
|
|
154
|
+
kind: DocumentDiagnosticReportKind.Full,
|
|
155
|
+
items: await validateTextDocument(document)
|
|
156
|
+
} satisfies DocumentDiagnosticReport;
|
|
157
|
+
} else {
|
|
158
|
+
// We don't know the document. We can either try to read it from disk
|
|
159
|
+
// or we don't report problems for it.
|
|
160
|
+
return {
|
|
161
|
+
kind: DocumentDiagnosticReportKind.Full,
|
|
162
|
+
items: []
|
|
163
|
+
} satisfies DocumentDiagnosticReport;
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
// The content of a text document has changed. This event is emitted
|
|
168
|
+
// when the text document first opened or when its content has changed.
|
|
169
|
+
documents.onDidChangeContent(change => {
|
|
170
|
+
validateTextDocument(change.document);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// const create_vscode_position = (position: backend.Relative_Location): vscode_types.Position => {
|
|
174
|
+
// return new Position(position.line, position.column);
|
|
175
|
+
// }
|
|
176
|
+
|
|
177
|
+
const create_vscode_range = (backend_range: backend.Range): vscode_types.Range => {
|
|
178
|
+
return vscode_types.Range.create(
|
|
179
|
+
backend_range.start.relative.line,
|
|
180
|
+
backend_range.start.relative.column,
|
|
181
|
+
backend_range.end.relative.line,
|
|
182
|
+
backend_range.end.relative.column
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
async function validateTextDocument(textDocument: TextDocument): Promise<Diagnostic[]> {
|
|
187
|
+
// In this simple example we get the settings for every validate run.
|
|
188
|
+
return new Promise<Diagnostic[]>((resolve, reject) => {
|
|
189
|
+
|
|
190
|
+
be.validateTextDocument(
|
|
191
|
+
{
|
|
192
|
+
uri: textDocument.uri,
|
|
193
|
+
content: textDocument.getText(),
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
'tab size': 1 // vscode works with character, not with columns
|
|
197
|
+
},
|
|
198
|
+
($) => {
|
|
199
|
+
resolve($.diagnostics.map(($) => ({
|
|
200
|
+
severity: (() => {
|
|
201
|
+
switch ($.severity[0]) {
|
|
202
|
+
case "error": return DiagnosticSeverity.Error
|
|
203
|
+
case "warning": return DiagnosticSeverity.Warning
|
|
204
|
+
case "information": return DiagnosticSeverity.Information
|
|
205
|
+
case "hint": return DiagnosticSeverity.Hint
|
|
206
|
+
}
|
|
207
|
+
})(),
|
|
208
|
+
message: $.message,
|
|
209
|
+
range: create_vscode_range($.range),
|
|
210
|
+
})))
|
|
211
|
+
|
|
212
|
+
}
|
|
213
|
+
)
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
connection.onDidChangeWatchedFiles(_change => {
|
|
218
|
+
// Monitored files have change in VSCode
|
|
219
|
+
connection.console.log('We received a file change event');
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// This handler provides the initial list of the completion items.
|
|
223
|
+
connection.onCompletion(
|
|
224
|
+
(_textDocumentPosition: TextDocumentPositionParams): CompletionItem[] => {
|
|
225
|
+
// The pass parameter contains the position of the text document in
|
|
226
|
+
// which code complete got requested. For the example we ignore this
|
|
227
|
+
// info and always provide the same completion items.
|
|
228
|
+
return [
|
|
229
|
+
{
|
|
230
|
+
label: 'TypeScript',
|
|
231
|
+
kind: CompletionItemKind.Text,
|
|
232
|
+
data: 1
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: 'JavaScript',
|
|
236
|
+
kind: CompletionItemKind.Text,
|
|
237
|
+
data: 2
|
|
238
|
+
}
|
|
239
|
+
];
|
|
240
|
+
}
|
|
241
|
+
);
|
|
242
|
+
|
|
243
|
+
// This handler resolves additional information for the item selected in
|
|
244
|
+
// the completion list.
|
|
245
|
+
connection.onCompletionResolve(
|
|
246
|
+
(item: CompletionItem): CompletionItem => {
|
|
247
|
+
if (item.data === 1) {
|
|
248
|
+
item.detail = 'TypeScript details';
|
|
249
|
+
item.documentation = 'TypeScript documentation';
|
|
250
|
+
} else if (item.data === 2) {
|
|
251
|
+
item.detail = 'JavaScript details';
|
|
252
|
+
item.documentation = 'JavaScript documentation';
|
|
253
|
+
}
|
|
254
|
+
return item;
|
|
255
|
+
}
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
connection.onHover(
|
|
259
|
+
(hoverParams, cancellationToken, workdoneProgress, resultProgress) => {
|
|
260
|
+
// The pass parameter contains the position of the text document in
|
|
261
|
+
// which code complete got requested.
|
|
262
|
+
|
|
263
|
+
const doc = documents.get(hoverParams.textDocument.uri)
|
|
264
|
+
if (doc === undefined) {
|
|
265
|
+
return null
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return new Promise(
|
|
269
|
+
(resolve) => {
|
|
270
|
+
be.onHover(
|
|
271
|
+
{
|
|
272
|
+
document: {
|
|
273
|
+
uri: hoverParams.textDocument.uri,
|
|
274
|
+
content: doc.getText(),
|
|
275
|
+
},
|
|
276
|
+
offset: doc.offsetAt(Position.create(hoverParams.position.line, hoverParams.position.character,)),
|
|
277
|
+
|
|
278
|
+
},
|
|
279
|
+
($) => {
|
|
280
|
+
resolve({
|
|
281
|
+
contents: $.hovertexts
|
|
282
|
+
})
|
|
283
|
+
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
)
|
|
288
|
+
}
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
// Make the text document manager listen on the connection
|
|
292
|
+
// for open, change and close text document events
|
|
293
|
+
documents.listen(connection);
|
|
294
|
+
|
|
295
|
+
// Listen on the connection
|
|
296
|
+
connection.listen();
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2020",
|
|
4
|
+
"lib": ["es2020"],
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"sourceMap": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"outDir": "out",
|
|
10
|
+
"rootDir": "src"
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"],
|
|
13
|
+
"exclude": ["node_modules", ".vscode-test"]
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"root":["./src/backend.ts","./src/backendapi.ts","./src/server.ts"],"errors":true,"version":"5.6.3"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "astn",
|
|
3
|
+
"scopeName": "source.astn",
|
|
4
|
+
"patterns": [
|
|
5
|
+
{
|
|
6
|
+
"match": "!",
|
|
7
|
+
"name": "punctuation.definition.header.astn support.type.singular_structural_token.astn"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"include": "#comment_or_value"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"match": "[^\\s\\}]",
|
|
14
|
+
"name": "invalid.illegal.unexpected-root-token.astn"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"repository": {
|
|
18
|
+
"comment_or_value": {
|
|
19
|
+
"patterns": [
|
|
20
|
+
{
|
|
21
|
+
"include": "#comment"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"include": "#value"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"comment": {
|
|
29
|
+
"patterns": [
|
|
30
|
+
{
|
|
31
|
+
"begin": "/\\*\\*(?!/)",
|
|
32
|
+
"captures": {
|
|
33
|
+
"0": {
|
|
34
|
+
"name": "punctuation.definition.comment.astn"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"end": "\\*/",
|
|
38
|
+
"name": "comment.block.documentation.astn"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"begin": "/\\*",
|
|
42
|
+
"captures": {
|
|
43
|
+
"0": {
|
|
44
|
+
"name": "punctuation.definition.comment.astn"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"end": "\\*/",
|
|
48
|
+
"name": "comment.block.astn"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"captures": {
|
|
52
|
+
"1": {
|
|
53
|
+
"name": "punctuation.definition.comment.astn"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"match": "(//).*$\\n?",
|
|
57
|
+
"name": "comment.line.double-slash.js"
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
},
|
|
61
|
+
"value": {
|
|
62
|
+
"patterns": [
|
|
63
|
+
{
|
|
64
|
+
"include": "#concise_group"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"include": "#dictionary"
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"include": "#list"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"include": "#verbose_group"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"match": "\\|",
|
|
77
|
+
"name": "punctuation.separator.tagged_value.astn support.type.singular_structural_token.astn"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"match": "\\@",
|
|
81
|
+
"name": "punctuation.separator.include.ast support.type.singular_structural_token.astn"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"match": "\\~",
|
|
85
|
+
"name": "punctuation.separator.no_value.astn support.type.singular_structural_token.astn"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"match": "\\*",
|
|
89
|
+
"name": "punctuation.separator.set_value.astn support.type.singular_structural_token.astn"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"include": "#string"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"concise_group": {
|
|
97
|
+
"begin": "\\<",
|
|
98
|
+
"beginCaptures": {
|
|
99
|
+
"0": {
|
|
100
|
+
"name": "punctuation.definition.concise_group.begin.astn"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"end": "\\>",
|
|
104
|
+
"endCaptures": {
|
|
105
|
+
"0": {
|
|
106
|
+
"name": "punctuation.definition.concise_group.end.astn"
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"name": "meta.structure.concise_group.astn",
|
|
110
|
+
"patterns": [
|
|
111
|
+
{
|
|
112
|
+
"include": "#comment_or_value"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"match": ",",
|
|
116
|
+
"name": "punctuation.separator.comma.concise_group.astn"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"match": "[^\\s\\]]",
|
|
120
|
+
"name": "invalid.illegal.expected-concise_group-separator-or-end.astn"
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
},
|
|
124
|
+
"dictionary": {
|
|
125
|
+
"begin": "\\{",
|
|
126
|
+
"beginCaptures": {
|
|
127
|
+
"0": {
|
|
128
|
+
"name": "punctuation.definition.dictionary.begin.astn"
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"end": "\\}",
|
|
132
|
+
"endCaptures": {
|
|
133
|
+
"0": {
|
|
134
|
+
"name": "punctuation.definition.dictionary.end.astn"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"name": "meta.structure.dictionary.astn",
|
|
138
|
+
"patterns": [
|
|
139
|
+
{
|
|
140
|
+
"include": "#comment_or_value"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"match": ",",
|
|
144
|
+
"name": "punctuation.separator.comma.dictionary.astn"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"match": ":",
|
|
148
|
+
"name": "punctuation.separator.colon.dictionary.astn"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"match": "[^\\s\\}]",
|
|
152
|
+
"name": "invalid.illegal.expected-dictionary-separator-or-end.astn"
|
|
153
|
+
}
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"string": {
|
|
157
|
+
"patterns": [
|
|
158
|
+
{
|
|
159
|
+
"include": "#quoted_string"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"include": "#backticked_string"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"include": "#apostrophed_string"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"include": "#undelimited_string"
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"list": {
|
|
173
|
+
"begin": "\\[",
|
|
174
|
+
"beginCaptures": {
|
|
175
|
+
"0": {
|
|
176
|
+
"name": "punctuation.definition.list.begin.astn"
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
"end": "\\]",
|
|
180
|
+
"endCaptures": {
|
|
181
|
+
"0": {
|
|
182
|
+
"name": "punctuation.definition.list.end.astn"
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"name": "meta.structure.list.astn",
|
|
186
|
+
"patterns": [
|
|
187
|
+
{
|
|
188
|
+
"include": "#comment_or_value"
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"match": ",",
|
|
192
|
+
"name": "punctuation.separator.comma.list.astn"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"match": "[^\\s\\]]",
|
|
196
|
+
"name": "invalid.illegal.expected-list-separator-or-end.astn"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
"verbose_group": {
|
|
201
|
+
"begin": "\\(",
|
|
202
|
+
"beginCaptures": {
|
|
203
|
+
"0": {
|
|
204
|
+
"name": "punctuation.definition.verbose_group.begin.astn"
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"end": "\\)",
|
|
208
|
+
"endCaptures": {
|
|
209
|
+
"0": {
|
|
210
|
+
"name": "punctuation.definition.verbose_group.end.astn"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"name": "meta.structure.type.astn",
|
|
214
|
+
"patterns": [
|
|
215
|
+
{
|
|
216
|
+
"include": "#comment_or_value"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"match": ",",
|
|
220
|
+
"name": "punctuation.separator.comma.verbose_group.astn"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"match": ":",
|
|
224
|
+
"name": "punctuation.separator.colon.verbose_group.astn"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"match": "[^\\s\\}]",
|
|
228
|
+
"name": "invalid.illegal.expected-verbose_group-separator-or-end.astn"
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"quoted_string": {
|
|
233
|
+
"begin": "\"",
|
|
234
|
+
"beginCaptures": {
|
|
235
|
+
"0": {
|
|
236
|
+
"name": "punctuation.definition.string.quote.begin.astn"
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
"end": "\"",
|
|
240
|
+
"endCaptures": {
|
|
241
|
+
"0": {
|
|
242
|
+
"name": "punctuation.definition.string.quote.end.astn"
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"name": "string.quoted.double.astn",
|
|
246
|
+
"patterns": [
|
|
247
|
+
{
|
|
248
|
+
"match": "[^\"\\\\]+",
|
|
249
|
+
"name": "string.unescaped.content"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"match": "\\\\.",
|
|
253
|
+
"name": "constant.character.escape"
|
|
254
|
+
}
|
|
255
|
+
]
|
|
256
|
+
},
|
|
257
|
+
"apostrophed_string": {
|
|
258
|
+
"begin": "'",
|
|
259
|
+
"beginCaptures": {
|
|
260
|
+
"0": {
|
|
261
|
+
"name": "punctuation.support.type.apostrophed_string.astn"
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"end": "'",
|
|
265
|
+
"endCaptures": {
|
|
266
|
+
"0": {
|
|
267
|
+
"name": "punctuation.support.type.apostrophed_string.astn"
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
"name": "string.astn support.type.apostrophed_string.astn",
|
|
271
|
+
"patterns": [
|
|
272
|
+
{
|
|
273
|
+
"match": "[^'\\\\]+",
|
|
274
|
+
"name": "string.unescaped.content support.type.apostrophed_string.astn"
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"match": "\\\\.",
|
|
278
|
+
"name": "constant.character.escape support.type.apostrophed_string.astn"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"match": "\\n",
|
|
282
|
+
"name": "invalid.illegal.newline_in_apostrophed_string.astn"
|
|
283
|
+
}
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
"backticked_string": {
|
|
287
|
+
"begin": "`",
|
|
288
|
+
"beginCaptures": {
|
|
289
|
+
"0": {
|
|
290
|
+
"name": "punctuation.support.type.backticked_string.astn"
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"end": "`",
|
|
294
|
+
"endCaptures": {
|
|
295
|
+
"0": {
|
|
296
|
+
"name": "punctuation.support.type.backticked_string.astn"
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
"name": "string.astn support.type.backticked_string.astn",
|
|
300
|
+
"patterns": [
|
|
301
|
+
{
|
|
302
|
+
"match": "[^`\\\\]+",
|
|
303
|
+
"name": "string.unescaped.content support.type.backticked_string.astn"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"match": "\\\\.",
|
|
307
|
+
"name": "constant.character.escape support.type.backticked_string.astn"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"match": "\\n",
|
|
311
|
+
"name": "invalid.illegal.newline_in_backticked_string.astn"
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
"undelimited_string": {
|
|
316
|
+
"match": "[^\\s\\[\\]\\{\\}\\(\\)\\<\\>\\|\\@\\~\\*\"'`]+",
|
|
317
|
+
"name": "string.unquoted.astn support.type.undelimited_string.astn"
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"target": "es2020",
|
|
5
|
+
"lib": ["es2020"],
|
|
6
|
+
"outDir": "out",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"sourceMap": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"src"
|
|
12
|
+
],
|
|
13
|
+
"exclude": [
|
|
14
|
+
"node_modules",
|
|
15
|
+
".vscode-test"
|
|
16
|
+
],
|
|
17
|
+
"references": [
|
|
18
|
+
{ "path": "./client" },
|
|
19
|
+
{ "path": "./server" }
|
|
20
|
+
]
|
|
21
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
Copyright (c) 2025 Corno
|
|
6
|
-
|
|
7
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
-
you may not use this file except in compliance with the License.
|
|
9
|
-
You may obtain a copy of the License at
|
|
10
|
-
|
|
11
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
-
|
|
13
|
-
Unless required by applicable law or agreed to in writing, software
|
|
14
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
-
See the License for the specific language governing permissions and
|
|
17
|
-
limitations under the License.
|