Skip to content

[SourceKit] Add an operator syntax kind #60210

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
Aug 2, 2022

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented Jul 24, 2022

This will allow us to do semantic highlighting for operators in SourceKit-LSP.

swiftlang/sourcekit-lsp#595

@ahoppen ahoppen requested a review from rintaro July 24, 2022 11:53
@ahoppen
Copy link
Member Author

ahoppen commented Jul 24, 2022

@swift-ci Please smoke test

rintaro
rintaro previously approved these changes Jul 24, 2022
@@ -231,9 +231,18 @@ SyntaxModelContext::SyntaxModelContext(SourceFile &SrcFile)
break;

case tok::oper_prefix:
if (Tok.getText() == "-")
if (Tok.getText() == "-") {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (Tok.getText() == "-") {
if (Tok.getText() == "-" && I != E &&
(Tokens[I+1].getKind() == tok::integer_literal ||
Tokens[I+1].getKind() == tok::floating_literal)) {

So that prefix - for non-numeric literals are classified as Operator

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Thanks 👍

@rintaro rintaro dismissed their stale review July 24, 2022 14:02

Mis-approved

@ahoppen ahoppen force-pushed the pr/operator-syntax-kind branch from cdf47e1 to 8c70a8a Compare July 25, 2022 05:10
This will allow us to do semantic highlighting for operators in SourceKit-LSP.
@ahoppen ahoppen force-pushed the pr/operator-syntax-kind branch from 8c70a8a to a7dcd46 Compare July 25, 2022 05:20
@ahoppen
Copy link
Member Author

ahoppen commented Jul 25, 2022

@swift-ci Please smoke test

@ahoppen ahoppen merged commit fa75cfb into swiftlang:main Aug 2, 2022
@ahoppen ahoppen deleted the pr/operator-syntax-kind branch August 2, 2022 17:33
ahoppen added a commit to ahoppen/sourcekit-lsp that referenced this pull request Aug 12, 2022
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.

2 participants