go/internal/span
Robert Findley ea608150c3 internal/lsp: use the correct converter for mapped range offsets
CL 405546 introduced a latent bug in MappedRange, because it naively
used the wrong TokenConverter to convert mapped positions to offsets.
This was detected via related clean-up work in another CL. Fix this by
passing the correct converter from MappedRange.Range. Add a test that
would have demonstrated the breakage.

More cleanup is needed here. It is subtle that MappedRange.Converter
maps the adjusted position for its start and end, and there may be some
places where this invariant has been broken over the years.

Add additional documentation and bug reports.

Change-Id: If7f177894bac1242ddcc1786e79c7559455e9291
Reviewed-on: https://go-review.googlesource.com/c/tools/+/407887
Run-TryBot: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
2022-06-01 15:32:54 +00:00
..
parse.go internal/lsp/cache: parse filenames from go list errors correctly 2021-03-02 01:39:30 +00:00
span.go internal/span: eliminate Converter and FileConverter 2022-05-17 16:08:12 +00:00
span_test.go internal/span: eliminate Converter and FileConverter 2022-05-17 16:08:12 +00:00
token.go internal/lsp: use the correct converter for mapped range offsets 2022-06-01 15:32:54 +00:00
token_test.go internal/span: eliminate Converter and FileConverter 2022-05-17 16:08:12 +00:00
uri.go internal/span: fix a comment about windows drive letters 2021-08-03 19:59:22 +00:00
uri_test.go all: go fmt ./... 2021-02-20 03:28:52 +00:00
uri_windows_test.go all: go fmt ./... 2021-02-20 03:28:52 +00:00
utf16.go internal/span: compute utf16 length directly 2021-05-20 14:08:36 +00:00
utf16_test.go internal/span: remove check for nil content 2020-09-02 00:13:12 +00:00