This repository has been archived by the owner on Nov 7, 2024. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
feat: allow multiple colorschemes #54
base: master
Are you sure you want to change the base?
feat: allow multiple colorschemes #54
Changes from 1 commit
0824a38
032db7a
cad48bd
ef55f76
124f97e
c83cfba
4ef7ab5
29befb8
1a7428f
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not see that we are ever deleting these. I haven't used this patch yet so I am not sure how often they will build up, but I can imagine a scenario where this might be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on tints init only the default tinted scheme will be built, and tint is not aware of any schemes that might be loaded by styler on opening a specific filetype.
so i test a window for having a different ns_id as the default 0, then test if there is already a tinted version (if not _["tint_ns" .. ns_suffix]) and only then add another tinted namespace.
It should add up only depending on the number of colorschemes a user adds e.g. by using styler :)
I dont do extra checks to prevent tinting of an already tinted colorscheme...maybe I should add that, since "tint.tint" can be executed by user on any window, already tinted or not...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I forgot I put the windows "untint_ns_id" to a window var, which prevents double tinting.
This window var gets deleted on restore_default_highlight_namespaces and untint, to allow switching of scheme if windows buffer and filetype change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a problem with neo-tree
It sets a namespace on the window, but anonymous with id only, and creates a new id on each focus. So you were right, many new tint-namespaces got created.
For now I changed to only create a new namespace, if a name can be found.
Maybe it would be better to only create additional namespaces if a function "add_tint_function" returns true? (similar to window_ignore_function).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Can simplify things here a bit by doing:
to make the function logic a bit more readable here - either we are just using the global namespace or we are using the user-enabled stuff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right and it is better to make it more readable. For your suggestion I would need the ns_suffix always, so i decided to go a different way...to accomplish readability.
The result uses the "should_create_extra_tint" method only if no
__.tint_ns_<originalid>
exists already. To simplify a little more, i renamed the defaults tint_ns to__.tint_ns_0
- please let me know if you prefer the division to tint_ns and extra_namespacesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? The docs for
nvim_create_namespace
say:which if the goal here is to try to find an existing namespace or not, we can likely just call this function to "create or get", right? I have not gone through the code thoroughly yet so my interpretation of what you are trying to do here might be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessary for the changes to work.
While debugging I found a lot of hl-namespaces, and all had pretty clear namespace names, so everyone can figure out where they are coming from. Thats why I decided to go with a specific name depending on found colorscheme :)