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
Add code action to create missing operation variable #4680
base: main
Are you sure you want to change the base?
Add code action to create missing operation variable #4680
Conversation
@@ -244,53 +282,3 @@ fn create_code_action( | |||
..Default::default() | |||
}) | |||
} | |||
|
|||
#[cfg(test)] | |||
mod tests { |
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.
TODO: Re-add this test and tests for the new functionality
pub struct ValidationDiagnosticCode; | ||
|
||
impl ValidationDiagnosticCode { | ||
pub const EXPECTED_OPERATION_VARIABLE_TO_BE_DEFINED: i32 = 1; |
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.
I'm not a fan of this being just an integer. Since the diagnostic code is also shown in the LSP client, ideally it would be something like relay001
. But having a string here will likely mean that we can no longer pattern match. Still thinking on a better solution here. Pointers are very welcome :)
Depends on #4679
This extends the
ExpectedOperationVariableToBeDefined
error to include the variable name and type in the diagnostic data. Using this data we create a code action that appends the missing variable with the correct type to the operation variables.