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
Cannot use provided schemas #461
Comments
@vrubezhny Can you please have a look? |
@apupier Can you please tell us the fully qualified version of org.eclipse.wildwebdeveloper.xml on your installation? |
Wild Web Developer 0.10.0.202006021616 org.eclipse.wildwebdeveloper.feature.feature.group Eclipse Wild Web Developer project |
Where do you find the preferences to add a JSON Schema? |
@apupier I cannot reproduce the issue...
As result, the content assist is shown with no any exceptions: Despite that fact that no exceptions produced, the suggested proposals, imho, don't follow the schema. |
I'm having the same issue with the POC I'm working on for jbosstools-quarkus. |
I think, the reason I don't see in content assist proposals anything similar to what the schema defines is that YAML LS doesn't accept the schema with the following error:
|
Could be that a recent LS updates changes the operation. |
@apupier There is one obvious error in your YAML Schemas preference page image: the path to schema must be project relative, not absolute, see: https://github.com/redhat-developer/yaml-language-server#associating-a-schema-to-a-glob-pattern-via-yamlschemas @jeffmaury What do you mean by "the same issue": the |
using VS Code, I was able to specify an absolute path.
I still have the same error with both |
please note that now the Camel K schema is part of json schema store so when testign might need to use different glob pattern SchemaStore/schemastore#1138 |
@vrubezhny I don't agree the schema should be specified using a URL, the file pattern is relative to the project. |
I don't think the schema URL or not does matter, and attention should be focused on the |
This is the famous extension point from the LS we discussed in #318 |
But isn't this only with Quarkus tools? As far as I understand, plain Wild Web Developer doesn't have such issue then? |
No the extension is from the LS and WWD does not implement this request thus the message. |
So the message comes from the server to the client? Without a capability check? It then seems like a bug in the LS to me. |
I'm sure that YAML LS, when it resolves a schema, searches for it by a path that is relative to
Could you please tell what YAML LS version it installed? Recently we have updated it to be 0.8.0, and I suppose that WWD 0.10.0 still uses 0.6.1 - this probably is a reason why I cannot reproduce the error with |
Yes I'm using 0.6.1 because it's the one WWD is shipping. The YAML LS doc clearly states that the schema specification is through an URL and relative applies to file pattern |
"yaml.schemas applies a schema to a file. In other words, the schema (placed on the left) is applied to the glob pattern on the right. Your schema can be local or online. Your schema path must be relative to the project root and not an absolute path to the schema." Anyway, it looks we're looking at different versions and seeing the different issues... |
Thanks for the feedback @jeffmaury ! |
@jeffmaury Glad to see the content assist is working correctly for you. Thanks for the feedback! |
I'm a little bit confused on a few things. First for:
the only way that should appear is if a Also what are the workspace folders sent/workspaceRoot? We use those to turn the relative paths into absolute paths |
The schemas are set here by invocation of On But even if we configure something like |
@JPinkney Here is my YAML LS log for a opening and closing the YAML Editor when a schema is specified by an absolute path: |
Interesting, if I have time I'll set things up and debug but I can't guarentee any timeline |
Is there any documentation on how to set everything up/contribute? I'm not really familiar with eclipse desktop ide projects |
In general, you need:
|
Thanks for those details @vrubezheny! |
I never get custom/schema/context at all in the logs but I can produce one issue. Testing scenariosI've set everything up, started the node process built from redhat-developer/yaml-language-server@3cdc18b and starting playing around with it. Absolute paths worked for me with one project in the workspace:
with: schema: /home/joshpinkney/Documents/Work/Schemas/composer.json Additionally, I was able to add composer.json to my workspace so that it was
and then I was able to do: schema: composer.json and everything worked successfully. I think the issue is with:
LSP4E seems to be passing in a rootUri and not workspaceFolders despite there being multiple roots in the project which probably leads into an issue on the language server-side. The YAML language server uses either rootURI or workspaceFolders as its root when building up relative pathing and only checks these at initialization. That means, that if you open a YAML file and I was able to verify this by doing:
opening up test2.yaml first and then setting: schema: ../test/composer.json The fixI assume that LSP4E will send the correct workspaceFolder events after initialization so the solution is make the YAML language server react to workspaceFolder events. The other things that came upI still haven't been able to produce: I have a feeling though both of these have been fixed a lonngggg time ago and its caused by issues in an old version of the language server |
@JPinkney I agree, The issue could be in not provided
...I didn't get any changes in behaviour - I still see the same error:
But even with no WorkspaceFolders set, just having
...yaml ls should be able to calculate the correct path to the schema:
...but it still cannot find the schema. Others:
|
Unfortunately, I'm still unable to reproduce. I've tested a bunch of schema configuration settings and still cannot reproduce "Unsupported request method: custom/schema/content" and setting it with absolute paths worked on my side. I followed #461 (comment) exactly (I never even had eclipse installed on the machine I was testing on before so there wasn't anything previous installed here) and the only thing I did was update the version of yaml-language-serer to 0.9.0. Though I'm pretty sure with 0.8.0 I would have had the same results. These were the configurations I was using to test:
Workspace folder handling has been merged but won't be available until a future release so that stuff still won't be working. BTW what are the contents of "/home/jeremy/projects/runtime-wwd/HelloWorldTS/yaml-schema.json" ? Perhaps the schema is just invalid? Does it work when you set it in VSCode for example? |
@JPinkney I can confirm. It looks like I had something cached somehow inside LS after update to 0.90.0. so, I don't see The schema file I'm testing with is downloaded from https://gist.githubusercontent.com/lburgazzoli/5b860fdad50d372a27fc51306f1ae378/raw/addea32147720a41ff58aa82e1ec845dae6ab77c/camel-yaml-dsl.json However there are still few problems with schemas:
|
WDYM? I'm not sure where getInitialOptions is from
It seems to me like this is the way it should behave but I'm not sure if every language server has support for workspaceFolders yet so maybe its feasible yet
In a future release of the yaml-language-server all of the schemas will use either workspaceFolders (if available) or the rootUri to construct schema paths. Anytime workspaceFolders is added/removed the mapping of the schemas will re-generate automatically on the language server side
I think it would just include all of the projects that are listed at the root of your workspace |
It's used to provide initialization options on the start of a language server (
So, it's logical to set initial configuration for the schemas and WorkspaceFolder list at
OK. Thanks. I'll try to override and send
OK thanks I'll try sending the only root project folder list (as sending of every workspace, imho, folder might generate a big overload at initialization steps) |
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Well, Currently I can't find a way to override/change the way LSP4E initializes |
I think what VSCode does is after initialize happens then they send didChangeConfiguration to basically sync the editor settings with the language server. You might be able to try something like that |
Eclipse LSP4E can be improved on that matter. |
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
That's what I finally did: I'm sending the initial schemas and set of folders when 'initialize" response is received, After that resource change listener sends the changes in WS folders, while Preference change listener reports the changes in schemas. |
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: #461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixed preferernce listener installation Fixes: eclipse-wildwebdeveloper#461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
Fixed preferernce listener installation Fixes: #461 Signed-off-by: Victor Rubezhny <vrubezhny@redhat.com>
when trying to use a specific schemas provided in preferences, when openign the file and asking for completion, there is this error:
tried with an URL and with a local file:
/home/apupier/ws/camelk-test/my-schema.json
The text was updated successfully, but these errors were encountered: