Skip to content
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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

tobias-tengler
Copy link
Contributor

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.

@@ -244,53 +282,3 @@ fn create_code_action(
..Default::default()
})
}

#[cfg(test)]
mod tests {
Copy link
Contributor Author

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;
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'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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants