x/tools/gopls: unimported imports don't work with empty selector #35915
Comments
Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here. |
Looks like more your bag, it's failing during parsing and never running any completion code at all, I think?
|
I don't think so, because we ignore errors in parsing as long as we get an AST back. I think regular completions work fine in this case. |
Completion in general works in this case since you get a parser error, but you also get a best effort *ast.File. The root of the issue seemed to be in |
You're both right, of course. CL mailed. |
Change https://golang.org/cl/209579 mentions this issue: |
I'm noticing what seems to be the same problem if the empty selector is right before a keyword on the next line.
|
Do you have a repro? It seems to work normally for me with a keyword on the next line. |
Yeah. Using gopls built at 7a2a8a, inserting |
I think the basic gist of this is that I'm not using |
I don't think any of the AST fixups touch the import spec, but maybe it's worth trying this out? |
At the time I had the problem, I was always parsing the whole file. Now I only need to do that when there's no imports yet, but I imagine the problem would still happen. |
I think this is resolved now. Please re-open if you disagree. |
In code like:
I expected to get candidates from "context" but I get nothing.
/cc @heschik
The text was updated successfully, but these errors were encountered: