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

Commas are not represented as a word node #73

Open
hangyav opened this issue Feb 12, 2023 · 2 comments
Open

Commas are not represented as a word node #73

hangyav opened this issue Feb 12, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@hangyav
Copy link

hangyav commented Feb 12, 2023

Hi,

Thanks for the awesome tool. I'm working on a project where I'd like to extract the text content of latex files using TS (https://github.com/hangyav/textLSP). I noticed that commas aren't part of the preceding word's node but instead only part of the parent node, in contrast to how dots behave. Here's an example:

asciicast

Is that a bug or intentional for some reason? Thanks a lot!

@pfoerster
Copy link
Member

Is that a bug or intentional for some reason?

Its mainly this way for historic reasons. This grammar was extracted from texlab and texlab does not really care about dots and the general sentence structure. However, commas are significant because they can be used to separate arguments to commands like \ref or \cite so they need special treatment. I guess it wouldn't hurt to extract the dot into a separate token, too.

@pfoerster pfoerster added the enhancement New feature or request label Feb 14, 2023
@hangyav
Copy link
Author

hangyav commented Feb 15, 2023

I see, thanks for the clarification! Dots are actually fine for me as they are now. What would be great for me is to have commas in some type of leaf nodes as well (either together with the preceding word or as an individual node) instead of contained only by one of the-non leaf nodes (the section node in the example).

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

No branches or pull requests

2 participants