-
Notifications
You must be signed in to change notification settings - Fork 206
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
STS on Eclipse quick-fix for unknown property in application.properties doesn't work #747
Comments
It looks to me like the problem marker doesn't appear on the first character of the missing property. When you hit Cmd-1 while the cursor is on the first character of that line, the "bell" sound appear due to no warning or quick fix being around. When I change the cursor to the second or third. character of the line, Cmd-1 works fine. Do you experience the same behavior? |
Hi No it is a bell regardless on position for me. But there isn't any warnings for the unknown properties. Sorry I didn't relize that until now that it should be. I just know that they are unknown since I haven't defined them in the additional-spring-configutation-metadata.json. So my issue might be that STS isn't validating the file then? |
Hi I create a new vanilla STS project in Eclipse using the wizard and then it works. So I am not sure why my other project isn't validated for unknown properties by the Language server. It has the "[boot]" annotation on the project and all. And the icon on the file is the leaf etc. I notice the new project I created didn't have the "Spring boot validations builder" enable or even present in the list of Validators on the project. But my old not working project have it. |
snippet of application.properties: The language server log when it doesn't work: {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/lpersson/src/c360/c360-admin/external-api/src/test/resources/application.properties","diagnostics":[{"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":11}},"severity":2,"code":"PROP_UNKNOWN_PROPERTY","source":"vscode-spring-boot","message":"\u0027hello.world\u0027 is an unknown property."}]}} [t=1648491330877] org.eclipse.languageserver.languages.springboot to LSP4E: [t=1648491330879] LSP4E to org.eclipse.languageserver.languages.springboot: [t=1648491330879] LSP4E to org.eclipse.languageserver.languages.springboot: [t=1648491330879] org.eclipse.languageserver.languages.springboot to LSP4E: log from when it works: [t=1648491121099] org.eclipse.languageserver.languages.springboot to LSP4E: [t=1648491121355] org.eclipse.languageserver.languages.springboot to LSP4E: [t=1648491121357] LSP4E to org.eclipse.languageserver.languages.springboot: [t=1648491121357] LSP4E to org.eclipse.languageserver.languages.springboot: [t=1648491121357] org.eclipse.languageserver.languages.springboot to LSP4E: |
That is an interesting observation, great find. Do you have a simple sample project that you could share that we could import into a running Eclipse as existing project (so including the .project files etc.) and would reproduce this behavior? |
The "spring boot validations builder" I think refers an old Ecipse only implementation of some validations. I don't think it has anything to do with the 'unknown property' quickfix or validation because that is done by the language server. It's interesting, in the logs you pasted it seems that the language server is aware there is a 'unknown property' problem and sends that info to the client. So I am not really sure what is wrong with that. I'll try to reproduce the issue myself when I have some time. If you can attach a sample project that might be helpful, otherwise I will try to create a pretty vanilla sample project myself. |
Hello I think they way to re-create it is to have a multi project in Gradle that is imported to Eclipse. |
@Lucas3oo The bit about multi-project is a great piece of information. That gives me something to work with. It sounds like Eclispe or lsp4e are getting confused by the fact that the same physical file, exists in multiple 'incarnations' as an Eclipse resource. |
I was able to reproduce a similar behavior as @Lucas3oo describes... except it does the exact opposite.
Yes, this is odd and confusing, but it seems to also be the 'correct' or 'expected' behavior: Now... two thoughts here:
BTW: the 'flipped' cases is important since what I'm seeing is 'somewhat logical' but what you describe is more or less the opposite of what you'd expect. In either case it might be useful if I dig a little deeper and see if we can improve on this somehow (e.g. maybe the validation and other functionality could be made to work in both cases when a resource is 'aliased'). Before I do that however, I want to be sure the problem I've reproduced actually matches what you observed (which is unclear since it seems to be the 'opposite'). |
Hello i will fix a Gradle/eclipse combo. |
Hi @Lucas3oo
That would be great, thanks! But please read and answer this other question/point first:
I.e. can you confirm that what you are seeing is indeed the 'opposite' of what I'm seeing/describing? The reason why I am trying to ask for this explicitly is that:
|
Hi Indeed the warnings are on the root project which is not a java project. I did create a multi project with a Spring app using the Spring init wizard and then of course everything worked as it should. So I took my real project that has the issue and slimmed it down. I will attach that. |
another strange thing maybe unrelated but in my other Eclipse workspace where I have a big multiproject then Eclipse sometimes ends up in recurring build that takes 100% CPU. And if I uninstall the STS plugin it never happens. |
@Lucas3oo Please raise a separate issue for this. |
In Eclipse workspace it is possible that a single file corresponds to multiple workspace resources. This typically arises in 'multi-project' setups where both the parent project and its nested children are imported into the workspace. This creates all sorts of confusions and subtle bugs. The logical solution seems to be to deliberatly choose the 'most nested' resource instead of just arbitarily picking the first one found. This small does just that in LSPEclipseUtils. This indirectly fixes issues in STS such as: spring-projects/sts4#769 spring-projects/sts4#747
In Eclipse workspace it is possible that a single file corresponds to multiple workspace resources. This typically arises in 'multi-project' setups where both the parent project and its nested children are imported into the workspace. This creates all sorts of confusions and subtle bugs. The logical solution seems to be to deliberatly choose the 'most nested' resource instead of just arbitarily picking the first one found. This small does just that in LSPEclipseUtils. This indirectly fixes issues in STS such as: spring-projects/sts4#769 spring-projects/sts4#747
Now that our MR with lsp4e had some time to 'percolate' through Eclipse and STS releases, I have confirimed that this problem seems to be indeed fixed in STS 4.15.0.RELEASE |
Describe the bug
STS on Eclipse quick-fix for unknown property in application.properties doesn't work
To Reproduce
create a new custom property (like hello.world=17) in application.properties and do cmd-1 over it.
Then just a "bell" sounds.
Content assist works on "standard" Spring boot properties like server.port.
Command click on a property also works in that you jump to its definition.
Mac OS,
Version: 2022-03 (4.23.0)
Build id: 20220310-1457
adoptopenjdk-11.jdk
VMware, Inc. SpringSource Tool Suite (Core) 4.14.0.202203131529 org.springsource.ide.eclipse.commons.core
% jps
34962 BootLanguageServerBootApp
35252 Jps
29787 GradleDaemon
31851 GradleDaemon
34956 Eclipse
I checked the Eclipse error log and also the enabled the Spring boots language server log. But noting in those.
I tried an older version of STS and same but it use to work on my box but probably an older version of Eclipse.
The text was updated successfully, but these errors were encountered: