Skip to content
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

Language server compilation error and no syntax highlighting in vscode when code is valid on Windows #1251

Closed
markphillips100 opened this issue Apr 27, 2024 · 17 comments
Assignees
Labels
bug Something isn't working lsp

Comments

@markphillips100
Copy link

1. Minimal reproduce step (Required)

I've added a minimal repro sample here that triggers error popups in VSCode along with no syntax highlighting, even though the code is valid (I think).

It "feels" like the server has a problem with the filter statement but this could be just a false observation on my part.

Whenever the issue arises and I make some change to rectify, I always have to restart VSCode to test if the server is okay again.

2. What did you expect to see? (Required)

Syntax highlighting should work even if there is a compilation error and indicate what the error is to the user.

If I comment the code in resources/contributorAssignees.k and restart VSCode, main.k shows the following expected highlighting and no errors from language server.

image

3. What did you see instead (Required)

I see errors under the kcl language server output window:

[Info  - 7:47:28 PM] on did open file: AbsPathBuf("d:\\Dev\\github\\kcl-test\\main.k")
thread '<unnamed>' panicked at sema\src\core\global_state.rs:514:66:
called `Option::unwrap()` on a `None` value
[Info  - 7:47:29 PM] Compile failed: "Compile failed: Any { .. }"
[Error - 7:47:29 PM] Request textDocument/documentSymbol failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\main.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 7:47:29 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\main.k analysisDatabase not found, maybe compile failed
  Code: -32603 

main.k shows no coloured highlighting.

image

4. What is your KCL components version? (Required)

kcl --version: 0.8.6
kcl-language-server: 0.8.5
VSCode extension "KCL" by kcl_extension_publisher v0.1.6
VSCode v1.88.1
Windows 11

@Peefy
Copy link
Contributor

Peefy commented Apr 27, 2024

Thank you for your feedback. There are indeed bugs in version 0.8.5 of the language server, which have been fixed. We will release version 0.8.6 later.

cc @He1pa

@Peefy Peefy added lsp bug Something isn't working labels Apr 28, 2024
@Peefy Peefy added this to the v0.9.0 Release milestone Apr 28, 2024
@Peefy
Copy link
Contributor

Peefy commented Apr 30, 2024

Closed by #1247 and released kcl-language-server v0.8.6

@Peefy Peefy closed this as completed Apr 30, 2024
@markphillips100
Copy link
Author

@Peefy is this supposed to be fixed in kcl-language-server v0.8.6? I just bumped kcl to v0.8.7 and kcl-language-server to v0.8.6 and still seeing the same issue with my test repo (pull latest as I removed a file from the "language-error" branch.

@Peefy Peefy reopened this May 1, 2024
@Peefy
Copy link
Contributor

Peefy commented May 1, 2024

cc @He1pa Can you help investigate it on the Windows platform. The code repo is here. https://github.com/markphillips100/kcllsp-test

I was unable to successfully reproduce the issue.

@markphillips100
Copy link
Author

Just FYI @Peefy @He1pa , I got hold of a macbook briefly and tried my test repo and also my real compositions repo under the same conditions. No problem on the mac so appears this may be a windows OS only thing.

@Peefy
Copy link
Contributor

Peefy commented May 5, 2024

Thank you! @markphillips100 We will fix it soon. ❤

@Peefy Peefy changed the title Language server compilation error and no syntax highlighting in vscode when code is valid Language server compilation error and no syntax highlighting in vscode when code is valid on Windows May 6, 2024
@Peefy
Copy link
Contributor

Peefy commented May 8, 2024

Closed by #1283, will release kcl-language-server v0.8.7 soon.

@Peefy Peefy closed this as completed May 8, 2024
@markphillips100
Copy link
Author

Hi @Peefy kcl-language-server v0.8.7 appears to fix the current test repo, however my real code is still throwing errors in the language server - usual "compile failed code: -32603". Something else causing a problem now I suspect.

I'll see if I can narrow it down and update the test repo.

@Peefy
Copy link
Contributor

Peefy commented May 9, 2024

Thank you @markphillips100 Could you please give more language server logs?

@markphillips100
Copy link
Author

Yep. I'll copy code for one of my compositions into a new test repo, the smallest one that breaks, and reference here when available with logs attached.

@markphillips100
Copy link
Author

@Peefy I've added branch error2 and included one of my real compositions. Note, there seems to be a separate issue in regards to some schema complaints around matchControllerRef. You'll see assuming syntax highlighting works for you. I know the code compiles and is used by function-kcl so not sure what the complaint the compiler has here. Anyway, back to the main issue...

What I've observed is that if I close any open files, close VSCode, reopen it and wait a few seconds then select main.k, syntax highlighting appears, and if I select each file in the project it'll show correct highlighting.

If I do the same but open the resources/notification.k file, or any of the files in resources actually, then the language errors start. Here's log output:

[Info  - 12:10:30 PM] on did open file: AbsPathBuf("d:\\Dev\\github\\kcl-test\\resources\\notification.k")
thread '<unnamed>' panicked at sema\src\core\global_state.rs:514:66:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 12:10:32 PM] Compile failed: "Compile failed: Any { .. }"
[Error - 12:10:32 PM] Request textDocument/documentSymbol failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:32 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:34 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:35 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:36 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 

@Peefy Peefy reopened this May 9, 2024
@Peefy
Copy link
Contributor

Peefy commented May 9, 2024

cc @He1pa Can you help investigate this issue?

@Peefy
Copy link
Contributor

Peefy commented May 14, 2024

Closed by #1301 and release kcl-language-server v0.9.0-alpha.1

@Peefy Peefy closed this as completed May 14, 2024
@markphillips100
Copy link
Author

@Peefy I'll give it go tomorrow and give you feedback.

@markphillips100
Copy link
Author

@Peefy all looks great in all my kcl composition code on windows, so thank you and @He1pa

@He1pa
Copy link
Contributor

He1pa commented May 16, 2024

@Peefy I've added branch error2 and included one of my real compositions. Note, there seems to be a separate issue in regards to some schema complaints around matchControllerRef. You'll see assuming syntax highlighting works for you. I know the code compiles and is used by function-kcl so not sure what the complaint the compiler has here. Anyway, back to the main issue...

What I've observed is that if I close any open files, close VSCode, reopen it and wait a few seconds then select main.k, syntax highlighting appears, and if I select each file in the project it'll show correct highlighting.

If I do the same but open the resources/notification.k file, or any of the files in resources actually, then the language errors start. Here's log output:

[Info  - 12:10:30 PM] on did open file: AbsPathBuf("d:\\Dev\\github\\kcl-test\\resources\\notification.k")
thread '<unnamed>' panicked at sema\src\core\global_state.rs:514:66:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[Info  - 12:10:32 PM] Compile failed: "Compile failed: Any { .. }"
[Error - 12:10:32 PM] Request textDocument/documentSymbol failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:32 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:34 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:35 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 
[Error - 12:10:36 PM] Request textDocument/semanticTokens/full failed.
  Message: Internal bug: Path d:\Dev\github\kcl-test\resources\notification.k analysisDatabase not found, maybe compile failed
  Code: -32603 

I also fixed the issue you mentioned which falsely report error about schema config

@markphillips100
Copy link
Author

Yes thank you. I did notice that was working now too. Great work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp
Projects
None yet
Development

No branches or pull requests

3 participants