1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:14:43 -07:00
go/internal/lsp/cache
Muir Manders 9f716520f4 internal/lsp/cache: improve completion in init statements
In cases like:

  if i := foo<>

we get an *ast.BadExpr because the parser is expecting the condition
expression, but "i := foo" is not a valid expression. Now we move the
statement into the "init" field and add a dummy "cond" expression.

We also needed a slight tweak to our missing curly brace fix. Now we
insert an extra semicolon in cases like:

for i := 0; i < foo

yielding

for i := 0; i < foo;{}

The parser doesn't like having only two clauses in the three clause
"for" statement.

Updates golang/go#31687.

Change-Id: I12d51e0d8af03436741227753f8e71452a463b05
Reviewed-on: https://go-review.googlesource.com/c/tools/+/216483
Run-TryBot: Muir Manders <muir@mnd.rs>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-02-13 18:11:06 +00:00
..
analysis.go internal/lsp/cache: hardcode parse modes instead of guessing them 2020-02-07 20:00:15 +00:00
cache.go internal/lsp/debug: serve cache entry counts 2020-02-03 22:21:18 +00:00
check.go internal/lsp/cache: add file contents to ParseGoHandle 2020-02-13 05:05:14 +00:00
debug.go internal/lsp/cache: add Env to debugView 2020-01-31 20:48:24 +00:00
error_test.go internal/lsp: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
errors.go internal/lsp/cache: add file contents to ParseGoHandle 2020-02-13 05:05:14 +00:00
external.go internal/lsp: check that a file handle is unmodified before read 2020-01-23 20:52:07 +00:00
load.go internal/lsp/cache: hardcode parse modes instead of guessing them 2020-02-07 20:00:15 +00:00
mod_tidy.go internal/lsp: build overlays through the snapshot 2020-02-07 18:37:49 +00:00
parse.go internal/lsp/cache: improve completion in init statements 2020-02-13 18:11:06 +00:00
pkg.go internal/lsp/cache: add file contents to ParseGoHandle 2020-02-13 05:05:14 +00:00
session.go internal/lsp: propagate file invalidations to all views 2020-02-11 18:37:05 +00:00
snapshot.go internal/lsp/cache: add file contents to ParseGoHandle 2020-02-13 05:05:14 +00:00
view.go internal/lsp: turn tempModfile flag on by default 2020-02-13 15:33:58 +00:00