sublimelsp / LSP-json

Schema validation/completions for your JSON and Sublime files
MIT License
75 stars 10 forks source link

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

Open rwols opened 4 years ago

rwols commented 4 years ago

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.

rchl commented 4 years ago

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.

rwols commented 4 years ago

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.

rchl commented 4 years ago

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.