-
Notifications
You must be signed in to change notification settings - Fork 245
feat(typescript): type and interface as @parameter.*
#779
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
Conversation
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.
Pull Request Overview
This PR introduces new query patterns to recognize TypeScript type and interface property signatures as parameters.
- Added queries for @parameter.inner on property signatures.
- Added multiple patterns for @parameter.outer to handle object_type and interface_body constructs with varying separator placements.
| ([ | ||
| (object_type | ||
| "," @_start | ||
| . | ||
| (property_signature) @_end) | ||
| (interface_body | ||
| "," @_start | ||
| . | ||
| (property_signature) @_end) | ||
| ] | ||
| (#make-range! "parameter.outer" @_start @_end)) | ||
|
|
||
| ([ | ||
| (object_type | ||
| (property_signature) @_start | ||
| . | ||
| "," @_end) | ||
| (interface_body | ||
| (property_signature) @_start | ||
| . | ||
| "," @_end) | ||
| ] | ||
| (#make-range! "parameter.outer" @_start @_end)) | ||
|
|
||
| ([ | ||
| (object_type | ||
| ";" @_start | ||
| . | ||
| (property_signature) @_end) | ||
| (interface_body | ||
| ";" @_start | ||
| . | ||
| (property_signature) @_end) | ||
| ] | ||
| (#make-range! "parameter.outer" @_start @_end)) | ||
|
|
||
| ([ | ||
| (object_type | ||
| (property_signature) @_start | ||
| . | ||
| ";" @_end) | ||
| (interface_body | ||
| (property_signature) @_start | ||
| . | ||
| ";" @_end) | ||
| ] | ||
| (#make-range! "parameter.outer" @_start @_end)) |
Copilot
AI
Jun 14, 2025
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.
The comma/semicolon separator patterns for object_type and interface_body are duplicated. Consider refactoring or adding clarifying comments to explain the necessity for the similar blocks to improve maintainability.
| ([ | |
| (object_type | |
| "," @_start | |
| . | |
| (property_signature) @_end) | |
| (interface_body | |
| "," @_start | |
| . | |
| (property_signature) @_end) | |
| ] | |
| (#make-range! "parameter.outer" @_start @_end)) | |
| ([ | |
| (object_type | |
| (property_signature) @_start | |
| . | |
| "," @_end) | |
| (interface_body | |
| (property_signature) @_start | |
| . | |
| "," @_end) | |
| ] | |
| (#make-range! "parameter.outer" @_start @_end)) | |
| ([ | |
| (object_type | |
| ";" @_start | |
| . | |
| (property_signature) @_end) | |
| (interface_body | |
| ";" @_start | |
| . | |
| (property_signature) @_end) | |
| ] | |
| (#make-range! "parameter.outer" @_start @_end)) | |
| ([ | |
| (object_type | |
| (property_signature) @_start | |
| . | |
| ";" @_end) | |
| (interface_body | |
| (property_signature) @_start | |
| . | |
| ";" @_end) | |
| ] | |
| (#make-range! "parameter.outer" @_start @_end)) | |
| ; Define a reusable macro for handling separators (comma/semicolon) and property_signature | |
| (defmacro separator_pattern (separator) | |
| ([ | |
| (object_type | |
| separator @_start | |
| . | |
| (property_signature) @_end) | |
| (interface_body | |
| separator @_start | |
| . | |
| (property_signature) @_end) | |
| ] | |
| (#make-range! "parameter.outer" @_start @_end))) | |
| ; Use the reusable macro for comma separator | |
| (separator_pattern ",") | |
| ; Use the reusable macro for semicolon separator | |
| (separator_pattern ";") |
Addresses #86 (comment)