mirror of
https://github.com/golang/go
synced 2024-09-30 22:38:33 -06:00
2f0693cea3
In cases like: func _() { if fo<> } func foo() {} Completing at "<>" does not include "foo" because the missing "if" opening curly brace renders the rest of the file unparseable. "foo" doesn't exist in the AST, so as far as gopls is concerned it doesn't exist at all. To fix this, we detect when a block is missing opening "{" and we insert stub "{}" to make things parse better. This is a different kind of fix than our previous *ast.BadExpr handling because we must reparse the file after tweaking the source. After reparsing we maintain the original syntax error so the user sees consistent error messages. This also avoids having the "{}" spring into existence when the user formats the file. Fixes golang/go#31907. Updates golang/go#31687. Change-Id: I95ba60a11f7dd23dc484c063b4fd7ad77daa4e08 Reviewed-on: https://go-review.googlesource.com/c/tools/+/216482 Run-TryBot: Muir Manders <muir@mnd.rs> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org> |
||
---|---|---|
.. | ||
apidiff | ||
fastwalk | ||
gopathwalk | ||
imports | ||
jsonrpc2 | ||
lsp | ||
memoize | ||
packagesinternal | ||
span | ||
telemetry | ||
testenv | ||
tool | ||
xcontext |