-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Migrate AccessorBeginning to solver-based #41922
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
[CodeCompletion] Migrate AccessorBeginning to solver-based #41922
Conversation
96b1cca
to
28fcdc1
Compare
@swift-ci Please SourceKit stress test |
@swift-ci Please smoke test |
lib/IDE/CodeCompletion.cpp
Outdated
if (!CodeCompleteTokenExpr) { | ||
// Happens when completing inside e.g. | ||
// var x: Int { | ||
// get { ... } | ||
// #^COMPLETE^# | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused. You modified parseGetSet
to pass the CodeCompletionExpr
. Is this reachable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't have a test case checking not suggesting expressions here, could you add some?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I did apparently fix the bug multiple times in incompatible ways. I updated the PR.
We basically have test cases to test we aren’t producing expressions in complete_accessor.swift
, where a lot of global results are disallowed in these places. The way it worked in this PR was that completion lookup simply failed completely and didn’t produce any results, which left us with the keyword results only.
lib/IDE/CodeCompletion.cpp
Outdated
assert(CurDeclContext); | ||
|
||
addKeywords(CompletionContext.getResultSink(), MaybeFuncBody); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should remove another addKeyword call below (Line 1426)
Also please remove the existing |
28fcdc1
to
fa98911
Compare
@swift-ci Please SourceKit stress test |
@swift-ci Please smoke test |
@swift-ci Please smoke test macOS |
lib/IDE/CodeCompletion.cpp
Outdated
if (!Lookup.gotCallback()) { | ||
Lookup.fallbackTypeCheck(CurDeclContext); | ||
if (CodeCompleteTokenExpr) { | ||
// Happens when completing inside e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Happens when completing inside e.g. | |
// 'CodeCompletionTokenExpr == nullptr' happens when completing inside e.g. |
because this is inside if (CodeCompeltionToken)
branch.
fa98911
to
8cd5bbd
Compare
@swift-ci Please smoke test |
Migrate code completion at the start of an accessor to solver-based.