Skip to content

[Completion] Only provide macro completions when they are valid #64986

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

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

bnbarham
Copy link
Contributor

@bnbarham bnbarham commented Apr 6, 2023

Only return macros that are valid in their current position, ie. an attached macro is not valid on a nominal.

Also return freestanding expression macros in code block item position and handle the new freestanding code item macros.

Resolves rdar://105563583.

@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 6, 2023

@swift-ci please test

@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 7, 2023

Ah that's annoying, warning/error are macros on MacOS but not on Linux/Windows (for obvious reasons).

@bnbarham bnbarham force-pushed the macro-completion branch 2 times, most recently from 584cc87 to 921b40d Compare April 7, 2023 20:49
@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 7, 2023

@swift-ci please test

Only return macros that are valid in their current position, ie. an
attached macro is not valid on a nominal.

Also return freestanding expression macros in code block item position
and handle the new freestanding code item macros.

Resolves rdar://105563583.
@bnbarham
Copy link
Contributor Author

bnbarham commented Apr 8, 2023

@swift-ci please test

@@ -1130,6 +1130,8 @@ static void addPoundDirectives(CodeCompletionResultSink &Sink) {
Builder.addSimpleTypedParameter("Int");
Builder.addRightParen();
});

#ifndef SWIFT_SWIFT_PARSER
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had originally removed this, but better to keep it for linux/windows for now. We can remove after SWIFT_SWIFT_PARSER is enabled in all the places.

@bnbarham bnbarham merged commit e5dbe30 into swiftlang:main Apr 8, 2023
@bnbarham bnbarham deleted the macro-completion branch April 8, 2023 18:08
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.

3 participants