-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Properly set hasAction
for erasing modifiers in class member completions
#57643
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
As I said in #57480 (comment):
Meanwhile, this PR fixes what I tried to implement in #52525. |
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 still looking through the code, but the test cases look pretty good so far! I think we should add a case for #57333, since this PR also fixes it.
//b.ts
export type C = { x: number }
export interface ExtShape {
$arg(id: C ): Promise<number[]>;
$returnPromise(id: number): Promise<C>;
$return(id: number): C;
}
//test.ts
import { ExtShape } from './b';
abstract class ExtBase implements ExtShape {
public $/**/
}
src/services/completions.ts
Outdated
@@ -2054,11 +2070,13 @@ function getEntryForMemberCompletion( | |||
|
|||
function getPresentModifiers( | |||
contextToken: Node | undefined, | |||
previousToken: Node | undefined, |
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.
you could avoid having to pass previousToken
here like this: Andarist@4721fbd
note that this commit reverts changes to getPresentModifiers
and introduces changes (slightly adjusted) from #57480 . I think that your version might have some further readability improvements but I just skipped merging your changes into this. If you like the core of the proposed change - I can incorporate your changes into this and open a PR targeting your branch
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.
Does that work because the case where previousToken
is not the same as contextToken
is the same as when contextToken.parent.name !== contextToken
?
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 believe so, yes.
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.
Thank you and @Andarist for investigating and fixing this!
Fixes #57301.
Also fixes #57333.
@iisaduan pointed out that class member completions were always duplicating modifiers (any modifiers, not just
async
).To update on my last comment on the original PR for dealing with modifiers in class member completions, the current behavior (with this fix) is:
Example:
becomes, after accepting completion for
prop
: