C
Claude Zhao
Guest
Hi guys,
I'm writing a LSP server and clinet in VS code. I use lsp4j to implement the LSP server and use the npm package vscode-languageclient to implement the client.
In the client, I use a FileSystemProvider to get the file conent, because I need a customize scheme. Below is code slice of the implementation of FileSystemProvider::readFile:
if (path) {
return fs.readFileSync(path);
}
As you see, I get the data from an existing file directly.
Then I use following code to open the uri:
vscode.commands.executeCommand('vscode.open', vscode.Uri.Parse(a-customize-uri));
Certainly the the file system provider could work and the file could
be opened, but no change event emitted when I modify the content. Which
means when I change the file content in the editor, no jsonRPC
communication between client and server.
I could get the change event when the file is saved (FileChangeType.Changed), but that's not what I want.
If I don't use FileSystemProvider, just open the file directly:
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(abs-path))
Everything goes well, language client could send the change event correctly.
I also tried to add middle ware (didOpen, didSave, didChange) in the client options, but still could not work. Also, when I don't use the FileSystemProvider, the middle ware could be called correctly.
So I guess whether FileSystemProvider could interest the change event in the editor?
Not sure whether I describe my question clearly, but any comment would be appreciated.
Thanks!
Continue reading...
I'm writing a LSP server and clinet in VS code. I use lsp4j to implement the LSP server and use the npm package vscode-languageclient to implement the client.
In the client, I use a FileSystemProvider to get the file conent, because I need a customize scheme. Below is code slice of the implementation of FileSystemProvider::readFile:
if (path) {
return fs.readFileSync(path);
}
As you see, I get the data from an existing file directly.
Then I use following code to open the uri:
vscode.commands.executeCommand('vscode.open', vscode.Uri.Parse(a-customize-uri));
Certainly the the file system provider could work and the file could
be opened, but no change event emitted when I modify the content. Which
means when I change the file content in the editor, no jsonRPC
communication between client and server.
I could get the change event when the file is saved (FileChangeType.Changed), but that's not what I want.
If I don't use FileSystemProvider, just open the file directly:
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(abs-path))
Everything goes well, language client could send the change event correctly.
I also tried to add middle ware (didOpen, didSave, didChange) in the client options, but still could not work. Also, when I don't use the FileSystemProvider, the middle ware could be called correctly.
So I guess whether FileSystemProvider could interest the change event in the editor?
Not sure whether I describe my question clearly, but any comment would be appreciated.
Thanks!
Continue reading...