Skip to content

Rename some SyntaxClassification #1998

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 11, 2023

Conversation

StevenWong12
Copy link
Contributor

Rename some SyntaxClassification and deprecate some out-of-date types.

@StevenWong12 StevenWong12 requested a review from ahoppen as a code owner August 4, 2023 14:45
@@ -269,7 +269,7 @@ public class ClassificationTests: XCTestCase {
assertClassification(
#"#sourceLocation(file: "x", line: 1)"#,
expected: [
ClassificationSpec(source: "#sourceLocation", kind: .poundDirective),
ClassificationSpec(source: "#sourceLocation", kind: .identifier),
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 think #sourceLocation being classified as .identifier makes more sense than .ifConfigDirective after the renaming. What do you think?

Copy link
Member

Choose a reason for hiding this comment

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

I think that keyword might be the best classification, actually.

  1. #sourceLocation is different than macros in that it modifies global state (namely the evaluation of #file and #line for all following lines)
  2. file and line are also classified as keywords
  3. It’s what we get by default, so it’s the least amount of work 😉

@StevenWong12
Copy link
Contributor Author

Here is the corresponding sourcekit-lsp pr. swiftlang/sourcekit-lsp#794

@@ -269,7 +269,7 @@ public class ClassificationTests: XCTestCase {
assertClassification(
#"#sourceLocation(file: "x", line: 1)"#,
expected: [
ClassificationSpec(source: "#sourceLocation", kind: .poundDirective),
ClassificationSpec(source: "#sourceLocation", kind: .identifier),
Copy link
Member

Choose a reason for hiding this comment

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

I think that keyword might be the best classification, actually.

  1. #sourceLocation is different than macros in that it modifies global state (namely the evaluation of #file and #line for all following lines)
  2. file and line are also classified as keywords
  3. It’s what we get by default, so it’s the least amount of work 😉

@StevenWong12 StevenWong12 force-pushed the rename_syntax_classification branch 2 times, most recently from 61c0e74 to 9621a00 Compare August 6, 2023 14:29
@ahoppen
Copy link
Member

ahoppen commented Aug 7, 2023

@StevenWong12 There’s a merge conflict. Could you rebase your PR?

@StevenWong12 StevenWong12 force-pushed the rename_syntax_classification branch from 9621a00 to d7caad1 Compare August 8, 2023 00:19
@ahoppen
Copy link
Member

ahoppen commented Aug 8, 2023

@swift-ci Please test

@ahoppen
Copy link
Member

ahoppen commented Aug 8, 2023

@swift-ci Please test Windows

@StevenWong12
Copy link
Contributor Author

Could you trigger the test with swiftlang/sourcekit-lsp#794 again?

@kimdv
Copy link
Contributor

kimdv commented Aug 10, 2023

swiftlang/sourcekit-lsp#794

@swift-ci please test

1 similar comment
@kimdv
Copy link
Contributor

kimdv commented Aug 10, 2023

swiftlang/sourcekit-lsp#794

@swift-ci please test

@ahoppen ahoppen merged commit 4294feb into swiftlang:main Aug 11, 2023
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