Skip to content

[5.2][CodeCompletion] Enable fast completion within accessors #29251

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jan 16, 2020

Cherry-pick of #29245 into swift-5.2-branch

  • Explanation: Fast completion inside accessors didn't work because it used to fail to find the equivalent decl from the SourceFile. It used to fallback to normal completion. That was because AST and DeclContext tree have different hierarchy for AccessorDecls. This patch enables fast-completion in accessor decls by specially handling AccessorDecl when finding them from the SourceFile.
  • Scope: Code completion
  • Risk: Low (The functionality is not enabled by default)
  • Issue: rdar://problem/58632889
  • Testing: Added regression test cases
  • Reviewer: Ben Langmuir (@benlangmuir)

'getEquivalentDeclContextFromSourceFile()' didn't work for accessors
because DeclContext hierarchy and AST hierarhy are not the same.

AST hierarchy:
    (TypeDecl or SourceFile) > AbstractStorageDecl > AccessorDecl
DeclContext hierarchy:
    (TypeDecl or SourceFile) > AccessorDecl

Handle them specially.

rdar://problem/58632889
(cherry picked from commit 3018b55)
Gracefully give up finding equivalent decl contxt if something goes wrong.

(cherry picked from commit 9b1212b)
@rintaro rintaro requested a review from a team as a code owner January 16, 2020 18:09
@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2020

@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Jan 16, 2020

@swift-ci Please nominate

@rintaro rintaro merged commit 3194881 into swiftlang:swift-5.2-branch Jan 16, 2020
@rintaro rintaro deleted the 5.2-ide-completion-fastaccessor-rdar58632889 branch January 16, 2020 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants