Skip to content

Quickfix for missing property in .properties / .yml editor #101

Closed

Description

@kdvolder

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.

See: #97

Activity

  1. mathisdt commented on Nov 13, 2018

    @mathisdt

    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.

  2. kdvolder commented on Nov 13, 2018

    @kdvolder
    MemberAuthor

    @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.

  3. spring-projects-issues commented on Jan 11, 2019

    @spring-projects-issues

    (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?

  4. spring-projects-issues commented on Jan 11, 2019

    @spring-projects-issues

    (comment in Pivotal Tracker added by Alex Boyko:)

    "Create metadata for <property" is the quick fix we are missing it looks like.

  5. martinlippert commented on Jan 13, 2019

    @martinlippert
    Member

    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).

  6. kdvolder commented on Jan 14, 2019

    @kdvolder
    MemberAuthor

    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.

  7. spring-projects-issues commented on Jan 15, 2019

    @spring-projects-issues

    (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.

  8. 1 remaining item

  9. spring-projects-issues commented on Jan 16, 2019

    @spring-projects-issues

    (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.

  10. spring-projects-issues commented on Jan 16, 2019

    @spring-projects-issues

    (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.

  11. spring-projects-issues commented on Jan 16, 2019

    @spring-projects-issues

    (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.

  12. mlippert commented on Jan 16, 2019

    @mlippert

    @martinlippert see comment above

  13. spring-projects-issues commented on Jan 16, 2019

    @spring-projects-issues

    (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 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.

  14. spring-projects-issues commented on Jan 17, 2019

    @spring-projects-issues

    (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... :-)

  15. kdvolder commented on Jan 17, 2019

    @kdvolder
    MemberAuthor

    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.

  16. martinlippert commented on Jan 18, 2019

    @martinlippert
    Member

    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?

  17. martinlippert commented on Jan 18, 2019

    @martinlippert
    Member

    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

  18. added this to the 4.1.1.RELEASE milestone on Jan 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions