-
-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with ProtocolToMonacoConverter #214
Comments
@zkrami Sorry, but I'm having troubles following. Can you provide some more context? The client is sending your server a |
Actually I am providing the codeAction to the client to enable I hope this snapcode will make the context a bit clearer const p2m = new ProtocolToMonacoConverter();
monaco.languages.registerCodeActionProvider(LANGUAGE_ID, {
provideCodeActions: (model, _range, context, token) => {
const actions = context.markers.map(marker => m2p.asDiagnostic(marker)).map(diagnostic => {
return p2m.asCodeAction(formulaLanguageService.codeAction(document, range, diagnostic,uri));
|
@zkrami How are you getting this? I don't see anything in your seven lines of code that would correspond to that? formulaLanguageService.codeAction(document, range, diagnostic,uri) None of the four arguments here looks like they are related to the above JSON blob. |
Actually that's the result of import { TextEdit, Position, TextDocument, FormattingOptions, Range, Diagnostic, CodeAction, TextDocumentEdit, WorkspaceEdit, Command } from 'vscode-languageserver-protocol';
codeAction(document: TextDocument, range: Range, error: Diagnostic, uri: string): CodeAction | Command {
let edits = [TextEdit.replace(range, "Inserted text ")];
let action = CodeAction.create("Replace VLOOKUP", { changes: { uri: edits } }, "quickfix");
action.diagnostics = [error] ;
return action
} |
@zkrami Your |
@zkrami You should also validate what your custom |
@rcjsuen Hi, I'm facing the same problem. I've implemented websocket connection as follows https://github.com/TypeFox/monaco-languageclient/tree/master/example. request: {
"jsonrpc": "2.0",
"id": 7,
"method": "textDocument/codeAction",
"params": {
"textDocument": {
"uri": "inmemory://model.sql"
},
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 0
}
},
"context": {
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 6
}
},
"message": "A linebreak is required after SELECT keyword",
"severity": 1,
"source": "sql"
}
]
}
}
} {
"jsonrpc": "2.0",
"id": 7,
"result": [
{
"title": "fix: A linebreak is required after SELECT keyword",
"edit": {
"documentChanges": [
{
"textDocument": {
"uri": "inmemory://model.sql",
"version": 1
},
"edits": [
{
"range": {
"start": {
"line": 0,
"character": 6
},
"end": {
"line": 0,
"character": 7
}
},
"newText": "\n"
},
{
"range": {
"start": {
"line": 0,
"character": 7
},
"end": {
"line": 0,
"character": 7
}
},
"newText": " "
}
]
}
]
},
"kind": "quickfix",
"diagnostics": [
{
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 0,
"character": 6
}
},
"message": "A linebreak is required after SELECT keyword",
"severity": 1,
"source": "sql"
}
]
}
]
} The reproducible code is here. Actually it looks the error from monaco-editor though, is there any possibility monaco-languageclient's fault? |
@joe-re Your code doesn't compile for me for whatever reason.
|
@rcjsuen Umm looks module installation has failed. |
@joe-re That got me a little bit further, thanks. I opened joe-re/sql-language-server#41 about that. I also hit another error while trying to run your example, see joe-re/sql-language-server#37 (review). |
@rcjsuen Oh, I see. I got succeeded after updating monaco-languageclient version to |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I am implementing my own Language service provider trying to stick to the
vscode-languageserver-protocol
.I am integrating my LSP with monaco editor.
However when I am using
ProtocolToMonacoConverter.asCodeAction
I am not receiving the expected json structure.Here is the structure I am receiving:
and Here is what monaco expecting to receive:
the difference is between
edit.edits.edits
andedit.edits.edit
the last key has nos
.I am receiving this message when using the converter
Error: bad edit - only text edits are supported
The text was updated successfully, but these errors were encountered: