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

setting_value includes leading white space. #3

Open
dsully opened this issue Jan 11, 2023 · 1 comment
Open

setting_value includes leading white space. #3

dsully opened this issue Jan 11, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@dsully
Copy link

dsully commented Jan 11, 2023

Hi - I'm trying to add highlights for Neovim using tree-sitter-ini, and the grammar is capturing the leading white space for setting_value. I've included a screen shot showing the node match:

CleanShot 2023-01-10 at 19 47 06@2x

I think this is just a minor change to grammar.js, but this is my first venture into TS grammars.

Thanks

@justinmk justinmk added the bug Something isn't working label Jul 31, 2023
@justinmk
Copy link
Owner

Thanks for the report. This can be fixed with this patch:

diff --git a/grammar.js b/grammar.js
index d4bc82067a09..0c26d3bc421b 100644
--- a/grammar.js
+++ b/grammar.js
@@ -33,7 +33,7 @@ module.exports = grammar({
     setting: $ => seq(
       alias(/[^#=\s\[]+/, $.setting_name),
       '=',
-      alias(/.+/, $.setting_value),
+      alias(/[^\s]+.*/, $.setting_value),
       '\n',
     ),

but if I'm reading https://github.com/textmate/ini.tmbundle/blob/7d8c7b5544c48069a246fd2f43e965f06d03d3da/Syntaxes/Ini.plist#L97 correctly, it looks like it includes whitespace?

Isn't it possible (and common) that whitespace is important in INI values ? Especially trailing whitespace.

@justinmk justinmk added enhancement New feature or request and removed bug Something isn't working labels Sep 1, 2024
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