You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I suggest generate theme json by script for better maintainability and readability.
This might benefits:
Much more readable for reviewing PR.
More maintainable for contributors.
CI/CD
Better isolation for different languages.
Motivation
The current way to add or modify highlighting is really tedious, I'll have to find the correct position to append the highlight scope. And repeat the same operation for 7 other theme variants. This is just for the one scope, if one would like to add support for a new language, that would be overwhelming.
The idea was essentially inspired during when I implement the Eva-Theme.nvim which is a script-based implementation. And I do think it has a sufficient readability for its api, so I was thinking maybe we can do the same thing in the upstream.
Potential Problem
This new approach might bring some problems.
We might still want the old way to modify the json directly.
A: We can store those old json files at somewhere like legacy/*.json and merge it with script-generated values into the new json. One can modify legacy/*.json in the old way.
What would happen when there's duplicated setting for a same scope from both legacy json and script?
A: Honestly I don't know how does vscode handle this, if that matters we can throw an error when generating.
Implementation
I've done a prototype branch in typescript few days ago, and it should work fine at least for syntax highlighting(we can do it for ui colors too).
The example usage is can be:
highlight.map('function','storage.type.powershell')// map the scope as color of function.map('property',['variable.other.member.powershell','storage.type.powershell'])// map for multiple scopes with a same setting.map('none','storage.type.powershell',(palette,_)=>{return{fontStyle: 'bold',foreground: palette.typeparam};// override by more complex setting});
Note
To generate, use npm run build.
This applies to all variants with just a single line for one or more scopes!
The text was updated successfully, but these errors were encountered:
I didn't understand your code (I know only a little typescript, ashamed...). But I understood your idea and requirements, so I wrote a simple program. Now, you can add/modify syntax and UI styles in jsonc files. The way to generate theme json files is git bash under the index folder, node index.js.
Well it's ok for not having much knowledge about typescript, I use it just for more informative intellisense, nothing else. However, I believe there are still some gaps in your current solution that need to be addressed to resolve the inconvenience.
hard-coded colors are still required.
doesn't handle font style automatically. (I didn't come with a smarter solution though)
still have to repeat for variants.
Anyway, it's merely a draft proposal, so there's no rush to reach a conclusion. I understand you're developing for JetBrains IDEs; I'm not certain how JetBrains manages highlighting, but if they also use static configuration files, maintaining two repositories could be challenging. Hopefully, this proposal will serve as some inspiration. If you have any additional worries or insights, please don't hesitate to share. :)
Overview
I suggest generate theme json by script for better maintainability and readability.
This might benefits:
Motivation
The current way to add or modify highlighting is really tedious, I'll have to find the correct position to append the highlight scope. And repeat the same operation for 7 other theme variants. This is just for the one scope, if one would like to add support for a new language, that would be overwhelming.
The idea was essentially inspired during when I implement the Eva-Theme.nvim which is a script-based implementation. And I do think it has a sufficient readability for its api, so I was thinking maybe we can do the same thing in the upstream.
Potential Problem
This new approach might bring some problems.
We might still want the old way to modify the json directly.
A: We can store those old json files at somewhere like
legacy/*.json
and merge it with script-generated values into the new json. One can modifylegacy/*.json
in the old way.What would happen when there's duplicated setting for a same scope from both legacy json and script?
A: Honestly I don't know how does vscode handle this, if that matters we can throw an error when generating.
Implementation
I've done a prototype branch in typescript few days ago, and it should work fine at least for syntax highlighting(we can do it for ui colors too).
The example usage is can be:
Note
To generate, use
npm run build
.This applies to all variants with just a single line for one or more scopes!
The text was updated successfully, but these errors were encountered: