Closed prabirshrestha closed 7 years ago
It appears t he problem is that on Windows it doesn't have triple slashes. I think the last backslash is escaping the "
.
I will investigate this one later. If you want to see if you can fix the langserver#util#get_uri
function for windows, that'd be great. I assume that's what is causing the problem. (At least I think that's the function. I can look more later if that doesn't seem correct.)
It does seem to start if I manually add /
for windows.
But then if I don't have set shellslash
seems to use \\
.
langserver-go: reading on stdin, writing on stdout
--> request #1: initialize: {"capabilities":{},"rootPath":"file:///C:\\Users\\prshrest\\go\\src\\github.com\\prabirshrestha\\del256"}
<-- result #1: initialize: {"capabilities":{"textDocumentSync":1,"hoverProvider":true,"definitionProvider":true,"referencesProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true}}
Here is the patch to correctly start it on windows.
--- a/autoload/langserver/util.vim
+++ b/autoload/langserver/util.vim
@@ -13,7 +13,11 @@ let s:diagnostic_severity = {
""
" Get a uri from a filename
function! langserver#util#get_uri(name, filename) abort
- return 'file://' . a:filename
+ if has('win32') || has('win64')
+ return 'file:///' . substitute(a:filename, '\', '/', 'g')
+ else
+ return 'file://' . a:filename
+ endif
endfunction
""
langserver-go: reading on stdin, writing on stdout
--> request #1: initialize: {"capabilities":{},"rootPath":"file:///C:/Users/prabir/go/src/github.com/prabirshrestha/del256"}
<-- result #1: initialize: {"capabilities":{"textDocumentSync":1,"hoverProvider":true,"definitionProvider":true,"referencesProvider":true,"documentSymbolProvider":true,"workspaceSymbolProvider":true}}
Wrong root path for windows.
file://
contains two slashes instead of three.I think there is also another bug in go-langserver on windows where it doesn't normalize the path correctly. On windows it uses backslash instead of forward slash. Once this is fixed I will file a bug on go-langserver repo