vala-lang / vala-vscode

Vala and Genie integration for Visual Studio Code/VSCodium/Code-OSS
MIT License
41 stars 9 forks source link

Failed to start vls and load document on windows #3

Closed taozuhong closed 4 years ago

taozuhong commented 4 years ago

OS: Windows7 6.1.7601 + MSYS2 (3.1.4) + Pacman(5.2.1) Vala: 0.48

  1. clone vls and compile it, then copy vala-language-server.exe to /mingw64/bin ----> vala-vscode can't load and start vls

  2. update client.ts to return valid path directly:

    return "c:\\msys\\mingw64\\bin\\vala-language-server.exe";

    ----> then start the vls server, failed to load document:

    
    vls: main.vala:207: Finished constructing
    vls: main.vala:180: Got call! initialize
    vls: main.vala:247: [initialize] root path is d:\Codelabs\GitHub\kangaroo

(process:89728): Json-CRITICAL **: 13:59:50.806: json_node_get_array: assertion 'JSON_NODE_IS_VALID (node)' failed

(process:89728): Json-CRITICAL **: 13:59:50.806: json_array_get_elements: assertion 'array != NULL' failed vls: main.vala:172: Got notification! initialized vls: main.vala:176: no notification handler for initialized vls: main.vala:172: Got notification! textDocument/didOpen vls: main.vala:531: failed to find text document for d:\Codelabs\GitHub\kangaroo\src\main.vala' vls: main.vala:180: Got call! textDocument/documentSymbol vls: main.vala:531: failed to find text document ford:\Codelabs\GitHub\kangaroo\src\main.vala' vls: main.vala:960: [textDocument/documentSymbol] file `file:///d%3A/Codelabs/GitHub/kangaroo/src/main.vala' not found


3. update client.ts to return the path returned by which command
```ts
getLanguageServerPath(): string | null {
    let uri;
    if (window.activeTextEditor) {
        uri = window.activeTextEditor.document.uri;
    } else {
        uri = null;
    }
    // return workspace.getConfiguration('vls', uri).languageServerPath
    return which.sync('vala-language-server', { nothrow: true })
         || which.sync('gvls', { nothrow: true })
}

the vls server can start, then output the follow log:

vls: main.vala:207: Finished constructing
vls: main.vala:180: Got call! initialize
vls: main.vala:247: [initialize] root path is d:\Codelabs\GitHub\kangaroo

(process:98056): Json-CRITICAL **: 14:04:44.170: json_node_get_array: assertion 'JSON_NODE_IS_VALID (node)' failed

(process:98056): Json-CRITICAL **: 14:04:44.170: json_array_get_elements: assertion 'array != NULL' failed
vls: main.vala:172: Got notification! initialized
vls: main.vala:176: no notification handler for initialized
vls: main.vala:172: Got notification! textDocument/didOpen
vls: main.vala:531: failed to find text document for `d:\Codelabs\GitHub\kangaroo\src\main.vala'
vls: main.vala:180: Got call! textDocument/documentSymbol
vls: main.vala:531: failed to find text document for `d:\Codelabs\GitHub\kangaroo\src\main.vala'
vls: main.vala:960: [textDocument/documentSymbol] file `file:///d%3A/Codelabs/GitHub/kangaroo/src/main.vala' not found
Prince781 commented 4 years ago

Please open this bug in https://github.com/benwaffle/vala-language-server

Prince781 commented 4 years ago

Okay, the first part of this bug belongs here. The second part of this bug belongs in vala-language-server.

taozuhong commented 4 years ago

done, pls see: https://github.com/benwaffle/vala-language-server/issues/58