MCPcopy Create free account
hub / github.com/docker/docker-language-server / Rename

Function Rename

internal/compose/rename.go:8–26  ·  view source on GitHub ↗
(doc document.ComposeDocument, params *protocol.RenameParams)

Source from the content-addressed store, hash-verified

6)
7
8func Rename(doc document.ComposeDocument, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error) {
9 highlights, err := DocumentHighlight(doc, params.Position)
10 if err != nil || len(highlights) == 0 {
11 return nil, err
12 }
13
14 edits := []protocol.TextEdit{}
15 for _, highlight := range highlights {
16 edits = append(edits, protocol.TextEdit{
17 NewText: params.NewName,
18 Range: highlight.Range,
19 })
20 }
21 return &protocol.WorkspaceEdit{
22 Changes: map[protocol.DocumentUri][]protocol.TextEdit{
23 params.TextDocument.URI: edits,
24 },
25 }, nil
26}

Callers 8

TextDocumentRenameMethod · 0.92
TestRename_ServicesFunction · 0.85
TestRename_NetworksFunction · 0.85
TestRename_VolumesFunction · 0.85
TestRename_ConfigsFunction · 0.85
TestRename_SecretsFunction · 0.85
TestRename_ModelsFunction · 0.85
TestRename_FragmentsFunction · 0.85

Calls 1

DocumentHighlightFunction · 0.70

Tested by 7

TestRename_ServicesFunction · 0.68
TestRename_NetworksFunction · 0.68
TestRename_VolumesFunction · 0.68
TestRename_ConfigsFunction · 0.68
TestRename_SecretsFunction · 0.68
TestRename_ModelsFunction · 0.68
TestRename_FragmentsFunction · 0.68