@ConfigProperty code action when property is not set#167
Conversation
7572fac to
953f698
Compare
|
Ok now I support insert defaultValue attribute in Java file and insert property inside available properties files. Here a demo: Please note that when you use properties code action, you need to save the file at hand (I don't know how to do that with code action). You can start to play with my PR and review it, but I need to:
|
c71cbb4 to
7363caf
Compare
|
In this PR I migrat eto LSP4J 0.11.0 because I'm using Diagnostic#data. Please note that this PR requires too redhat-developer/vscode-microprofile#68 which migrate to vascode-languageclient 0.7.0 to use Diagnostic#data too. |
7363caf to
cbe4f69
Compare
816b266 to
9bba076
Compare
|
I wrote tests, this PR can be reviewed now. |
4bbcbd5 to
4ae38ed
Compare
|
Overall things look good. I just want to go over |
97b0ea4 to
5847a94
Compare
Ok I'm waiting for your feedback.
Yes it can be annoying but I don't know how to save with a standard command the file. |
rgrunber
left a comment
There was a problem hiding this comment.
Overall, this works for me. Only one small issue maybe worth addressing, and I just commented on why linked proposals likely aren't doing anything, but would be good to keep for future compatibility.
Feel free to merge when ready.
| if (lineSeparator == null) { | ||
| lineSeparator = System.lineSeparator(); | ||
| } | ||
| String propertyName = getPropertyName(diagnostic, context); |
There was a problem hiding this comment.
I noticed the code action shows up even when name is empty. (eg. @ConfigProperty(name=""). Is it worth check for empty here to avoid this ? Generating just an = in the file seemed a bit odd.
Note that we can't just silence the diagnostic because inserting defaultValue is still valid.
There was a problem hiding this comment.
@rgrunber after playing with Quarkus application,it seems that @ConfigProperty(name="") is not allowed:
It means that we should report an another diagnostic message for this usecase with a code=null instead of NO_VALUE_ASSIGNED_TO_PROPERTY and the problem will be fixed. I created the issue for that #176 which will fix your comment below.
There was a problem hiding this comment.
Bah, I was hoping it wouldn't be required, and we could get away with just silencing that code action, but fair enough.
5847a94 to
5d86369
Compare
Fixes eclipse-lsp4mp#147 Signed-off-by: azerr <azerr@redhat.com>



@ConfigProperty code action when property is not set
Fixes #147
Signed-off-by: azerr azerr@redhat.com