Skip to content

Commit

Permalink
gopls: migrate internal/lsp to gopls/internal/lsp
Browse files Browse the repository at this point in the history
This CL was created using the following commands:

    ./gopls/internal/migrate.sh
    git add .
    git codereview gofmt

For golang/go#54509

Change-Id: Iceeec602748a5e6f609c3ceda8d19157e5c94009
Reviewed-on: https://go-review.googlesource.com/c/tools/+/426796
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
  • Loading branch information
findleyr committed Sep 7, 2022
1 parent dd1bab2 commit b15dac2
Show file tree
Hide file tree
Showing 864 changed files with 670 additions and 666 deletions.
2 changes: 1 addition & 1 deletion copyright/copyright.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func checkFile(toolsDir, filename string) (bool, error) {
return shouldAddCopyright, nil
}

// Copied from golang.org/x/tools/internal/lsp/source/util.go.
// Copied from golang.org/x/tools/gopls/internal/lsp/source/util.go.
// Matches cgo generated comment as well as the proposed standard:
//
// https://golang.org/s/generatedcode
Expand Down
4 changes: 2 additions & 2 deletions go/analysis/analysistest/analysistest.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import (
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/analysis/internal/checker"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/lsp/diff"
"golang.org/x/tools/internal/lsp/diff/myers"
"golang.org/x/tools/internal/diff"
"golang.org/x/tools/internal/diff/myers"
"golang.org/x/tools/internal/span"
"golang.org/x/tools/internal/testenv"
"golang.org/x/tools/txtar"
Expand Down
6 changes: 3 additions & 3 deletions gopls/api-diff/api_diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ import (
"path/filepath"
"strings"

"golang.org/x/tools/gopls/internal/lsp/source"
difflib "golang.org/x/tools/internal/diff"
"golang.org/x/tools/internal/diff/myers"
"golang.org/x/tools/internal/gocommand"
difflib "golang.org/x/tools/internal/lsp/diff"
"golang.org/x/tools/internal/lsp/diff/myers"
"golang.org/x/tools/internal/lsp/source"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion gopls/doc/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ claiming it.

## Getting started

Most of the `gopls` logic is actually in the `golang.org/x/tools/internal/lsp`
Most of the `gopls` logic is actually in the `golang.org/x/tools/gopls/internal/lsp`
directory, so you are most likely to develop in the golang.org/x/tools module.

## Build
Expand Down
4 changes: 2 additions & 2 deletions gopls/doc/design/integrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ For instance, files that are needed to do correct type checking are modified by
Monitoring files inside gopls directly has a lot of awkward problems, but the [LSP specification] has methods that allow gopls to request that the client notify it of file system changes, specifically [`workspace/didChangeWatchedFiles`].
This is currently being added to gopls by a community member, and tracked in [#31553]

[InitializeResult]: https://pkg.go.dev/golang.org/x/tools/internal/lsp/protocol#InitializeResult
[ServerCapabilities]: https://pkg.go.dev/golang.org/x/tools/internal/lsp/protocol#ServerCapabilities
[InitializeResult]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/lsp/protocol#InitializeResult
[ServerCapabilities]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/lsp/protocol#ServerCapabilities
[`golang.org/x/tools/internal/span`]: https://pkg.go.dev/golang.org/x/tools/internal/span#NewPoint

[LSP specification]: https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/
Expand Down
14 changes: 7 additions & 7 deletions gopls/doc/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ import (
"github.com/jba/printsrc"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/lsp/command"
"golang.org/x/tools/internal/lsp/command/commandmeta"
"golang.org/x/tools/internal/lsp/mod"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/gopls/internal/lsp/command"
"golang.org/x/tools/gopls/internal/lsp/command/commandmeta"
"golang.org/x/tools/gopls/internal/lsp/mod"
"golang.org/x/tools/gopls/internal/lsp/source"
)

func main() {
Expand All @@ -52,7 +52,7 @@ func doMain(write bool) (bool, error) {
return false, err
}

sourceDir, err := pkgDir("golang.org/x/tools/internal/lsp/source")
sourceDir, err := pkgDir("golang.org/x/tools/gopls/internal/lsp/source")
if err != nil {
return false, err
}
Expand Down Expand Up @@ -96,7 +96,7 @@ func loadAPI() (*source.APIJSON, error) {
&packages.Config{
Mode: packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax | packages.NeedDeps,
},
"golang.org/x/tools/internal/lsp/source",
"golang.org/x/tools/gopls/internal/lsp/source",
)
if err != nil {
return nil, err
Expand Down Expand Up @@ -587,7 +587,7 @@ func rewriteFile(file string, api *source.APIJSON, write bool, rewrite func([]by
func rewriteAPI(_ []byte, api *source.APIJSON) ([]byte, error) {
var buf bytes.Buffer
fmt.Fprintf(&buf, "// Code generated by \"golang.org/x/tools/gopls/doc/generate\"; DO NOT EDIT.\n\npackage source\n\nvar GeneratedAPIJSON = ")
if err := printsrc.NewPrinter("golang.org/x/tools/internal/lsp/source").Fprint(&buf, api); err != nil {
if err := printsrc.NewPrinter("golang.org/x/tools/gopls/internal/lsp/source").Fprint(&buf, api); err != nil {
return nil, err
}
return format.Source(buf.Bytes())
Expand Down
2 changes: 1 addition & 1 deletion gopls/doc/settings.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Settings

<!--TODO: Generate this file from the documentation in golang/org/x/tools/internal/lsp/source/options.go.-->
<!--TODO: Generate this file from the documentation in golang.org/x/tools/gopls/internal/lsp/source/options.go.-->

This document describes the global settings for `gopls` inside the editor.
The settings block will be called `"gopls"` and contains a collection of
Expand Down
10 changes: 7 additions & 3 deletions gopls/internal/coverage/coverage.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
// -o controls where the coverage file is written, defaulting to /tmp/cover.out
// -i coverage-file will generate the report from an existing coverage file
// -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
// 2: report on each test, 3: more details, 4: too much)
//
// 2: report on each test, 3: more details, 4: too much)
//
// -t tests only tests packages in the given comma-separated list of directories in gopls.
// The names should start with ., as in ./internal/regtest/bench
//
// The names should start with ., as in ./internal/regtest/bench
//
// -run tests. If set, -run tests is passed on to the go test command.
//
// Despite gopls' use of goroutines, the counts are almost deterministic.
Expand Down Expand Up @@ -60,7 +64,7 @@ func main() {
tests = realTestName(tests)

// report coverage for packages under internal/lsp
parg := "golang.org/x/tools/internal/lsp/..."
parg := "golang.org/x/tools/gopls/internal/lsp/..."

accum := []string{}
seen := make(map[string]bool)
Expand Down
4 changes: 2 additions & 2 deletions gopls/internal/hooks/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
package hooks

import (
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"honnef.co/go/tools/analysis/lint"
"honnef.co/go/tools/quickfix"
"honnef.co/go/tools/simple"
Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/hooks/analysis_117.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

package hooks

import "golang.org/x/tools/internal/lsp/source"
import "golang.org/x/tools/gopls/internal/lsp/source"

func updateAnalyzers(options *source.Options) {
options.StaticcheckSupported = false
Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/hooks/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"unicode"

"github.com/sergi/go-diff/diffmatchpatch"
"golang.org/x/tools/internal/lsp/diff"
"golang.org/x/tools/internal/diff"
"golang.org/x/tools/internal/span"
)

Expand Down
2 changes: 1 addition & 1 deletion gopls/internal/hooks/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"unicode/utf8"

"golang.org/x/tools/internal/lsp/diff/difftest"
"golang.org/x/tools/internal/diff/difftest"
)

func TestDiff(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions gopls/internal/hooks/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ package hooks // import "golang.org/x/tools/gopls/internal/hooks"
import (
"context"

"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/gopls/internal/vulncheck"
"golang.org/x/tools/internal/lsp/diff"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/diff"
"mvdan.cc/gofumpt/format"
"mvdan.cc/xurls/v2"
)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/internal/analysisinternal"
"golang.org/x/tools/internal/lsp/fuzzy"
"golang.org/x/tools/internal/fuzzy"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/fillreturns"
"golang.org/x/tools/gopls/internal/lsp/analysis/fillreturns"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/ast/inspector"
"golang.org/x/tools/internal/analysisinternal"
"golang.org/x/tools/internal/lsp/fuzzy"
"golang.org/x/tools/internal/fuzzy"
"golang.org/x/tools/internal/span"
"golang.org/x/tools/internal/typeparams"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/fillstruct"
"golang.org/x/tools/gopls/internal/lsp/analysis/fillstruct"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/infertypeargs"
"golang.org/x/tools/gopls/internal/lsp/analysis/infertypeargs"
"golang.org/x/tools/internal/testenv"
"golang.org/x/tools/internal/typeparams"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/nonewvars"
"golang.org/x/tools/gopls/internal/lsp/analysis/nonewvars"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/noresultvalues"
"golang.org/x/tools/gopls/internal/lsp/analysis/noresultvalues"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/simplifycompositelit"
"golang.org/x/tools/gopls/internal/lsp/analysis/simplifycompositelit"
)

func Test(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/simplifyrange"
"golang.org/x/tools/gopls/internal/lsp/analysis/simplifyrange"
)

func Test(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/simplifyslice"
"golang.org/x/tools/gopls/internal/lsp/analysis/simplifyslice"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/undeclaredname"
"golang.org/x/tools/gopls/internal/lsp/analysis/undeclaredname"
)

func Test(t *testing.T) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/unusedparams"
"golang.org/x/tools/gopls/internal/lsp/analysis/unusedparams"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/unusedvariable"
"golang.org/x/tools/gopls/internal/lsp/analysis/unusedvariable"
)

func Test(t *testing.T) {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"testing"

"golang.org/x/tools/go/analysis/analysistest"
"golang.org/x/tools/internal/lsp/analysis/useany"
"golang.org/x/tools/gopls/internal/lsp/analysis/useany"
"golang.org/x/tools/internal/typeparams"
)

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/internal/analysisinternal"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/lsp/debug/tag"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/memoize"
"golang.org/x/tools/internal/span"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (

"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/lsp/debug/tag"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/memoize"
"golang.org/x/tools/internal/span"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"golang.org/x/tools/go/ast/astutil"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/lsp/bug"
"golang.org/x/tools/internal/lsp/debug/tag"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/bug"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/memoize"
"golang.org/x/tools/internal/packagesinternal"
"golang.org/x/tools/internal/span"
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import (
"golang.org/x/tools/go/analysis"
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/analysisinternal"
"golang.org/x/tools/internal/lsp/bug"
"golang.org/x/tools/internal/lsp/command"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/bug"
"golang.org/x/tools/gopls/internal/lsp/command"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/span"
"golang.org/x/tools/internal/typesinternal"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package cache
import (
"sort"

"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/span"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"golang.org/x/tools/internal/event/keys"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/imports"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/gopls/internal/lsp/source"
)

type importsState struct {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"golang.org/x/tools/go/packages"
"golang.org/x/tools/internal/event"
"golang.org/x/tools/internal/gocommand"
"golang.org/x/tools/internal/lsp/debug/tag"
"golang.org/x/tools/internal/lsp/protocol"
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/internal/event/tag"
"golang.org/x/tools/gopls/internal/lsp/protocol"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/packagesinternal"
"golang.org/x/tools/internal/span"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package cache

import (
"golang.org/x/tools/internal/lsp/source"
"golang.org/x/tools/gopls/internal/lsp/source"
"golang.org/x/tools/internal/persistent"
"golang.org/x/tools/internal/span"
)
Expand Down
Loading

0 comments on commit b15dac2

Please sign in to comment.