No communication after initialized message, like textDocument/DidOpen, textDocument/DidChange #660
-
HI, I followed the below example in an angular application that connects to an xtext service using an LS via WebSocket. (I am new to these technologies) https://github.com/TypeFox/monaco-languageclient/blob/main/verify/angular/src/app/app.component.ts Console log
package.json
componednt html <div #editor class="editor"></div> component.ts import {AfterViewInit, Component, ElementRef, ViewChild} from '@angular/core';
import {MonacoEditorLanguageClientWrapper, UserConfig} from "monaco-editor-wrapper";
import getKeybindingsServiceOverride from '@codingame/monaco-vscode-keybindings-service-override';
import {useWorkerFactory} from "monaco-editor-wrapper/workerFactory";
import {LANGUAGE_EXTENSION, LANGUAGE_ID} from "../../language-definitions";
useWorkerFactory({
rootPath: window.location.href + '../..',
basePath: '../assets',
});
@Component({
selector: 'app-editor',
standalone: true,
imports: [],
templateUrl: './editor.component.html',
styleUrl: './editor.component.scss'
})
export class EditorComponent implements AfterViewInit{
@ViewChild('editor') editor!: ElementRef;
ngAfterViewInit(): void {
const wrapper = new MonacoEditorLanguageClientWrapper();
const userConfig: UserConfig = {
wrapperConfig: {
serviceConfig: {
userServices: {
...getKeybindingsServiceOverride(),
},
debugLogging: true
},
editorAppConfig: {
$type: 'extended',
codeResources: {
main: {
text: '',
fileExt: LANGUAGE_EXTENSION
}
},
userConfiguration: {
json: JSON.stringify({
'workbench.colorTheme': 'Default Dark Modern',
'editor.guides.bracketPairsHorizontal': 'active',
'editor.lightbulb.enabled': 'On'
})
},
useDiffEditor: false,
}
},
languageClientConfig: {
languageId: LANGUAGE_ID,
options: {
$type: 'WebSocketUrl',
url: 'ws://localhost:5008',
startOptions: {
onCall: () => {
console.log('Connected to socket.');
},
reportStatus: true
},
stopOptions: {
onCall: () => {
console.log('Disconnected from socket.');
},
reportStatus: true
}
}
}
};
wrapper.dispose().then(() => {
console.log('dispose wrapper')
wrapper.initAndStart(userConfig, this.editor.nativeElement).then(() => {
console.log('initAndStart')
}).catch((error) => {
console.log(error);
});
})
}
} Am I missing something ? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Answered by
cjayashantha
May 17, 2024
Replies: 1 comment
-
I missed the part registering the language...
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
cjayashantha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I missed the part registering the language...