MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / setupDocumentHandlingAndDiagnostics

Function setupDocumentHandlingAndDiagnostics

packages/monaco/src/lsp.ts:141–172  ·  view source on GitHub ↗
(
    editor: monaco.editor.IStandaloneCodeEditor,
    documentUri: string,
    connection: ProtocolConnection
)

Source from the content-addressed store, hash-verified

139}
140
141function setupDocumentHandlingAndDiagnostics(
142 editor: monaco.editor.IStandaloneCodeEditor,
143 documentUri: string,
144 connection: ProtocolConnection
145) {
146 async function updateDiagnostics() {
147 const params: DocumentDiagnosticParams = {
148 textDocument: {
149 uri: documentUri
150 }
151 };
152 const result = await connection.sendRequest(DocumentDiagnosticRequest.type, params);
153 if (result.kind === 'unchanged') {
154 return;
155 }
156
157 monaco.editor.setModelMarkers(editor.getModel()!, 'lsp', result.items.map(lspToMonacoMarker));
158 }
159 updateDiagnostics();
160
161 editor.onDidChangeModelContent(async e => {
162 await connection.sendNotification(DidChangeTextDocumentNotification.type, {
163 textDocument: {
164 uri: documentUri,
165 version: e.versionId
166 },
167 contentChanges: e.changes.map(monacoToLspContentChange)
168 });
169
170 await updateDiagnostics();
171 });
172}
173
174function setupHover(
175 documentUri: string,

Callers 1

Calls 2

updateDiagnosticsFunction · 0.85
mapMethod · 0.45

Tested by

no test coverage detected