diff options
author | Robert Findley <rfindley@google.com> | 2022-05-11 13:23:02 -0400 |
---|---|---|
committer | Robert Findley <rfindley@google.com> | 2022-05-17 16:08:12 +0000 |
commit | facb0d30e9e8a14e6e9b3f3df1f49b003391d5f4 (patch) | |
tree | 97d89e81e8d91779bf58480c9f2f5f3ba2797c1b /internal/lsp/cache/parse.go | |
parent | 814e0d74b53fe2868d6050d4fc1262e02a4aba8e (diff) | |
download | golang-x-tools-facb0d30e9e8a14e6e9b3f3df1f49b003391d5f4.tar.gz |
internal/span: eliminate Converter and FileConverter
The only real implementation of position conversion was via a
*token.File, so refactor the converter logic to eliminate the Converter
interface, and just use a single converter implementation that uses a
*token.File to convert between offsets and positions.
This change is meant to be a zero-impact refactoring for non-test code.
As such, I abstained from panicking in several places where it would
make sense. In later CLs, once the bug reporting API lands, we can
insert bug reports in these places.
Change-Id: Id2e503acd80d089bc5d73e983215784015471f04
Reviewed-on: https://go-review.googlesource.com/c/tools/+/405546
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'internal/lsp/cache/parse.go')
-rw-r--r-- | internal/lsp/cache/parse.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/internal/lsp/cache/parse.go b/internal/lsp/cache/parse.go index d6c4bc06e..5d751ebe5 100644 --- a/internal/lsp/cache/parse.go +++ b/internal/lsp/cache/parse.go @@ -324,7 +324,7 @@ func parseGo(ctx context.Context, fset *token.FileSet, fh source.FileHandle, mod Tok: tok, Mapper: &protocol.ColumnMapper{ URI: fh.URI(), - Converter: span.NewTokenConverter(fset, tok), + Converter: span.NewTokenConverter(tok), Content: src, }, ParseErr: parseErr, |