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
Forgive me if this is a neovim specific issue, though I don't think it is --
The comment parsing in elixir seems to be done by block instead of by line. This makes it harder to do parsing in comments that go line by line. I understand this is a functionality I'm using in neovim, but it could just as easily be used in another client, like a treesitter-js client.
Comments show up as a block of quoted_context. This makes it difficult to use treesitter to parse where things like the examples may be.
Here's an example with Rust using line-by-line comment parsing, and you can use TS to parse each one to see if there may be code in the comment: https://ibb.co/XtKFjFL
The text was updated successfully, but these errors were encountered:
Parsing quoted_context by line would make it easier to inject these but you would be parsing markdown by regex which is a bit brittle. It would be more robust to inject markdown into the quoted_context node when it's a doc string. That wouldn't need any changes to tree-sitter-elixir and you would get all markdown highlighting in doc strings. (Also see tree-sitter/tree-sitter-rust#128 which attempts to make this possible for Rust.)
You could then make an elixir-specific markdown and assume that codeblocks are elixir or check if they're iex and use tree-sitter-iex (these changes to Helix: the-mikedavis/helix@204a2da; I'm not sure how that would look in neovim):
the-mikedavis
changed the title
Parsing Comment Strings Line By Line
Parsing Documentation Strings Line By Line
Dec 4, 2022
Regardless of how docstrings are highlighted, at the end of the day they are just strings, not comments, and I don't think we should break them into multiple lines in the AST. In Rust it's natural that each line is separate in the AST, because each line is denoted as a docstring individually with ///.
Forgive me if this is a neovim specific issue, though I don't think it is --
The comment parsing in elixir seems to be done by block instead of by line. This makes it harder to do parsing in comments that go line by line. I understand this is a functionality I'm using in neovim, but it could just as easily be used in another client, like a treesitter-js client.
Here's an example:
Elixir: https://ibb.co/G7QK5Hr
Comments show up as a block of
quoted_context
. This makes it difficult to use treesitter to parse where things like the examples may be.Here's an example with Rust using line-by-line comment parsing, and you can use TS to parse each one to see if there may be code in the comment: https://ibb.co/XtKFjFL
The text was updated successfully, but these errors were encountered: