-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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] Support completion for macro roles and the 'names:' argument label #65427
[CodeCompletion] Support completion for macro roles and the 'names:' argument label #65427
Conversation
3f412de
to
e4ddd96
Compare
@swift-ci Please test |
e4ddd96
to
d93185b
Compare
@swift-ci Please smoke test |
1 similar comment
@swift-ci Please smoke test |
d93185b
to
e9ad00a
Compare
@swift-ci Please smoke test |
case MacroRole::Expression: | ||
case MacroRole::Declaration: | ||
case MacroRole::Accessor: | ||
case MacroRole::MemberAttribute: | ||
case MacroRole::Member: | ||
case MacroRole::Peer: | ||
case MacroRole::Conformance: |
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.
It might not really matter, but there is "feature" flag for each macro roles e.g. CodeItemMacros
, FreestandingMacros
. Do we want to use them here perhaps?
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.
Oh, I am using it for codeItem
but I should also use them for freestanding declaration (and all the others even if the feature flags are off), you are right.
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.
OK, putting those behind a feature flag failed because then we can’t compile the stdlib anymore. I suspect that the issue is that the features are only enabled if we have swiftSwiftParser
but we don’t have that yet while building the stdlib during bootstrapping. I just reverted it to always enable non-codeItem macros – freestanding declaration macros don’t have a feature flag (rdar://108637367).
…arsing This is needed to be able to perform code completion inside `@freestanding` and `@attached`.
e9ad00a
to
0dff47a
Compare
@swift-ci Please smoke test |
…argument label rdar://108163121
0dff47a
to
6098a3c
Compare
@swift-ci Please smoke test |
This PR contains two preliminary commits:
ParserStatus
from attribute parsing through to decl parsing, otherwise we’re don’t know the delayed decl state in which we’re completing (for@available
parsing we got away without this by making the code completion token part of the declaration but that doesn’t work for the parser’s implementation of macro roles)codeItem
macros. Previously, it was perfectly fine to declarecodeItem
macros, you just couldn’t use them.And finally, we can hook things up to perform suggest macro roles and the
names:
label in macro attributes.rdar://108163121