cue
cue copied to clipboard
vscode-cue: Error starting LSP
What version of CUE are you using (cue version)?
cue version v0.12.0
go version go1.23.5
-buildmode exe
-compiler gc
-trimpath true
CGO_ENABLED 0
GOARCH amd64
GOOS windows
GOAMD64 v1
cue.lang.version v0.12.0
Installation Identifier cuelangorg.vscode-cue Version 0.0.9 Marketplace Last Updated 2025-02-07, 11:50:51 Published 2024-11-14, 10:40:25 Last Released 2025-01-02, 05:38:50
Does this issue reproduce with the latest stable release?
Yes.
What did you do?
- Install vscode-cue
- Open vscode workspace with multiple repos
- Open cue file in root of a repo
- From Command Palette select CUE: Start CUE LSP
What did you expect to see?
- Success / no error message.
- See autocompletions when typing identifiers in the cue file (vscode-cue is supposed to do autocompletions, right?)
What did you see instead?
1. An error:
Error loading workspace folders (expected 1, got 0) failed to load view for file:///c%3A/Users/josephtaber/source: WorkspaceFolder C:\Users\josephtaber\source does not correspond to a CUE module
Contents of the Cue Language Server logs under Ouput tab in vscode:
[Info - 9:39:57 AM] 2025/02/12 09:39:57 Shutdown session
shutdown_session=1
[Error - 9:39:57 AM] Server process exited with code 0.
[Info - 9:39:57 AM] 2025/02/12 09:39:57 cue lsp server pid: 215556
[Error - 9:39:57 AM] 2025/02/12 09:39:57 warning: while diagnosing orphaned files: expected exactly 1 view; saw 0
2. No autocompletions
No LSP completions are shown.
On every character input the Cue Language Server logs in the output tab shows this message:
[Error - 9:48:12 AM] 2025/02/12 09:48:12 warning: while diagnosing orphaned files: expected exactly 1 view; saw 0
As far as I can tell, the LSP is not yet ready for use. cc @myitcv
Thanks for reporting @infogulch. The LSP work is in progress but not yet at the point of, for example, completions working. We'll announce when it is, via the release notes and Slack/Discord.
However when we do announce more, it will likely still have a restriction of working on CUE modules, at least initially. The screenshot you have included above indicates that the directory/workspace you were working within is not a CUE module.
I'm interested to understand more about what you were trying to do here: where you were trying to open a single CUE file, by itself?
I'm using a cue tool file.
restriction of working on CUE modules
That is unfortunate.
It's completely understandable if the LSP autocompletion is simply not ready yet. Which features are expected to work? Syntax highlighting, formatting? (Maybe it would be good to put a checklist of features and their current status in the vscode-cue readme.)
Note that two missed expectations are listed. We have addressed autocompletion, but I also reported an error message. Perhaps focusing on the error message would be the most productive path forward on this issue. That said, maybe this is related to only supporting modules...
I'm using a cue tool file.
Ah, and I'm guessing that in that situation you're not importing anything other than standard library builtins?
Which features are expected to work?
Yes, that's on the list to make more explicit, ahead of us announcing more widely. Thank you for emphasising this however.
but I also reported an error message
Apologies, I should have been clear. The error message is, based on my previous comment, expected. i.e. it's a restriction for now that we load .cue files in the context of a CUE module. However, we might well be able to easily make exceptions for .cue files that, per above, only import standard library builtins. I'll have a think about this.
you're not importing anything other than standard library builtins?
Correct, it only uses stdlib.
error message is ... expected, ... we load .cue files in the context of a CUE module
I see, thanks for explaining in more detail.
we might well be able to easily make exceptions for .cue files that, per above, only import standard library builtins
That would be nice for me, thanks. :)
That would be nice for me, thanks. :)
Very much appreciate the very early feedback!
I'm running into a similar issue with zed-cue but only since v.0.12.0. In my case though the cue file being loaded is actually located within a cue module, it just happens to be in a sub-directory of a project. zed-cue runs cue lsp serve with the PWD set to the root of a project. Should cue lsp be able to detect that the .cue file being loaded is within the context of a module even when the PWD is not a module?
zed-cue is only relying on the formatting feature, which has been working great, and still does as long as the project root is a module.
I also get this, but in my workspace there IS a cue module, but its not in the root of the workspace, because its part of a monorepo. It would be highly inconvenient to have to have a dedicated workspace just because my module is in a sub directory?
This should all be fixed - please try using the latest CUE from master (or wait a week or so for the next alpha release) - I've been able to work full-time on LSP for a few months now and these issues are solved now (plus e.g. "jump-to-definition" now works, and other features are in development). Closing this, but please do open other bugs with the LSP if/when you come across them.