@coderline/alphatab-monaco 1.9.0-alpha.1785 → 1.9.0-alpha.1891
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/alphaTab.monaco.mjs +14 -14
- package/dist/alphatex.mjs +21 -22
- package/dist/lsp.mjs +177 -221
- package/dist/lspMonacoMappings.mjs +237 -344
- package/dist/textmate.mjs +81 -86
- package/dist/types.mjs +11 -12
- package/dist/types2.mjs +17 -0
- package/dist/worker.mjs +4645 -5121
- package/package.json +10 -11
package/dist/alphaTab.monaco.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export { addTextMateGrammarSupport, registerGrammar }
|
|
2
|
+
* alphaTab Monaco v1.9.0-alpha.1891 (develop, build 1891)
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
8
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
+
*
|
|
10
|
+
* @preserve
|
|
11
|
+
* @license
|
|
12
|
+
*/
|
|
13
|
+
import { addTextMateGrammarSupport, registerGrammar } from "./textmate.mjs";
|
|
14
|
+
import { registerAlphaTexGrammar } from "./alphatex.mjs";
|
|
15
|
+
export { addTextMateGrammarSupport, registerAlphaTexGrammar, registerGrammar };
|
package/dist/alphatex.mjs
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import { languageConfiguration, textMateGrammar } from
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
* alphaTab Monaco v1.9.0-alpha.1891 (develop, build 1891)
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
8
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
+
*
|
|
10
|
+
* @preserve
|
|
11
|
+
* @license
|
|
12
|
+
*/
|
|
13
|
+
import { registerGrammar } from "./textmate.mjs";
|
|
14
|
+
import { languageConfiguration, textMateGrammar } from "@coderline/alphatab-language-server";
|
|
15
|
+
//#region src/alphatex.ts
|
|
17
16
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
* Registers alphaTex as language in the provided grammar support context.
|
|
18
|
+
* @param grammarSupport The context for handling grammar support in Monaco.
|
|
19
|
+
*/
|
|
21
20
|
async function registerAlphaTexGrammar(grammarSupport) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
return registerGrammar(grammarSupport, "alphatex", async () => {
|
|
22
|
+
return JSON.stringify(textMateGrammar);
|
|
23
|
+
}, async () => languageConfiguration);
|
|
25
24
|
}
|
|
26
|
-
|
|
25
|
+
//#endregion
|
|
27
26
|
export { registerAlphaTexGrammar };
|
package/dist/lsp.mjs
CHANGED
|
@@ -1,234 +1,190 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
* alphaTab Monaco v1.9.0-alpha.1891 (develop, build 1891)
|
|
3
|
+
*
|
|
4
|
+
* Copyright © 2026, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
|
+
*
|
|
6
|
+
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
7
|
+
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
8
|
+
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
9
|
+
*
|
|
10
|
+
* @preserve
|
|
11
|
+
* @license
|
|
12
|
+
*/
|
|
13
|
+
import { lspToMonacoCompletionItem, lspToMonacoHover, lspToMonacoMarker, lspToMonacoSignatureHelp, monacoToLspCompletionItem, monacoToLspCompletionTriggerKind, monacoToLspContentChange, monacoToLspSignatureHelp, monacoToLspSignatureHelpTriggerKind } from "./lspMonacoMappings.mjs";
|
|
14
|
+
import * as monaco from "monaco-editor";
|
|
15
|
+
import { CompletionRequest, CompletionResolveRequest, DidChangeTextDocumentNotification, DidOpenTextDocumentNotification, DocumentDiagnosticRequest, HoverRequest, InitializeRequest, PositionEncodingKind, SignatureHelpRequest } from "vscode-languageserver-protocol";
|
|
16
|
+
import { BrowserMessageReader, BrowserMessageWriter, createProtocolConnection } from "vscode-languageserver-protocol/browser";
|
|
17
|
+
//#region src/lsp.ts
|
|
19
18
|
/**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
19
|
+
* Enables a basic Language Server integration for the given editor covering:
|
|
20
|
+
* * A single document backend (no workspace integration with file open,close, rename etc.)
|
|
21
|
+
* * Diagnostics Provider (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_pullDiagnostics)
|
|
22
|
+
* * Completions (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_completion)
|
|
23
|
+
* * Hover (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_hover)
|
|
24
|
+
* * Signature Help (https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_signatureHelp)
|
|
25
|
+
*
|
|
26
|
+
* This feature set is mainly aligned with the capabilities of the alphaTab language server.
|
|
27
|
+
*
|
|
28
|
+
* @param editor The editor to integrate with.
|
|
29
|
+
* @param languageServerWorker The web worker with a language server listening for messages.
|
|
30
|
+
*/
|
|
32
31
|
async function basicEditorLspIntegration(editor, languageServerWorker, info) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
languageId: info.languageId,
|
|
98
|
-
text: model.getValue(),
|
|
99
|
-
uri: documentUri,
|
|
100
|
-
version: model.getVersionId()
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
setupDocumentHandlingAndDiagnostics(editor, documentUri, connection);
|
|
104
|
-
setupCompletion(documentUri, info.languageId, connection, initResponse);
|
|
105
|
-
setupHover(documentUri, info.languageId, connection, initResponse);
|
|
106
|
-
setupSignatureHelp(documentUri, info.languageId, connection, initResponse);
|
|
32
|
+
const reader = new BrowserMessageReader(languageServerWorker);
|
|
33
|
+
const writer = new BrowserMessageWriter(languageServerWorker);
|
|
34
|
+
const connection = createProtocolConnection(reader, writer, info.logger);
|
|
35
|
+
connection.onError((data) => {
|
|
36
|
+
info.logger?.error(`Error on protocol connection: ${data}`);
|
|
37
|
+
});
|
|
38
|
+
connection.onClose(() => {
|
|
39
|
+
info.logger?.log(`Language Server connection closed`);
|
|
40
|
+
});
|
|
41
|
+
const initRequest = {
|
|
42
|
+
processId: null,
|
|
43
|
+
clientInfo: info.clientInfo,
|
|
44
|
+
rootUri: null,
|
|
45
|
+
capabilities: {
|
|
46
|
+
general: {
|
|
47
|
+
staleRequestSupport: {
|
|
48
|
+
cancel: true,
|
|
49
|
+
retryOnContentModified: []
|
|
50
|
+
},
|
|
51
|
+
regularExpressions: {
|
|
52
|
+
engine: "ECMAScript",
|
|
53
|
+
version: "ES2020"
|
|
54
|
+
},
|
|
55
|
+
markdown: {
|
|
56
|
+
parser: "marked",
|
|
57
|
+
version: "1.1.0"
|
|
58
|
+
},
|
|
59
|
+
positionEncodings: [PositionEncodingKind.UTF16]
|
|
60
|
+
},
|
|
61
|
+
textDocument: {
|
|
62
|
+
completion: { completionItem: {
|
|
63
|
+
snippetSupport: true,
|
|
64
|
+
documentationFormat: ["markdown", "plaintext"],
|
|
65
|
+
insertReplaceSupport: true,
|
|
66
|
+
labelDetailsSupport: true
|
|
67
|
+
} },
|
|
68
|
+
hover: { contentFormat: ["markdown", "plaintext"] },
|
|
69
|
+
signatureHelp: { signatureInformation: {
|
|
70
|
+
documentationFormat: ["markdown", "plaintext"],
|
|
71
|
+
parameterInformation: { labelOffsetSupport: true },
|
|
72
|
+
activeParameterSupport: true
|
|
73
|
+
} },
|
|
74
|
+
diagnostic: {}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
info.logger?.log(`Begin listen on connection`);
|
|
79
|
+
connection.listen();
|
|
80
|
+
info.logger?.log(`Listening now on connection`);
|
|
81
|
+
info.logger?.log(`Begin Language Server initialization`);
|
|
82
|
+
const initResponse = await connection.sendRequest(InitializeRequest.type, initRequest);
|
|
83
|
+
info.logger?.log(`Finished Language Server initialization`);
|
|
84
|
+
const documentUri = "monaco://standalone.document";
|
|
85
|
+
const model = editor.getModel();
|
|
86
|
+
await connection.sendNotification(DidOpenTextDocumentNotification.type, { textDocument: {
|
|
87
|
+
languageId: info.languageId,
|
|
88
|
+
text: model.getValue(),
|
|
89
|
+
uri: documentUri,
|
|
90
|
+
version: model.getVersionId()
|
|
91
|
+
} });
|
|
92
|
+
setupDocumentHandlingAndDiagnostics(editor, documentUri, connection);
|
|
93
|
+
setupCompletion(documentUri, info.languageId, connection, initResponse);
|
|
94
|
+
setupHover(documentUri, info.languageId, connection, initResponse);
|
|
95
|
+
setupSignatureHelp(documentUri, info.languageId, connection, initResponse);
|
|
107
96
|
}
|
|
108
97
|
function setupDocumentHandlingAndDiagnostics(editor, documentUri, connection) {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
version: e.versionId
|
|
127
|
-
},
|
|
128
|
-
contentChanges: e.changes.map(monacoToLspContentChange)
|
|
129
|
-
});
|
|
130
|
-
await updateDiagnostics();
|
|
131
|
-
});
|
|
98
|
+
async function updateDiagnostics() {
|
|
99
|
+
const params = { textDocument: { uri: documentUri } };
|
|
100
|
+
const result = await connection.sendRequest(DocumentDiagnosticRequest.type, params);
|
|
101
|
+
if (result.kind === "unchanged") return;
|
|
102
|
+
monaco.editor.setModelMarkers(editor.getModel(), "lsp", result.items.map(lspToMonacoMarker));
|
|
103
|
+
}
|
|
104
|
+
updateDiagnostics();
|
|
105
|
+
editor.onDidChangeModelContent(async (e) => {
|
|
106
|
+
await connection.sendNotification(DidChangeTextDocumentNotification.type, {
|
|
107
|
+
textDocument: {
|
|
108
|
+
uri: documentUri,
|
|
109
|
+
version: e.versionId
|
|
110
|
+
},
|
|
111
|
+
contentChanges: e.changes.map(monacoToLspContentChange)
|
|
112
|
+
});
|
|
113
|
+
await updateDiagnostics();
|
|
114
|
+
});
|
|
132
115
|
}
|
|
133
116
|
function setupHover(documentUri, languageId, connection, initResponse) {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const response = await connection.sendRequest(HoverRequest.type, params, token);
|
|
150
|
-
if (response === null) {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
return lspToMonacoHover(response);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
117
|
+
if (!initResponse.capabilities.hoverProvider) return;
|
|
118
|
+
monaco.languages.registerHoverProvider(languageId, { async provideHover(_, position, token) {
|
|
119
|
+
const params = {
|
|
120
|
+
position: {
|
|
121
|
+
line: position.lineNumber - 1,
|
|
122
|
+
character: position.column - 1
|
|
123
|
+
},
|
|
124
|
+
textDocument: { uri: documentUri }
|
|
125
|
+
};
|
|
126
|
+
const response = await connection.sendRequest(HoverRequest.type, params, token);
|
|
127
|
+
if (response === null) return null;
|
|
128
|
+
return lspToMonacoHover(response);
|
|
129
|
+
} });
|
|
156
130
|
}
|
|
157
131
|
function setupSignatureHelp(documentUri, languageId, connection, initResponse) {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
const response = await connection.sendRequest(SignatureHelpRequest.type, params, token);
|
|
182
|
-
if (response === null) {
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
return lspToMonacoSignatureHelp(response);
|
|
186
|
-
},
|
|
187
|
-
signatureHelpRetriggerCharacters: initResponse.capabilities.signatureHelpProvider.retriggerCharacters,
|
|
188
|
-
signatureHelpTriggerCharacters: initResponse.capabilities.signatureHelpProvider.triggerCharacters
|
|
189
|
-
});
|
|
132
|
+
if (!initResponse.capabilities.signatureHelpProvider) return;
|
|
133
|
+
monaco.languages.registerSignatureHelpProvider(languageId, {
|
|
134
|
+
async provideSignatureHelp(_, position, token, context) {
|
|
135
|
+
const params = {
|
|
136
|
+
position: {
|
|
137
|
+
character: position.column - 1,
|
|
138
|
+
line: position.lineNumber - 1
|
|
139
|
+
},
|
|
140
|
+
textDocument: { uri: documentUri },
|
|
141
|
+
context: {
|
|
142
|
+
isRetrigger: context.isRetrigger,
|
|
143
|
+
triggerKind: monacoToLspSignatureHelpTriggerKind(context.triggerKind),
|
|
144
|
+
activeSignatureHelp: context.activeSignatureHelp ? monacoToLspSignatureHelp(context.activeSignatureHelp) : void 0,
|
|
145
|
+
triggerCharacter: context.triggerCharacter
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
const response = await connection.sendRequest(SignatureHelpRequest.type, params, token);
|
|
149
|
+
if (response === null) return null;
|
|
150
|
+
return lspToMonacoSignatureHelp(response);
|
|
151
|
+
},
|
|
152
|
+
signatureHelpRetriggerCharacters: initResponse.capabilities.signatureHelpProvider.retriggerCharacters,
|
|
153
|
+
signatureHelpTriggerCharacters: initResponse.capabilities.signatureHelpProvider.triggerCharacters
|
|
154
|
+
});
|
|
190
155
|
}
|
|
191
156
|
function setupCompletion(documentUri, languageId, connection, initResponse) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
suggestions: response.items.map(r => lspToMonacoCompletionItem(r, range)),
|
|
224
|
-
incomplete: response.isIncomplete
|
|
225
|
-
};
|
|
226
|
-
},
|
|
227
|
-
async resolveCompletionItem(item, token) {
|
|
228
|
-
const response = await connection.sendRequest(CompletionResolveRequest.type, monacoToLspCompletionItem(item), token);
|
|
229
|
-
return lspToMonacoCompletionItem(response, item.range);
|
|
230
|
-
}
|
|
231
|
-
});
|
|
157
|
+
if (!initResponse.capabilities.completionProvider) return;
|
|
158
|
+
monaco.languages.registerCompletionItemProvider(languageId, {
|
|
159
|
+
triggerCharacters: initResponse.capabilities.completionProvider.triggerCharacters,
|
|
160
|
+
async provideCompletionItems(_, position, context, token) {
|
|
161
|
+
const params = {
|
|
162
|
+
position: {
|
|
163
|
+
line: position.lineNumber - 1,
|
|
164
|
+
character: position.column - 1
|
|
165
|
+
},
|
|
166
|
+
textDocument: { uri: documentUri },
|
|
167
|
+
context: {
|
|
168
|
+
triggerKind: monacoToLspCompletionTriggerKind(context.triggerKind),
|
|
169
|
+
triggerCharacter: context.triggerCharacter
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const response = await connection.sendRequest(CompletionRequest.type, params, token);
|
|
173
|
+
if (response === null) return null;
|
|
174
|
+
const range = new monaco.Range(position.lineNumber, position.column, position.lineNumber, position.column);
|
|
175
|
+
return Array.isArray(response) ? {
|
|
176
|
+
suggestions: response.map((r) => lspToMonacoCompletionItem(r, range)),
|
|
177
|
+
incomplete: false
|
|
178
|
+
} : {
|
|
179
|
+
suggestions: response.items.map((r) => lspToMonacoCompletionItem(r, range)),
|
|
180
|
+
incomplete: response.isIncomplete
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
async resolveCompletionItem(item, token) {
|
|
184
|
+
const response = await connection.sendRequest(CompletionResolveRequest.type, monacoToLspCompletionItem(item), token);
|
|
185
|
+
return lspToMonacoCompletionItem(response, item.range);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
232
188
|
}
|
|
233
|
-
|
|
189
|
+
//#endregion
|
|
234
190
|
export { basicEditorLspIntegration };
|