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

Template related files get errors on json comments in editor #5

Closed
smithgp opened this issue Oct 17, 2019 · 1 comment · Fixed by #17
Closed

Template related files get errors on json comments in editor #5

smithgp opened this issue Oct 17, 2019 · 1 comment · Fixed by #17

Comments

@smithgp
Copy link
Contributor

smithgp commented Oct 17, 2019

If you open the folderDefinition file for a template, and it has json comments, it will show as an error in the editor.

We have allowsComments: true in the schema for folderDefinition, but regular json language support doesn't get hooked up to that schema so it reports the comments as errors. This will happen for the other files (e.g. ui, rules, variables, dashboard, etc.) as they get added.

Possible options:

  1. dynamically set the languageId for those documents to jsonc (maybe via vscode.languages.setTextDocumentLanguage() in templateEditing when the file is open or the path-value changes).
  2. see if there's a way to configure the default json language client to ignore the template json files, at least for diagnostics
  3. if vscode could provide a public json-schema-association api, we could use that instead of the custom json-language-client thing we're doingin now
@smithgp smithgp added this to To do in Template Editing via automation Oct 17, 2019
@smithgp
Copy link
Contributor Author

smithgp commented Nov 11, 2019

Another side effect of the double-json-language-client setup is that we get double code-completions on enum'ed string field that have already entered text (e.g. rules.action in rules files, enter "set", do another rule, and see 2 "set"s in the code completions).

There is not a clean way to programmatically configure the default json language client to hide/disable checks (nor will there probably ever be); and, per the comments on microsoft/vscode#73424, there won't be an api to programmatically set the json schema for a .json file.

So, we're going to have to do our own language id and client + server for this, and use setTextDocumentLanguage() to dynamically switch the type for template related files. We will have to be sure that we can share the same json language configuration (e.g. spaces/tabs, auto format, prettier integration, etc.) so folks don't have to configure it twice.

@smithgp smithgp moved this from To do to In progress in Template Editing Nov 26, 2019
Template Editing automation moved this from In progress to Fixed Dec 4, 2019
@smithgp smithgp moved this from Fixed to Done in Template Editing Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

1 participant