-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[CodeCompletion] Suggest 'actor' decl introducer keyword #58698
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
Previously 'actor' keyword was suggested as (deprecated) 'actor' decl modifier, and it was gated by '-enable-experimental-concurrency' compiler argument. Add 'actor' as a type decl introducer. This causes duplicated 'actor' in code completion if '-enable-experimental-concurrency', but that option is basically useless at this point, so I assume not many people is using it. Also 'actor' as a modifier will be removed soon. [swiftlang#58520] rdar://92511769
@swift-ci Please smoke test |
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.
One minor suggestion inline.
}; | ||
|
||
#define DECL_KEYWORD(kw) \ | ||
AddDeclKeyword(#kw, CodeCompletionKeywordKind::kw_##kw, None); | ||
#include "swift/Syntax/TokenKinds.def" | ||
// Manually add "actor" because it's a contextual keyword. | ||
AddDeclKeyword("actor", CodeCompletionKeywordKind::None, None); |
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.
Wouldn’t it be simpler to remove the special case in AddDeclKeyword
and change this
AddDeclKeyword("actor", CodeCompletionKeywordKind::None, None); | |
AddDeclKeyword("actor", CodeCompletionKeywordKind::kw_class, None); |
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 wasn't 100% sure we can emit actor
as CodeCompletionKeywordKind::kw_class
. WDYT?
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.
Isn’t that exactly what you’re doing in line 783-784? Or am I missing something?
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.
No, I'm not rewriting the Kind
, but I'm just using kw_class
to get the flair for actor
.
Using kw_class
results
Keyword[class]/None: actor
instead of
Keyword/None: actor
I admit CodeCompletionKeywordKind is not used in many place, but for example, CodeCompletion::LimitedResultView
has an ability to filter the results by the kind.
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.
Ah, I see. I that case forget what I said.
Could we also do this for |
@ktoso Code completion should already be emitting |
Previously
actor
keyword was suggested as (deprecated)actor
decl modifier, and it was gated by-enable-experimental-concurrency
compiler argument.Add
actor
as a type decl introducer. This causes duplicatedactor
in code completion if-enable-experimental-concurrency
, but that option is basically useless at this point, so I assume not many people is using it. Alsoactor
as a modifier will be removed soon.[#58520] rdar://92511769