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

feature: Include language injections for Treesitter node selections #242

Closed
1 task done
Trildar opened this issue Sep 15, 2023 · 1 comment · Fixed by #260
Closed
1 task done

feature: Include language injections for Treesitter node selections #242

Trildar opened this issue Sep 15, 2023 · 1 comment · Fixed by #260
Labels
enhancement New feature or request

Comments

@Trildar
Copy link

Trildar commented Sep 15, 2023

Did you check the docs?

  • I have read all the flash.nvim docs

Is your feature request related to a problem? Please describe.

When writing in languages that use language injections in their parsers, e.g. Astro, Flash Treesitter mode does not allow selecting nodes inside of language injections.

Describe the solution you'd like

Include nodes from language injections in Flash Treesitter selection.

Excuse me if I'm wrong, but I think this can be done just by including ignore_injections = false in the call to LanguageTree:named_node_for_range.

Describe alternatives you've considered

A configuration option could also be added for whether language injections should be skipped, though I'm not sure what situations that would be useful for.

EDIT: After trying it I realised that the TSNode:parent() traversal apparently does not cross outside of a language injection (which seems odd to me, but suppose that's for Neovim or Treesitter to decide, not sure which one is responsible). So I suppose having a config would make more sense because of that.

Additional context

No response

@Trildar Trildar added the enhancement New feature or request label Sep 15, 2023
@folke folke closed this as completed in 5fe47ba Oct 16, 2023
@folke
Copy link
Owner

folke commented Oct 16, 2023

It did work like that, but a change in Neovim disabled that by default. Fixed now

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

Successfully merging a pull request may close this issue.

2 participants