-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Dynamic injection grammar contributions #53885
Comments
The current way for users to select a different kind of highlighting is by installing/uninstalling the extension that contributes the grammar/injection. Isn't that good enough for your use case? The challenge of your proposal is that it involves quite some change
|
@mjbvz The current way for users to select a different kind of highlighting is by installing/uninstalling the extension that contributes the grammar/injection. Isn't that good enough for your use case? |
Sort of but having to install multiple extensions with the same basic functionality is a poor user experience. My expectation is that I install the lit-html plugin for example, and then configure it for my use case |
I also need dynamic grammars generation for my "Rainbow CSV" extension. |
The C++ syntax could use toggle-able syntax options. Here's several more use cases that add up and make separate extensions impractical:
User's probably won't even realize those are options are available unless they're in the settings somewhere. Creating a separate extension for each one of those is too many repos for a dev to maintain effectively. What seems to end up happening instead is; an opinionated choice is made and then everyone else has to accept it. For example:
|
I was fiddling with that yesterday. Created an extension for myself but that yelled the same results as setting cc @mjbvz |
I wonder if this issue should be merged with #68647 ? |
:( Literally just needed this feature. I use many versioned languages such as C++ MATLAB Python I hope you revisit it if and when you get time |
Problem
mjbvz/vscode-lit-html#14
Many users have requested that we colorization the contents of all JavaScript template strings as html. However I think that turning this on by default with no way to disable it would be incorrect. Instead, I want to have a setting that allows users to enable or disable this behavior.
Proposal
The current colorization of
html
tagged templates is provided by an injection grammar. In order to support treating all template strings as html, I would like to be able to contribute this injection grammar dynamically. I can see this working in a few possible ways:when
clause to contributed grammar injectionsvscode
api that allows registering (and possibly unregistering) of injection grammarsThe current workaround is to make the extension rewrite its
package.json
or its contributed grammar (with the changes only taking effect after the next load). I believe that vetur already does something like thisThe text was updated successfully, but these errors were encountered: