Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Choose when to highlight more dynamically #260

Open
korreman opened this issue Mar 9, 2024 · 2 comments
Open

Choose when to highlight more dynamically #260

korreman opened this issue Mar 9, 2024 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers prio:high High priority (user-visible impact, etc.)

Comments

@korreman
Copy link
Contributor

korreman commented Mar 9, 2024

I currently get unsupported language: <lang> errors specifically when I first open a supported file, then open an unsupported file in a new window with :new edit <file>. The same error as can be achieved by changing kts_lang to some nonsense.

Issue seems to be that a highlight-enable request is sent for the new client with the language of the previous window. A correct request is sent and denied right after, but by then highlighting has already been enabled. I think the more general issue is that we decide whether to highlight or not when a window is opened, and then never again.

A more reliable behavior might be to re-decide whether to highlight a buffer whenever its kts_lang is changed. For this to work, a hook would need to update kts_lang whenever filetype is changed. By removing this specific hook, you could then also get dynamic control over the highlighting though kts_lang.

@hadronized
Copy link
Owner

Indeed, I thought I had that hook lying around already. We can simply put this in it.

@hadronized hadronized added the bug Something isn't working label Mar 14, 2024
@hadronized hadronized added this to the kak-tree-sitter v0.6 milestone Mar 14, 2024
@hadronized hadronized added the good first issue Good for newcomers label Mar 14, 2024
@hadronized
Copy link
Owner

I need to make a release of KTS but this is not going to be included because it’s a breaking change; I’m moving it to the next major.

@hadronized hadronized added the prio:high High priority (user-visible impact, etc.) label Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working good first issue Good for newcomers prio:high High priority (user-visible impact, etc.)
Projects
None yet
Development

No branches or pull requests

2 participants