-
Notifications
You must be signed in to change notification settings - Fork 238
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
chore(fmt/psl): update find at position w/ spans #4957
base: main
Are you sure you want to change the base?
Conversation
… until whatever comes next. This means we have a wider span to use for empty arguments and enables us to check for cursors that are where the ""value"" would be but there is no actual value yet. EnumValuePosition was manually calculating attribute positions, this has been removed - it now defers to the AttributePosition implementation. Updating the positions in `find_at_position` to also include spans Extracted out reference_locations_for_target to separate module in prep for other lsp commands (e.g. rename)
@@ -114,7 +114,7 @@ field_attribute = { "@" ~ path ~ arguments_list? } | |||
// ###################################### | |||
arguments_list = { "(" ~ (argument ~ ("," ~ argument)*)? ~ trailing_comma? ~ ")" } | |||
argument = _{ named_argument | empty_argument | expression } | |||
empty_argument = { identifier ~ ":" } |
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.
This allows us an empty argument span that includes all the whitespace until the next ,
or )
.
} | ||
|
||
impl<'ast> AttributePosition<'ast> { | ||
pub(crate) fn new(attr: &'ast ast::Attribute, position: usize) -> Self { | ||
let mut spans: Vec<(Option<&str>, ast::Span)> = attr |
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.
This is no longer necessary due to the addition of a whitespace inclusive span for empty args. We can just use contains now.
CodSpeed Performance ReportMerging #4957 will not alter performanceComparing Summary
|
WASM Query Engine file Size
|
Updated pest grammar for empty argument to include the whitespaces up until whatever comes next. This means we have a wider span to use for empty arguments and enables us to check for cursors that are where the ""value"" would be but there is no actual value yet.
EnumValuePosition was manually calculating attribute positions, this has been removed - it now defers to the AttributePosition implementation.
Updating the positions in
find_at_position
to also include spansExtracted out reference_locations_for_target to separate module in prep for other lsp commands (e.g. rename)