cue icon indicating copy to clipboard operation
cue copied to clipboard

lsp: implement cueimports behaviour under config for Format

Open myitcv opened this issue 1 year ago • 1 comments

Go has goimports:

goimports updates your Go import lines, adding missing ones and removing unreferenced ones.

Indeed this behaviour is also available via gopls via a config option.

CUE should have something similar.

Prior art here is @asdine's https://github.com/asdine/cueimports.

We should provide a config option and mode for this in cue lsp.

Note: this will require that cache of parsed artefacts, because the local resolution must inspect files in the same package to verify that it is unresolved.

myitcv avatar Nov 14 '24 14:11 myitcv

Worth noting that gopls does this as a separate "organize imports" code action; I'm not sure if there was a strong reason to separate that from the regular "format" operation.

mvdan avatar Dec 02 '25 16:12 mvdan