1
0
mirror of https://github.com/golang/go synced 2024-11-19 00:04:40 -07:00
go/internal/lsp
Muir Manders 920acffc3e internal/lsp: fix bad *ast.ArrayTypes for completion
Currently array and slice literals don't work very well for
completion. When go/parser is not expecting a type, it often turns
array types (e.g. "[]int") into *ast.BadExpr, which messes up
completion because we can't figure out the prefix from *ast.BadExpr,
and *ast.BadExprs don't get type checked.

This change addresses the first problem of not being able to figure
out the prefix. If we see an *ast.BadExpr, we now blindly try to
reparse it as a composite literal by adding on "{}". If we end up with
an *ast.CompositeLit with an *ast.ArrayType "Type", we swap
the *ast.BadExpr for the *ast.ArrayType. This approach is dumb but
simple, and fixes lexical completions in array types.

Change-Id: Ifa42e646bcbf2a30170d73e6dd11982384d40b43
Reviewed-on: https://go-review.googlesource.com/c/tools/+/197437
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-17 20:53:01 +00:00
..
browser internal/lsp: add version and bug commands 2019-05-11 04:16:02 +00:00
cache internal/lsp: fix bad *ast.ArrayTypes for completion 2019-10-17 20:53:01 +00:00
cmd internal/lsp: add a test to make sure we handle bad imports 2019-10-17 20:52:05 +00:00
debug internal/lsp: address staticcheck warnings 2019-10-04 02:16:23 +00:00
diff internal/lsp: fix unified diffs of edits at the end of a file 2019-10-11 16:38:14 +00:00
fuzzy internal/lsp: address staticcheck warnings 2019-10-04 02:16:23 +00:00
protocol internal/lsp: fix lsp trace log format for gopls 2019-10-16 17:14:07 +00:00
snippet all: fix broken links to LSP specification 2019-10-02 18:32:53 +00:00
source internal/lsp: add a test to make sure we handle bad imports 2019-10-17 20:52:05 +00:00
telemetry internal/lsp/cache: add additional spans for tracing 2019-09-05 21:33:45 +00:00
testdata internal/lsp: fix bad *ast.ArrayTypes for completion 2019-10-17 20:53:01 +00:00
tests internal/lsp: add a test to make sure we handle bad imports 2019-10-17 20:52:05 +00:00
code_action.go internal/lsp: return an error from {Narrowest,Widest}CheckPackageHandle 2019-10-11 16:51:06 +00:00
command.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
completion_test.go internal/lsp: lift the test loops out into the testing framework 2019-09-27 18:07:07 +00:00
completion.go internal/lsp: restore "IsIncomplete" completion flag 2019-10-04 02:16:33 +00:00
definition.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
diagnostics.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
folding_range.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
format.go internal/lsp: change to protocol.TextEdit for formatting 2019-09-06 17:54:09 +00:00
general.go internal/lsp/protocol: update to protocol version 3.15 2019-09-25 02:06:47 +00:00
highlight.go x/tools/gopls: convert to the august, 2019 version of the LSP protocol 2019-09-08 13:59:31 +00:00
hover.go internal/lsp: convert comments to markdown before sending to client 2019-10-04 18:35:38 +00:00
link.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
lsp_test.go internal/lsp: add a test to make sure we handle bad imports 2019-10-17 20:52:05 +00:00
references.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
rename.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
reset_golden.sh internal/lsp: fix regeneration of golden files 2019-09-25 13:16:59 +00:00
server.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
signature_help.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
symbols.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
text_synchronization.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
watched_files.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
workspace.go internal/lsp: merge session and view options into one 2019-09-11 19:36:49 +00:00