Skip to content

Wiki: "LSP: Getting started" should cover code actions, and cue lsp should no longer be hidden #4332

@myitcv

Description

@myitcv

The wiki at https://github.com/cue-lang/cue/wiki/LSP:-Getting-started is a good on-ramp, but there are two concrete gaps worth addressing:

1. cue lsp should no longer be hidden

cmd/cue/cmd/lsp.go:29 still marks the subcommand as Hidden: true. Given the feature set below is real and user-facing, it's probably time to unhide it (and flesh out the TODO(myitcv) items in that file around flag processing and cue help lsp).

2. Code actions (refactors) exposed by the server

internal/lsp/server/codeaction.go ships three concrete refactors that users get via textDocument/codeAction. None are mentioned on the wiki:

  • Add surrounding struct braces (refactor.rewrite.convertToStruct) — wraps the selection in { ... }.
  • Remove surrounding struct braces (refactor.rewrite.convertFromStruct) — the inverse; marked IsPreferred so editors prioritise it when both apply.
  • Organize Imports (source.organizeImports).

A short subsection with a screenshot or gif and editor-specific keybinding hints (e.g. Ctrl+. in VSCode, <leader>ca in common Neovim setups) would go a long way.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions