this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

lsp/cache: provide placeholder for PrepareRename

LSP supports a PrepareRename method. This allows the LSP server to
expand a file coordinate to the range of the token found (to be
renamed), and also provide a placeholder value which the editor can use
to pre-populate a rename dialog.

We already implemented this method, and provided the token range, but we
did not provide the placeholder field. This CL adds the placeholder.

Signed-off-by: Matthew Sackman <matthew@cue.works>
Change-Id: I8c331b3d7714dcd56c8a019c4492a6bbc58366f1
Reviewed-on: https://cue.gerrithub.io/c/cue-lang/cue/+/1230271
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

+7 -1
+1
cmd/cue/cmd/integration/workspace/references_test.go
··· 207 207 Start: protocol.Position{Line: 6, Character: 7}, 208 208 End: protocol.Position{Line: 6, Character: 10}, 209 209 })) 210 + qt.Assert(t, qt.Equals(result.Placeholder, "out")) 210 211 211 212 // Now do the rename for real 212 213 env.Rename(protocol.Location{
+6 -1
internal/lsp/cache/rename.go
··· 113 113 continue 114 114 } 115 115 if protocol.Intersect(r, posRange) { 116 + label := "" 117 + if lab, ok := target.(ast.Label); ok { 118 + label, _, _ = ast.LabelName(lab) 119 + } 116 120 return &protocol.PrepareRenamePlaceholder{ 117 - Range: r, 121 + Range: r, 122 + Placeholder: label, 118 123 } 119 124 } 120 125 }