Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP: Auto import of types in code completion fixed. #4291

Merged
merged 1 commit into from Jun 29, 2022

Conversation

dbalek
Copy link
Contributor

@dbalek dbalek commented Jun 28, 2022

SourceUtils.resolveImport(...) used to prevent clashes in import statements introduced by code completion.
However, using of SourceUtils.resolveImport(...) has a side-effect: in addition to rewrite(oldTree, newTree) modifications, it also modifies importScopes data structures (in order to work reliably if called repeatedly within a single task). Usually in NB, every ModificationTask is followed by commit() on ModificationResult produced. This call changes the underlying document which invalidates the corresponding Source, so it has to re-parsed for using in the next task (instead of using the cached parser result with corrupted scopes). However in NBLS, only diffs are taken from the ModificationResult and sent to client side for handling (without calling commit()). That is why the corresponding Source has to be invalidated explicitly.

@dbalek dbalek added the LSP [ci] enable Language Server Protocol tests label Jun 28, 2022
@dbalek dbalek added this to the NB15 milestone Jun 28, 2022
@dbalek dbalek requested review from jlahoda, ppisl and sdedic June 28, 2022 12:36
@dbalek dbalek merged commit 4792fcf into apache:master Jun 29, 2022
@dbalek dbalek deleted the dbalek/lsp-cc-auto-import-fix branch June 29, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LSP [ci] enable Language Server Protocol tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants