Skip to content

Commit 5a96569

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/lsp/cmd: don't use x/exp/slices
A direct dependency on x/exp/slices was added in CL 497756. As a matter of policy, we don't depend on x/exp from gopls. Also, this left the module in an untidy state. I suspect that the slices package was added by a bad goimports operation, which is another issue entirely. In any case, the standard library slices package is not available in 1.18. Change-Id: I76b78313537ef9918317ecec25c4b12ed526c62f Reviewed-on: https://go-review.googlesource.com/c/tools/+/524817 gopls-CI: kokoro <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent 77c6ac6 commit 5a96569

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

gopls/internal/lsp/cmd/cmd.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"text/tabwriter"
2222
"time"
2323

24-
"golang.org/x/exp/slices"
2524
"golang.org/x/tools/gopls/internal/lsp"
2625
"golang.org/x/tools/gopls/internal/lsp/browser"
2726
"golang.org/x/tools/gopls/internal/lsp/cache"
@@ -547,22 +546,23 @@ func (c *cmdClient) ApplyEdit(ctx context.Context, p *protocol.ApplyWorkspaceEdi
547546
// files, honoring the preferred edit mode specified by cli.app.editMode.
548547
// (Used by rename and by ApplyEdit downcalls.)
549548
func (cli *cmdClient) applyWorkspaceEdit(edit *protocol.WorkspaceEdit) error {
550-
var orderedURIs []span.URI
549+
var orderedURIs []string
551550
edits := map[span.URI][]protocol.TextEdit{}
552551
for _, c := range edit.DocumentChanges {
553552
if c.TextDocumentEdit != nil {
554553
uri := fileURI(c.TextDocumentEdit.TextDocument.URI)
555554
edits[uri] = append(edits[uri], c.TextDocumentEdit.Edits...)
556-
orderedURIs = append(orderedURIs, uri)
555+
orderedURIs = append(orderedURIs, string(uri))
557556
}
558557
if c.RenameFile != nil {
559558
return fmt.Errorf("client does not support file renaming (%s -> %s)",
560559
c.RenameFile.OldURI,
561560
c.RenameFile.NewURI)
562561
}
563562
}
564-
slices.Sort(orderedURIs)
565-
for _, uri := range orderedURIs {
563+
sort.Strings(orderedURIs)
564+
for _, u := range orderedURIs {
565+
uri := span.URIFromURI(u)
566566
f := cli.openFile(uri)
567567
if f.err != nil {
568568
return f.err

0 commit comments

Comments
 (0)