sublimelsp / LSP-json

Schema validation/completions for your JSON and Sublime files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate .sublime-settings file from a sublime-package.json file

rwols opened this issue · comments

The inverse of #23. When a package author has defined his or her sublime-package.json, there should be a command in the command palette that auto-generates the .sublime-settings file for the package.

I think that it wouldn't be so easy in many cases as you would need to have the full, parsed, and combined schema to start with. So $ref's, anyOf's, and such resolved and only the server has that representation and we don't have a way to get it from it.

In theory you're right, but I am wondering whether package maintainers are really going to split up their definitions in multiple files? In fact, how would your hypothetical problem occur? I cannot write more than one sublime-package.json file after all, no? Well, perhaps I can put them into different subdirectories of the package.

If the whole schema for "MyPackage.sublime-settings" lives in sublime-package.json, I think it's possible to make an automatic translation.

The LSP's schema itself is already non trivial as it uses references for the two global settings and the client settings. That is already hard to handle if we'd need to parse that manually.