-
Notifications
You must be signed in to change notification settings - Fork 264
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
feat: quickFix for enum, const, property #900
base: main
Are you sure you want to change the base?
feat: quickFix for enum, const, property #900
Conversation
@@ -221,7 +225,7 @@ export class YamlCodeActions { | |||
const results: CodeAction[] = []; | |||
for (const diagnostic of diagnostics) { | |||
if (diagnostic.code === 'flowMap' || diagnostic.code === 'flowSeq') { | |||
const node = getNodeforDiagnostic(document, diagnostic); | |||
const node = getNodeForDiagnostic(document, diagnostic); |
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.
just typo
endCharacter, | ||
severity, | ||
source, | ||
code |
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.
just code added to parameters
@@ -1385,6 +1387,7 @@ function validate( | |||
length: propertyNode.keyNode.length, | |||
}, | |||
severity: DiagnosticSeverity.Warning, | |||
code: ErrorCode.PropertyExpected, |
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.
not sure if it wouldn't be better to unify data.properties
to data.values
for the incorrect property
1bffa52
to
d6718e4
Compare
Hello @msivasubramaniaan, can I ask you for a review, please? |
Array.isArray((diagnostic.data as YamlDiagnosticData).values) | ||
) { | ||
return (diagnostic.data as YamlDiagnosticData).values; | ||
} else if ( |
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.
Is this else really needed?
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.
Do you mean quickFix for properties? or can you explain your point further?
- I think that property quickFix can be useful
- note that there are different property names in
diagnostic.data
object (values
vsproperties
)
for (const value of values) { | ||
results.push( | ||
CodeAction.create( | ||
value, |
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 returns only the value which is not very descriptive of the operation. perhaps we can replace it with something like
value, | |
`Use value "${value}"`, |
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 don't have preferences here, I can remember that I tried a few combinations but I ended up with only {value}
.
I was inspired by the English spelling checker extension (Code Spell Checker extension)
small disadvantage of Use value "${value}"
is that this PR adds quickfix also for properties of the object (not value), so we need to display the text based on the error type
- but for sure it's not a problem
so please make a decision
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.
Only a couple of minor comments. It also needs to be rebased.
d6718e4
to
77bf8bc
Compare
@gorkem any updates here, please? |
77bf8bc
to
5baa96e
Compare
@p-spacek Please upstream the branch |
@msivasubramaniaan I merged the main into this PR, but there is some schema change that caused the test to fail:
UPDATE: I pushed the test fix for this schema rename |
…com/rh-yaml-language-server into feat/quick-fix-enum-const-property
What does this PR do?
add quick fix code-action for enums, consts, properties
What issues does this PR fix or reference?
no ref
Is it tested? How?
tests