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

setDiagnosticsOptions no longer works after worker loaded #105

Closed
patrickshipe opened this issue Sep 14, 2021 · 5 comments · Fixed by #109
Closed

setDiagnosticsOptions no longer works after worker loaded #105

patrickshipe opened this issue Sep 14, 2021 · 5 comments · Fixed by #109
Labels
bug Something isn't working

Comments

@patrickshipe
Copy link
Contributor

It seems that somewhere between monaco-yaml version 3 and 3.2, calling setDiagnosticsOptions to change schemas no longer works - the schemas seem frozen to what they were when the worker was first loaded. The options change, but it looks like a no-op – we don't try to load any new schemas. It seems to work in Monaco's JSON plugin just fine (if I call setDiagnosticsOptions with a changed schema, it takes effect even for an active Monaco editor).

I tried digging around to find out what is causing this, but it looks like the code changed significantly from 3.0 to 3.2 - any thoughts?

@patrickshipe
Copy link
Contributor Author

@remcohaszing it seems that this PR broke this: #99

The JSON worker does the same thing - when the diagnostics options change, we must kill the worker so it restarts with the right options (e.g. schemas). Since we removed this handler, the worker never stops and the changes to not take effect. I added logging to the stopWorker handler in the monaco-yaml 3.0 and confirmed that this callback is called when I update schemas with setDiagnosticsOptions.

@patrickshipe
Copy link
Contributor Author

It seems that "unloading a language" is different from restarting the worker when settings change - since this event chain is being fired from within the plugin when setDiagnosticsOptions is called.

@patrickshipe
Copy link
Contributor Author

Sorry for the repeat comments - I put a PR together to restore this, but I do not have permissions in this repo. Happy to share if you would like!

@remcohaszing
Copy link
Owner

Hi @patrickshipe. Thanks for identifying and diagnosing this problem. I think I found the problem as well, but I want to give you a chance to propose your fix. :)

In order to make a change in a repository on GitHub you don’t have permission on, you’ll need to:

  • fork it
  • clone your fork
  • create a new branch
  • make changes to your cloned fork
  • push the branch to your fork
  • make a pull request from your fork to this repository

For more info see the GitHub’s Fork a repo

I’m looking forward to your fix!

@patrickshipe
Copy link
Contributor Author

Thank you for the tips @remcohaszing - first time using GitHub to contribute to an outside project! PR created: #109

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants