Model and completion for property expressions#13
Model and completion for property expressions#13angelozerr merged 1 commit intoeclipse-lsp4mp:masterfrom
Conversation
8672e09 to
665e0cd
Compare
4deee97 to
787b7c1
Compare
|
The completions NPE less frequently and should never suggest a property expression that would create a circular dependency. I still need to write some unit tests for the new completions. |
787b7c1 to
788639a
Compare
97fa6bb to
89aae36
Compare
89aae36 to
ee6414b
Compare
|
I think it would be great to add |
|
I get a ClassCastException when I try the completion in an application.properties file that contains a comment: (I tried completion on the Error: |
ee6414b to
a16e066
Compare
Added |
Fixed; I added this as a unit test |
85000d2 to
01a207e
Compare
01a207e to
f2305e4
Compare
|
Latest commit now suggests properties that appear in the properties file but haven't been defined elsewhere. |
f2305e4 to
b1abe56
Compare
|
It seems like But for config properties defined with ie, if I have: and in application.properties: I end up with My question is whether or not we should take into account the dependencies for projectInfo properties. If we do, it would be ideal if we only consider the |
Oops. This PR doesn't take this into account. I assumed that the property expressions could only be used within the properties file. The dependencies are only built on properties referenced in the file. So if you did completion here: in a project that requires that Kafka configuration value, I would expect It might be worthwhile to check this, since the cyclic dependency would invalidate the config file. |
|
I did some testing, and it looks like Helidon doesn't resolve default values for property expressions: # Application properties. This is the default greeting
app.greeting=Hello from ${combination.property},
# Microprofile server properties
server.port=8080
server.host=0.0.0.0
combination.property = ${server.host}:${server.port} ~ ${mp.openapi.scan.disable}Output when accessing the resource, where I'll test with Quarkus next to see what happens. |
|
Doesn't work in Quarkus either: # this is my configuration for quarkus
greeting.message=hello with ${quarkus.debug.reflection}, ${greeting.ve#getable[0].salad}
greeting.name=${greeting.message}
greeting.suffix=EXCLAMATION_MARK
greeting.ve#getable[0].salad = 42When trying to launch the application with |
46f6d6a to
83dbfcd
Compare
Depends on eclipse-lsp4mp#13 being merged, and includes the PR from eclipse-lsp4mp#13. Hover either shows the value defined in the properties file, or the default value. Closes eclipse-lsp4mp#24 Signed-off-by: David Thompson <davthomp@redhat.com>
|
After discussing with @datho7561, maybe this PR should follow the property expressions defined here: microprofile/microprofile-config#577 instead of the Quarkus property expressions defined here https://quarkus.io/guides/config#using-property-expressions? microprofile/microprofile-config#577 defines property expressions in the MP spec, but it's not merged yet. If we decide to follow the proposed Microprofile spec, I think we should handle these cases: @fbricon @angelozerr how does this sound? |
83dbfcd to
2167bc0
Compare
2167bc0 to
41aa468
Compare
|
@datho7561 please fix conflicts |
41aa468 to
9383dde
Compare
|
rebased |
|
When I have circular dependency with a like: When I try to open completion on b value with $, I have the following error: |
Do you think that it would be a good idea to suggest |
I think so. It's not the part of this PR, but we should have an error for a which higlight value ${a} to day that there is a circular problem. |
9383dde to
7722bb7
Compare
|
I opened #61 for this case |
In many MicroProfile implementations, `${other.property}` can be
used to refer to the value of an already defined property when defining
the value of another property.
This PR modifies the property file model to allow representing these
property expressions.
It also adds completion for defined properties when completion is
opened after typing `${` as a part of a property value.
This PR was migrated from
[quarkus-ls](redhat-developer/quarkus-ls#340).
Signed-off-by: David Thompson <davthomp@redhat.com>
7722bb7 to
4a487ae
Compare
|
Congrats @datho7561! It's a very impressive PR. |



In many MicroProfile implementations,
${other.property}can be used to refer to the value of an already defined property when defining the value of another property.This PR modifies the property file model to allow representing these property expressions. It also adds completion for defined properties when completion is opened after typing
${as a part of a property value.This PR was migrated from quarkus-ls.
Signed-off-by: David Thompson davthomp@redhat.com