diff options
author | Rebecca Stambler <rstambler@golang.org> | 2019-11-20 16:38:43 -0500 |
---|---|---|
committer | Rebecca Stambler <rstambler@golang.org> | 2019-11-21 02:33:28 +0000 |
commit | 35ba81b9fb229f4181c1b2cbc257602955e295c3 (patch) | |
tree | 72d9323676f8afa7d511f611f793daf2af0b4542 /internal/lsp/references.go | |
parent | 8fd459516a2706101a9588f3273f7767a54f61b2 (diff) | |
download | golang-x-tools-35ba81b9fb229f4181c1b2cbc257602955e295c3.tar.gz |
internal/lsp: reorganize and refactor code
This change cleans up internal/lsp/source/view.go to have a more logical
ordering and deletes the view.CheckPackageHandle function. Now, the only
way to get a CheckPackageHandle is through a snapshot (so all of the
corresponding edits).
Also, renamed fuzzy tests to fuzzymatch. Noticed this weird error when
debugging - I had golang.org/x/tools/internal/lsp/fuzzy in my module
cache and it conflicted with the test version.
Change-Id: Ib87836796a8e76e6b6ed1306c2a93e9a5db91cce
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208099
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Diffstat (limited to 'internal/lsp/references.go')
-rw-r--r-- | internal/lsp/references.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/lsp/references.go b/internal/lsp/references.go index a29203551..9d831b5c8 100644 --- a/internal/lsp/references.go +++ b/internal/lsp/references.go @@ -20,12 +20,13 @@ func (s *Server) references(ctx context.Context, params *protocol.ReferenceParam if err != nil { return nil, err } + snapshot := view.Snapshot() f, err := view.GetFile(ctx, uri) if err != nil { return nil, err } // Find all references to the identifier at the position. - ident, err := source.Identifier(ctx, view, f, params.Position) + ident, err := source.Identifier(ctx, snapshot, f, params.Position) if err != nil { return nil, err } |