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] create links for values of format uri-reference #128971

Open
siegenthalerroger opened this issue Jul 19, 2021 · 5 comments · May be fixed by microsoft/vscode-json-languageservice#219
Open
Assignees
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities json JSON support issues
Milestone

Comments

@siegenthalerroger
Copy link

When authoring json it'd be great to have a richer experience when referencing other files, without having the overhead of defining a file:// URI whenever this is required (see example below).
image

I would expect this behaviour by standard when the schema is defining the values as file-references, this is also related to my more pertinent issue in the vscode-yaml repository concerning the handling of k8s kustomize resources (vscode-yaml#559)

@aeschli
Copy link
Contributor

aeschli commented Jul 19, 2021

when the schema is defining the values as file-references

Does that exist already?
I'd rather not define new vscode non-standard formats.

@aeschli aeschli added the info-needed Issue requires more information from poster label Jul 19, 2021
@siegenthalerroger
Copy link
Author

I've never seen it used sadly (as above) and looking at the reference (https://cswr.github.io/JsonSchema/spec/basic_types/) seems to also support the fact that it doesn't have this. On the other hand there are references that state that this does exist using an additional (optional) format definition in the schema definition (https://json-schema.org/understanding-json-schema/reference/string.html#format).

I'm currently unable to check whether vscode actually respects/supports these different formats, do you happen to know? If it is supported (and this would be preferable), then the issue clearly lies with the schema authors :)

@aeschli
Copy link
Contributor

aeschli commented Aug 17, 2021

Yes. we support most of the format kinds.
I think that format uri-reference would work for relative paths as well.

We have automatic link rendering if a value is in the URL form (scheme://authority/...). That's cheap as we can generate this without a need to test if the path exists.
For relative paths this is not so easy. A lot of strings could be valid relative paths. It would be look strange if all strings get an link underline.
So IMO for relative paths we require a format, such as format uri-reference`

If you want to work on this and add link support for all elements that have format uri-reference that woukld be cool. But not sure that this would solve your request.

@aeschli aeschli changed the title Detect file paths and correctly link/reference target [json] create links for values of format uri-reference Aug 17, 2021
@aeschli aeschli added json JSON support issues feature-request Request for new features or functionality and removed info-needed Issue requires more information from poster labels Aug 17, 2021
@aeschli aeschli added this to the Backlog milestone Aug 17, 2021
@aeschli aeschli added the help wanted Issues identified as good community contribution opportunities label Aug 17, 2021
@siegenthalerroger
Copy link
Author

Hi, sorry for the delay

If I understood you correctly, it is true that vscode currently doesn't use the format: uri-reference even if it is defined in the schema of a file right?

That would explain the issue in the vscode-yaml plugin aswell: redhat-developer/vscode-yaml#559 (comment)

@aeschli
Copy link
Contributor

aeschli commented Sep 14, 2021

format: uri-reference is used for validation as seen here
https://github.com/microsoft/vscode-json-languageservice/blob/main/src/parser/jsonParser.ts#L661

but not for link detection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities json JSON support issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants