Skip to content
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

JSON preferences do not support relative paths for schema associations #7140

Closed
ndoschek opened this issue Feb 12, 2020 · 3 comments
Closed
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help json issues related to the json language

Comments

@ndoschek
Copy link
Contributor

Description

In JSON preferences, the definition of json.schemas : url says it accepts a relative path to a schema in the current directory.
(https://github.com/eclipse-theia/theia/blob/master/packages/json/src/browser/json-preferences.ts)

When using a relative path the following error occurs:
[json] Unable to load schema from '/.schemas/my-schema-definition.json': ENOENT: no such file or directory, open '/.schemas/my-schema-definition.json'.

Using the absolute path to this schema works though.

Reproduction Steps

  • Run theia example (browser or electron)
  • Define a schema association for a JSON file and a JSON schema in the runtime workspace by using a relative path (see also screenshot).

theia-json-issue

OS and Theia version:
OS: Ubuntu 18.04
Theia: 3468d00

Diagnostics:

@vince-fugnitto vince-fugnitto added the json issues related to the json language label Feb 12, 2020
@akosyakov akosyakov added bug bugs found in the application help wanted issues meant to be picked up, require help labels Feb 12, 2020
@ndoschek
Copy link
Contributor Author

Hi!
I took a look into this and have created a proposal to fix this issue (but did not open a PR yet).
(also see https://github.com/ndoschek/theia/tree/fix7140)

Anyhow, I came across a minor problem, namely the jsonSchemaService (vscode-json-languageservice) returns the following warning:
Problems loading reference 'file:///test/my-schema-definition.json': Unable to load schema from '/test/my-schema-definition.json': ENOENT: no such file or directory, open '/test/my-schema-definition.json'.

The JSON schema support works as expected now also for relative paths, but this warning occurs.
Do you have an idea how to overcome this problem or is it okay to open a PR with my proposed fix?

Thank you in advance for your answer.

@akosyakov
Copy link
Member

@ndoschek please open a PR, it would be easier to see and try changes

@akosyakov
Copy link
Member

It's fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help json issues related to the json language
Projects
None yet
Development

No branches or pull requests

3 participants