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

fix: Display context when injected language is not supported #401

Merged

Conversation

kwaszczuk
Copy link
Contributor

Fixes #400

Previously, when encountering an unsupported language (one without defined queries) while supporting injected languages, the plugin would abort execution. This behavior wasn't intentional, as even if a specific language isn't supported, we can still leverage insights from both parent and child languages to provide valuable context.

I've identified two approaches to address the unsupported language case. We can either maximize the amount of insights served to the user by skipping unsupported languages, or we can halt further evaluation once an unsupported language was found, displaying only the context calculated so far (replacing the return statement with break).

While the difference between the two approaches is mostly theoretical and applicable mainly to files with multiple injected languages, including one unsupported, I opted for the "skipping" approach. Its implementation isn't much more complicated than the other one, and potentially offers a better user experience.

@kwaszczuk kwaszczuk marked this pull request as ready for review February 19, 2024 00:40
@kwaszczuk kwaszczuk force-pushed the bugfix/skip-unsupported-languages branch from 346d83b to db8be70 Compare February 19, 2024 00:47
@lewis6991 lewis6991 merged commit fbeff2a into nvim-treesitter:master Feb 20, 2024
2 checks passed
@lewis6991
Copy link
Member

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Context header disappears with markdown_inline parser installed
2 participants