javascript-typescript-langserver icon indicating copy to clipboard operation
javascript-typescript-langserver copied to clipboard

Diagnostics notification contains incorrect position

Open danielnowakowski opened this issue 7 years ago • 0 comments

I'm using version 2.9.4 and I've noticed that diagnostics feature does not work as expected.

Please look at the following code (file test3.js):

class TestClass {
    met1(arg1) {
        console.log(arg1);
    }
}

const myObj = new TestClass();

myObj.


I'm receiving publishDiagnostics notification for the file with one diagnostic. Diagnostic is correct but its position is incorrect.

Initialize request:

Content-Length: 303

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"rootUri":"file://PROJECT_PATH","capabilities":{"workspace":{"applyEdit":true},"textDocument":{"completion":{"completionItem":{"snippetSupport":true}},"synchronization":{"didSave":true}}}}}

Server notification:

{"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file://FILE_PATH/test3.js","diagnostics":[{"range":{"start":{"character":0,"line":0},"end":{"character":0,"line":0}},"message":"Identifier expected.","severity":1,"code":1003,"source":"ts"}]}}

I'm expecting position (line: 8, character: 6)

Please notice, that uri is changed by me before publishing this issue, but it is proper.

danielnowakowski avatar Sep 06 '18 10:09 danielnowakowski