taplo icon indicating copy to clipboard operation
taplo copied to clipboard

Relative paths in `tomlValidation` url

Open gnikit opened this issue 3 years ago • 6 comments

The string that is being passed in url in tomlValidation needs to be a URI . Hence, using it with a relative path e.g. "url": "./schema.json" similar to how json and yaml validations can be passed will not work. Using a URL, as shown in the docs however will.

gnikit avatar Sep 21 '22 22:09 gnikit

Do you have a reference for JSON and/or YAML validation settings with relative paths? If so, we could copy their behaviour, otherwise I'm not sure what the relative paths should be based on.

tamasfe avatar Oct 07 '22 19:10 tamasfe

I am relatively certain that the relative paths are with respect to the extension install root i.e. where package.json resides see the Search for usecases https://github.com/search?q=filename%3Apackage.json+yamlValidation+in%3Afile&type=Code.

I think this is the piece of code you are looking for https://github.com/redhat-developer/vscode-yaml/blob/7f4be301df8ff9d74016b113df296be420fbfab9/src/extension.ts#L229-L264

FYI we are already making use of tomlValidation see https://github.com/fortran-lang/vscode-fortran-support/blob/1f2fe6d8465a80109501ee22eabbcf4347eb7d7d/package.json#L121-L126 and it works great cheers!

gnikit avatar Oct 09 '22 23:10 gnikit

Ah I see, makes perfect sense, thanks! It should be trivial to implement based on the referenced YAML extension code.

FYI we are already making use of tomlValidation see https://github.com/fortran-lang/vscode-fortran-support/blob/1f2fe6d8465a80109501ee22eabbcf4347eb7d7d/package.json#L121-L126 and it works great cheers!

I'm glad, thanks!

tamasfe avatar Oct 11 '22 12:10 tamasfe

This enhancement would be very useful for us too (using extension.extensionUri when schema path is relative to ./)

FredLL-Avaiga avatar Nov 28 '22 11:11 FredLL-Avaiga

@tamasfe Do you take PR ? I guess this is quite simple and I'm willing to submit a PR :-)

FredLL-Avaiga avatar Dec 08 '22 11:12 FredLL-Avaiga

Any progress on this?

SpontanCombust avatar Jun 08 '24 21:06 SpontanCombust