Provide a custom request to open yaml file and select a given property key
See original GitHub issueIs your enhancement related to a problem? Please describe.
vscode-microprofile depends vscode-yaml to manage completion, validation, hover, etc for application.yaml. To do that we generate a JSON Schema according to the Java project classpath.
In Quarkus/MicroProfile, we can declare a property foo.bar
in Java file:
public class Test {
@ConfigProperty(name = "foo.bar")
private Integer test;
}
and we can configure this property with the application.yaml
like this:
foo:
bar: 10
I’m implementing go to the definition from the Java file to the properties file and yaml file. In other words, when cursor is inside the name of the annotation (see cursor at |
);
@ConfigProperty(name = "foo|.bar")
I would like to open the application.yaml and select the bar
property key even if application.yaml is not opened.
Describe the solution you would like
It should be nice if we could consume a custom service like selectPropertyKey("foo.bar")
to open the application.yaml and select the property key.
Describe alternatives you have considered
I will try for the moment to open the application.yaml with standard LSP definition request by setting 0 as location.
Thanks for your help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (4 by maintainers)
Top GitHub Comments
I love that 😃
I think you should follow the same API that we use for JDT LS and XML Language Server with IDelegateCommandHandler: https://github.com/eclipse/lemminx/blob/11f6f6df3ac2a7c574b399d6ef40a128b2cfd6a7/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/services/extensions/commands/IXMLCommandService.java#L33
The question is about context:
To avoid breaking the command API, I suggest this idea:
and YamlContext could provide methods like
I think it can be a good start.
@angelozerr I’m assuming that you implement go to the definition with vscode.DefinitionProvider in such case you provide
vscode.Location
object, which contains file URI andRange
where some symbol defined. VSCode use that uri to open file and Range to place cursor.I’m not sure why do you need to open YAML manually or using API from yaml extension. I can assume that you may need some sort of API to calculate where some property defined in yaml file, to build
Range
object.Another good question, is how to pass path to yaml node, I think we can use yaml path or jsonpath