-
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
Add support for Spring Boot multi-document properties files #533
Comments
Is it an option to use a different extension for this 'new' format? I think it is a bad idea to redefine the existing format. A cleaner solution would be to choose a different extension for the new format (e.g. |
@philwebb First of all, thanks a lot for raising this issue here and making us aware of these updates in Spring Boot. That is very very much appreciated. As far as I can see, the YAML editing support deals with this multi-document files already and looks good so far. If you experience any issues within YAML files, please let us know. The editing experience for this in the properties editor causes indeed duplicate key errors to show up. We should fix that. In addition to that the content-assist should probably also add an entry to actually insert the @philwebb Do you have any other tricks in mind that could make editing those files easier or more convenient? If so, please let us know. @kdvolder I disagree with you on this. The properties file is still a valid properties file. We should adapt our duplicate keys validation (which is specific to our tooling) to deal with this new multi-document semantics. And since this is a backwards compatible change for Boot users, I would not introduce a new file type/extension for this. (@kdvolder In addition to that I would strongly prefer not to assess new, updated or changed features of any project here as bad, wrong, or anything like that.) |
I think it comes from Eclipse. |
Actually, quickly checked this and no it doesn't. The error comes from our language server. That's good news as we can fix it relatively easily.
I would strongly prefer to be able to speak my mind and say what I think in an open discussion. I have no problems with it if other people disagree with me, especially if they can present good technical reasons for their own opinions. If my suggestions for considering changing the extension are rejected for whatever reason, that is fine. However I do not think we should just avoid discussion about such matters altogether for fear of hurting each others feelings. I still do not think it is a good idea to redefine an existing format and I have good reasons for this which I have stated and which I stand by. Anybody should feel free to disagree and present your own arguments. In doing so, they can rest assured, this will not offend me, as I think they in turn should also not feel offended by my own position. Even an argument like 'we already made this decision a while ago and it is now too late to change it, so we do not wish to discuss it further'... is fine by me. What is not fine by me is telling people they should simply keep their opinions to themselves and not raise potentially valid concerns/questions beforehand. Anyhow, since the error about duplicate keys is under our control (at least in STS without other plugins installed that may validate the file as well) it isn't terribly difficult for us to turn this warning of. And that is good news. |
We did think about this, but it unfortunately comes with a number of downsides. We need to check quite a few locations for We landed on using
I've not seen any problems with the YAML editor. The YAML spec has always supported multiple documents so you probably already deal with them.
Yeah, there's also support for importing configs using It might also be nice to have something in the outline view that shows the documents and allows you to jump to them quickly. There's some
@kdvolder I appreciate the feedback and wasn't bothered by it. We hoped when doing the design that by using the |
I am not talking about whether we should discuss things or not. I am purely talking about "how" we discuss things. If you have questions about that @kdvolder, we should talk about that offline. |
Correct.
Sounds interesting. I have to admit I didn't fully understand what you are suggesting / have in mind. But it sounds like if we discussed a bit... we could come up with something interesting to implement :-). It would be great if you create a ticket for these kinds of enhancements. Also thanks Phil for explaining some of the reasoning behind the decision. I understand it is a tradeof, naturally I was more concerned about the tooling impact and not as in tune with other considerations. All in all I think the tooling impact won't be as bad. So I agree you probably made the right decision. My initial misgivings were overblown since I verified already that neither vanilla Eclipse nor vscode produces warnings about duplicate keys. So it's just coming from STS and therefore it is under our control. Step 1 would be a simple fix to just disable those warnings when we detect the document marker is present. That would be a trivial fix. But it wouldn't be ideal. Step 2 would be to make the editor truly aware of it's multi-document stucture (i.e as in the yaml editor). This is likely a bit more involved. I haven't a good idea yet how much work it would/will be and how important it is, but it should be feasible. |
Done in #536 |
@philwebb A question and possibly a suggestion... How tolerant should we be of variations in the document marker that may look the same or similar to a user? E.g. should we tolerate spaces before/after the marker on the same line? From the looks of the code you linked it doesn't seem to even tolerate extra spaces after the marker I think this might be confusing to users, since depending on how the editor displays whitespace... it might not be even possible to see the difference at all. Anyhow... so the question is... what should STS do? Should STS recognize the marker only when it has no leading / trailing spaces? And the suggestion is... if spring boot doesn't already tolerate trainling spaces, then perhaps it might be a good idea to tolerate them. WDYT? |
The leading whitespace should be noticeable, but I agree that trailing whitespace will be hard to spot. I've opened spring-projects/spring-boot#23399 to see if we can address that on our side. |
Okay great! Thanks for the quick response. So I will assume that trailing spaces are to be tolerated but leading ones are not. |
Yeah, I think that's safest. The leading ones should be easier to notice. |
See: #533 Signed-off-by: Kris De Volder <[email protected]>
(comment in Pivotal Tracker added by Nieraj Singh:) Multi-doc support in properties file seems to work. See attached screenshot |
Spring Boot 2.4 will add support for multi-document
.properties
files. These behave in a similar way to multi-document YAML files and allow the user to split a physical.properties
file into multiple independent logical documents. With properties#---
is used as the separator. The reference documentation has an updated section that covers the new syntax.The new format may cause a few problem with the IDE editor. Specifically, you can get errors about duplicate keys. It would be nice if the IDE could treat each logical section as a different document and not present those warnings. If you're interested in some Java code that parses the new format, you can look at OriginTrackedPropertiesLoader.java from the Spring Boot codebase.
The text was updated successfully, but these errors were encountered: