mirror of https://github.com/golang/go.git
For use-cases that work only with token.Pos and protocol.Position, the span package is unnecessarily indirect, and inefficient. It also loses information about newline termination, and handles positions within CRLF line endings incorrectly. The lsppos package was written to bypass this complexity, but had limited use and lacked tests. Add tests, and an wrapper API that operates on token.Pos. Also fix source.TestTokenOffset to not panic, and add a temporary exemption of the new token.Offset usage. This change also fixes position calculation in the case of empty file content. The mapper now finds position (0, 0) at offset 0 of an empty file. Change-Id: I639bd3fac78a127b1c8eddad60b890449901c68c Reviewed-on: https://go-review.googlesource.com/c/tools/+/403678 Reviewed-by: Alan Donovan <adonovan@google.com> Run-TryBot: Robert Findley <rfindley@google.com> gopls-CI: kokoro <noreply+kokoro@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> |
||
|---|---|---|
| .. | ||
| analysisinternal | ||
| apidiff | ||
| event | ||
| fakenet | ||
| fastwalk | ||
| gocommand | ||
| gopathwalk | ||
| imports | ||
| jsonrpc2 | ||
| jsonrpc2_v2 | ||
| lsp | ||
| memoize | ||
| packagesinternal | ||
| proxydir | ||
| span | ||
| stack | ||
| testenv | ||
| tool | ||
| typeparams | ||
| typesinternal | ||
| xcontext | ||