Skip to content

Implement editor placeholder parsing logic in SwiftSyntax #2878

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
Oct 11, 2024

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Oct 9, 2024

So it can be used from other clients.

  • RawEditorPlaceholderData(syntaxText:) Parse a placeholder text <#...#> and instantiate SwiftSyntax.RawEditorPlaceholderData.
  • RawEditorPlaceholderData holds the parsed data, similar to C++ compiler's EditorPlaceholderData

@rintaro
Copy link
Member Author

rintaro commented Oct 9, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test

}

@_spi(RawSyntax)
public func parseEditorPlaceholder(syntaxText: SyntaxText) -> RawEditorPlaceholderData? {
Copy link
Member

Choose a reason for hiding this comment

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

Should this be an initializer on RawEditorPlaceholderData?

Copy link
Member Author

Choose a reason for hiding this comment

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

Made this function private and introduced RawEditorPlaceholderData.init?(syntaxText:)

case typed(text: Substring, type: TypeSyntax)
private struct EditorPlaceholderExpansionData {
let displayText: String
let type: TypeSyntax?
Copy link
Member

Choose a reason for hiding this comment

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

Should this be typeForExpansion to match the member name in RawEditorPlaceholderExpansionData?

@rintaro rintaro force-pushed the raw-editor-placeholder branch from cdb1228 to 7cde6c3 Compare October 10, 2024 01:58
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test

@rintaro rintaro force-pushed the raw-editor-placeholder branch from 7cde6c3 to 58a2cbb Compare October 10, 2024 02:08
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test

@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test Windows

@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

1 similar comment
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

So it can be used from other clients.
@rintaro rintaro force-pushed the raw-editor-placeholder branch from 58a2cbb to d908703 Compare October 10, 2024 11:51
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test macOS

@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test Linux

@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test Windows

1 similar comment
@rintaro
Copy link
Member Author

rintaro commented Oct 10, 2024

swiftlang/sourcekit-lsp#1746
@swift-ci Please test Windows

@rintaro rintaro merged commit 054f108 into swiftlang:main Oct 11, 2024
3 checks passed
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