Consider if content assist can be offered for spring.config.import property keys
See original GitHub issueSpring Boot 2.4 will ship with support that allows you to easily import additional config files. There’s a bit of background about the feature in this blog post. Currently the content-assist for spring.config.import
will be limited to the hints that we provide in the meta-data JSON file, but we might be able to go further.
The spring.config.import
key accepts a list of string location values. Locations are ultimately resolved to provide additional config data. The resolver logic is completely pluggable, but by convention a location prefix will be used to determine how the location is resolved.
Out of the box, we’ll have support for configtree:
and resource:
. The resource:
prefix will also be used as the default of no other resolver supports the string.
Some examples:
spring.config.import=/etc/config/myfile.yml # import a file from the filesystem
#---
spring.config.import=resource:/etc/config/myfile.yml # more explicit version of above
#---
spring.config.import=classpath:extra.properties # import a classpath resource
#---
spring.config.import=resource:classpath:extra.properties # more explicit version of above
#---
spring.config.import=configtree:/etc/config/folder # import a config tree
It might be possible to offer some content-assist that would allow users to select files from either their workspace, or from their local disk. I suspect the workspace would be more useful.
For example:
The user types
spring.config.import=
Content assist could provide the usual hints:
+------------+
| classpath: |
| configtree:|
| file: |
+------------+
It could also provide a richer “select classpath resource…” option. This could bring up a dialog similar to “Open Resource”. You could also have a “select filesystem resource…” option.
Another useful feature would be ctrl-click on a location.
For example, given:
spring.config.import=classpath:my.properties
A ctrl-click on classpath:my.properties
could open the my.properties
file.
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (15 by maintainers)
Top GitHub Comments
I am closing this issue here as we implemented support for the
classpath:
prefix. We should create new and separate issues for additional improvements.We have implemented some basic support for ‘classpath:’ prefix. Whenever we see a prefix like ‘classpath:…’ we’ll make completions based on the contents of the project’s resource source folder.
I thought about other cases and thought this is probably the only case for which the IDE has enough context information to provide meaningful completions. (I.e. we know what stuff is on the classpath but we don’t really know what is on the ‘file:’ system or the ‘config:’ tree because I would assume that this actually depends on where the program eventually gets run (e.g. inside k8s / docker container). We might consider implementing some kind of support for ‘file’ though if that seems useful (opinions welcome, either as comment in this ticket or by raising other tickets with suggestions).
For now I’ll just consider this item as complete with just support for ‘classpath:’.