kcl-lang / kcl

KCL Programming Language (CNCF Sandbox Project). https://kcl-lang.io
https://kcl-lang.io
Apache License 2.0
1.58k stars 113 forks source link

kcl-lsp scoop config version not in alignment with latest kcl scoop config #1165

Closed markphillips100 closed 5 months ago

markphillips100 commented 5 months ago

Should the scoop config for kcl-lsp be updated to 0.8.2?

My scoop-installed kcl is 0.8.2 but my kcl-language-server is 0.8.0. I don't know if this is the reason why my intellisense is not working in vscode? I could install the binaries direct via powershell but prefer scoop from an easy upgrade point of view.

Peefy commented 5 months ago

Hello. The reason why the version of kcl language server is 0.8.0 is that we found some issues in versions 0.8.1 and 0.8.2, so it was not released. This should not affect your local kcl language server 0.8.0. Can you ensure that kcl-language-server is in your PATH?

@He1pa Can you help follow up on this issue?

markphillips100 commented 5 months ago

Hi @Peefy . Yeah it is in the path.

markphillips100 commented 5 months ago

FYI from powershell prompt I type (get-command kcl-language-server.exe).Path and get the following path found:

C:\Users\mark_\scoop\shims\kcl-language-server.exe
He1pa commented 5 months ago

0.8.0 also works fine. You can check the kcl lsp version through kcl-language-server version and check whether it is in the path. In addition, you can check whether vscode and lsp are communicating normally here image

markphillips100 commented 5 months ago

Thanks for that @He1pa. I think it's something to do with maybe how I'm structuring the module.

Whatever it is I get a message "Not a valid kcl path, request failed" in the kcl language server log output. Just trying to create a minimal repro.

markphillips100 commented 5 months ago

It's hard to pinpoint as once the "Not a valid kcl path, request failed" message appears in log it doesn't seem to come good even when I revert code back to a known working minimal setup. I've tried shutting down all vscode but not sure that's enough. Is there a way to reset the server explicitly?

markphillips100 commented 5 months ago

So I have an example with minimal code here.

For me on windows vscode I have no colouring on the configSchemas.ConfigSchema as you can see here image

I see lots of the same error in log immediately after starting the one and only vscode running. F12 on ConfigSchema gives me no definition:

image

[Info  - 4:12:33 PM] Not a valid kcl path, request failed
thread '<unnamed>' panicked at sema\src\core\global_state.rs:514:66:
called `Option::unwrap()` on a `None` value
[Info  - 4:12:33 PM] on request Request { id: RequestId(I32(33)), method: "textDocument/codeAction", params: Object {"context": Object {"diagnostics": Array [], "triggerKind": Number(2)}, "range": Object {"end": Object {"character": Number(0), "line": Number(6)}, "start": Object {"character": Number(0), "line": Number(6)}}, "textDocument": Object {"uri": String("file:///d%3A/Dev/github/kcl-test/main.k")}} }
[Info  - 4:12:33 PM] on request Request { id: RequestId(I32(34)), method: "textDocument/semanticTokens/full", params: Object {"textDocument": Object {"uri": String("file:///d%3A/Dev/github/kcl-test/main.k")}} }
[Info  - 4:12:33 PM] Not a valid kcl path, request failed
[Info  - 4:14:22 PM] on notification Notification { method: "$/setTrace", params: Object {"value": String("off")} }
[Info  - 4:14:39 PM] on request Request { id: RequestId(I32(35)), method: "textDocument/hover", params: Object {"position": Object {"character": Number(23), "line": Number(2)}, "textDocument": Object {"uri": String("file:///d%3A/Dev/github/kcl-test/main.k")}} }
[Info  - 4:14:39 PM] Not a valid kcl path, request failed
[Info  - 4:16:21 PM] on request Request { id: RequestId(I32(36)), method: "textDocument/hover", params: Object {"position": Object {"character": Number(72), "line": Number(2)}, "textDocument": Object {"uri": String("file:///d%3A/Dev/github/kcl-test/main.k")}} }
[Info  - 4:16:21 PM] Not a valid kcl path, request failed
[Info  - 4:16:21 PM] on request Request { id: RequestId(I32(37)), method: "textDocument/hover", params: Object {"position": Object {"character": Number(71), "line": Number(2)}, "textDocument": Object {"uri": String("file:///d%3A/Dev/github/kcl-test/main.k")}} }
[Info  - 4:16:21 PM] Not a valid kcl path, request failed
Peefy commented 5 months ago

cc @He1pa

markphillips100 commented 5 months ago

I think my example is working now so possible false repro. It's very hard to pin down why the error occurs but when it does there seems to be no correlation with what makes things work again. Maybe it's a windows environment only thing to perhaps.

He1pa commented 5 months ago

I think my example is working now so possible false repro. It's very hard to pin down why the error occurs but when it does there seems to be no correlation with what makes things work again. Maybe it's a windows environment only thing to perhaps.

It has nothing to do with windows, this is a problem of lsp implementation. I've optimized this error message in the new implementation.

Is there any other way you can update to the new version?

markphillips100 commented 5 months ago

I can remove the scoop installs and do the powershell install method. What's the new version?

He1pa commented 5 months ago

I can remove the scoop installs and do the powershell install method. What's the new version?

0.8.1 or 0.8.2

markphillips100 commented 5 months ago

okay, I'll try in a few hours. Thanks for the update

markphillips100 commented 5 months ago

I've been driving 0.8.2 kcl-lsp for over an hour of numerous kcl file edits and not seeing the issue. I am playing with a slightly modified folder structure so don't know if that's the reason or not.

I have a fair bit of KCL code to write and test over the next few days so will report back on how that went, or sooner if the problem reappears.

Thanks for your help so far @He1pa and @Peefy

Peefy commented 5 months ago

Thank you again for your feedback. We will also strive to update a more stable and better performing version. ❤️

Peefy commented 5 months ago

Closed by https://github.com/kcl-lang/scoop-bucket/commit/3c3407a0e67f2f94082b56b4f5892c4641d371a6