You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Quickfix for missing property in .properties / .yml editor #101
This used to work in the old editor. The quickfix would generate some .json metadata to 'define' the property and make the warning go away. The new LSP based editor doesn't have a quickfix for this case.
It would be nice to have an option to disable these warnings altogether so the "Problems" view doesn't get too filled up. Sometimes a project uses its own property keys which may be unknown to Spring Boot but are nevertheless valid properties.
@mathisdt That's a good point. The old/legacy version of the editor used to have a way to configure problem severity for different types of probems, setting the severity to 'ignore' would make those types of errors disapear completely.
So I agree we should bring something like this back in the new editor too.
I did want to react to something you said though.
Sometimes a project uses its own property keys which may be unknown to Spring Boot but are nevertheless valid properties.
If you defined the properties in the right way, using classes annotated with @ConfigurationProperties and using the spring boot 'configuration processor' then in theory your project's properties would work just the same is those built in with spring boot libraries. So they shouldn't cause 'unknown property' warnings. This would really be the best/ideal solution.
Now, I know there's probably all kinds of practical reasons why this wasn't done, can't be done, is too much work to do, not yet done, etc. So I still take your point that it would be a good idea for the editor to provide some mechanic for users to disable these warnings.
@krisde this seems to be "unknown" property quick fix rather than "missing" property quick fix issue. Is that correct? In other words the quick fix adding pom content to generate properties metadata json is missing. Is that right?
We should also integrate an easy way to configure the problem severity, so that people could select "ignore" or something like this for this warning (in general).
We should also integrate an easy way to configure the problem severity, so that people could select "ignore" or something like this for this warning (in general).
WE used to have this in STS 3. But its one of the features that wasn't re-implemented in the language server context. The architecture however is still such that problem severities are decoupled from problem types so that it shouldn't be too hard to get this working again.
The main difficulty is, probably, that this kind of 'configuration' will have to be done via LSP configuration keys. I think this is complex enough that we should treat this as a separate issue ticket.
Fixed but both LSP4E and VSCode don't save documents edited when Workspace Edit is performed. Therefore, the json file is opened in the editor but not saved. All need to be saved then the warning goes away.
LSP4E has this bug currently: https://bugs.eclipse.org/bugs/show_bug.cgi?id=543435 Doesn't allow to make text edits to files that don't exists eventhough previous change from the workspace edit creates this file. This should be fixed rather soon.
(comment in Pivotal Tracker added by Martin Lippert:)
I switched this back to "finished" state due to the fact that there is no way to actually test this for acceptance. As soon as the related bug in LSP4E is fixed, we can push this forward to delivered.
(comment in Pivotal Tracker added by Martin Lippert:)
I also noticed that the quick fix for this is NOT active when you press Cmd-1 while being on the beginning of the line, you have to move the cursor to the second character for the quick fix to show up.
@mlippert VSCode can be tried... Looks though that the LSP4E would handle workspace edit better than VSCode, i.e. saving the edited files that were not opened in the editor. The fix for LSP4E is under construction still unfortunately - I thought it'd be more straight-forward.
Martin! The above behaviour comes from common valid prefix. For example my property in the file spring.pp. It is unknown property. The closest known property is spring.profiles.active. The common known prefix spring.p therefore and hence only the last p of spring.pp in underlined and quick fix shown. I believe that is expected and has been in our editor for a while. I have asked Kris as well to confirm, but I'd say this is expected at the moment.
(comment in Pivotal Tracker added by Martin Lippert:)
OK, I think I understand the behavior now in more detail, seems to be indeed the case that I hit.
However, I find it somewhat counter-intuitive from the user point of view that when I type something in like:
something.stupid=hello
the yellow warning starts at the omething... and tells me that the property is unknown (and gives me the full name of the property in the description), whereas when I write something like:
womething.stupid=hello
the full property is underlined as a warning, starting right from the first character.
But that seems to be a different issue that this story, so the quick fix shows up consistently with whatever is marked as the warning... :-)
The idea for the 'more precise' underlining was that the location where it starts would be a bit of a hint as to where you may have made a typo. I.e. when you have the property 'almost correctly' rather than something completely bogus. I think the location may actually help to show the problem in that case. (A long property name with a single small typo, you might be staring at it for a while before you notice the exact character location where there's a typo).
But I realize several people have stated already they didn't understand the meaning of this underline logic and thought it was a bug rather than something helpful. I'm not against changing this into some more logical underlining strategy.
I still like the idea that you describe, but it also looks like having just a single character at the beginning as a "known prefix" is a bit too aggressive here. What about changing this to prefixes of at least 3 characters?
For the typo case: another option would be to offer a quick fix (suggestions) that replaces the misspelled property name with a correct one. That way we could underline the whole property name as unknown, but offer the best matching known property name as a suggestion/quickfix. Could be quite handy to use...
Activity
mathisdt commentedon Nov 13, 2018
It would be nice to have an option to disable these warnings altogether so the "Problems" view doesn't get too filled up. Sometimes a project uses its own property keys which may be unknown to Spring Boot but are nevertheless valid properties.
kdvolder commentedon Nov 13, 2018
@mathisdt That's a good point. The old/legacy version of the editor used to have a way to configure problem severity for different types of probems, setting the severity to 'ignore' would make those types of errors disapear completely.
So I agree we should bring something like this back in the new editor too.
I did want to react to something you said though.
If you defined the properties in the right way, using classes annotated with @ConfigurationProperties and using the spring boot 'configuration processor' then in theory your project's properties would work just the same is those built in with spring boot libraries. So they shouldn't cause 'unknown property' warnings. This would really be the best/ideal solution.
Now, I know there's probably all kinds of practical reasons why this wasn't done, can't be done, is too much work to do, not yet done, etc. So I still take your point that it would be a good idea for the editor to provide some mechanic for users to disable these warnings.
spring-projects-issues commentedon Jan 11, 2019
(comment in Pivotal Tracker added by Alex Boyko:)
@krisde this seems to be "unknown" property quick fix rather than "missing" property quick fix issue. Is that correct? In other words the quick fix adding pom content to generate properties metadata json is missing. Is that right?
spring-projects-issues commentedon Jan 11, 2019
(comment in Pivotal Tracker added by Alex Boyko:)
"Create metadata for <property" is the quick fix we are missing it looks like.
martinlippert commentedon Jan 13, 2019
We should also integrate an easy way to configure the problem severity, so that people could select "ignore" or something like this for this warning (in general).
kdvolder commentedon Jan 14, 2019
WE used to have this in STS 3. But its one of the features that wasn't re-implemented in the language server context. The architecture however is still such that problem severities are decoupled from problem types so that it shouldn't be too hard to get this working again.
The main difficulty is, probably, that this kind of 'configuration' will have to be done via LSP configuration keys. I think this is complex enough that we should treat this as a separate issue ticket.
spring-projects-issues commentedon Jan 15, 2019
(comment in Pivotal Tracker added by Alex Boyko:)
Fixed but both LSP4E and VSCode don't save documents edited when Workspace Edit is performed. Therefore, the json file is opened in the editor but not saved. All need to be saved then the warning goes away.
LSP4E has this bug currently: https://bugs.eclipse.org/bugs/show_bug.cgi?id=543435 Doesn't allow to make text edits to files that don't exists eventhough previous change from the workspace edit creates this file. This should be fixed rather soon.
1 remaining item
spring-projects-issues commentedon Jan 16, 2019
(comment in Pivotal Tracker added by Martin Lippert:)
I switched this back to "finished" state due to the fact that there is no way to actually test this for acceptance. As soon as the related bug in LSP4E is fixed, we can push this forward to delivered.
spring-projects-issues commentedon Jan 16, 2019
(comment in Pivotal Tracker added by Martin Lippert:)
I also noticed that the quick fix for this is NOT active when you press Cmd-1 while being on the beginning of the line, you have to move the cursor to the second character for the quick fix to show up.
spring-projects-issues commentedon Jan 16, 2019
(comment in Pivotal Tracker added by Alex Boyko:)
@mlippert VSCode can be tried... Looks though that the LSP4E would handle workspace edit better than VSCode, i.e. saving the edited files that were not opened in the editor. The fix for LSP4E is under construction still unfortunately - I thought it'd be more straight-forward.
mlippert commentedon Jan 16, 2019
@martinlippert see comment above
spring-projects-issues commentedon Jan 16, 2019
(comment in Pivotal Tracker added by Alex Boyko:)
Martin! The above behaviour comes from common valid prefix. For example my property in the file
spring.pp. It is unknown property. The closest known property isspring.profiles.active. The common known prefixspring.ptherefore and hence only the lastpofspring.ppin underlined and quick fix shown. I believe that is expected and has been in our editor for a while. I have asked Kris as well to confirm, but I'd say this is expected at the moment.spring-projects-issues commentedon Jan 17, 2019
(comment in Pivotal Tracker added by Martin Lippert:)
OK, I think I understand the behavior now in more detail, seems to be indeed the case that I hit.
However, I find it somewhat counter-intuitive from the user point of view that when I type something in like:
the yellow warning starts at the
omething...and tells me that the property is unknown (and gives me the full name of the property in the description), whereas when I write something like:the full property is underlined as a warning, starting right from the first character.
But that seems to be a different issue that this story, so the quick fix shows up consistently with whatever is marked as the warning... :-)
kdvolder commentedon Jan 17, 2019
The idea for the 'more precise' underlining was that the location where it starts would be a bit of a hint as to where you may have made a typo. I.e. when you have the property 'almost correctly' rather than something completely bogus. I think the location may actually help to show the problem in that case. (A long property name with a single small typo, you might be staring at it for a while before you notice the exact character location where there's a typo).
But I realize several people have stated already they didn't understand the meaning of this underline logic and thought it was a bug rather than something helpful. I'm not against changing this into some more logical underlining strategy.
martinlippert commentedon Jan 18, 2019
I still like the idea that you describe, but it also looks like having just a single character at the beginning as a "known prefix" is a bit too aggressive here. What about changing this to prefixes of at least 3 characters?
martinlippert commentedon Jan 18, 2019
For the typo case: another option would be to offer a quick fix (suggestions) that replaces the misspelled property name with a correct one. That way we could underline the whole property name as unknown, but offer the best matching known property name as a suggestion/quickfix. Could be quite handy to use...
And for selecting the suggestions, we could use this to identify the nearest properties: https://en.wikipedia.org/wiki/Levenshtein_distance