Files
zed/crates/vim/test_data/test_matching_preprocessor_directives.json
T
Juan Pablo Briones fcac255570 vim: Fix % for multiline comments and preprocessor directives (#53148)
Implements:
[49806](https://github.com/zed-industries/zed/discussions/49806)
Closes: [24820](https://github.com/zed-industries/zed/issues/24820)

Zeds impl of `%` didn't handle preprocessor directives and multiline

To implement this feature for multiline comment, a tree-sitter query is
used to check if we are inside a comment range
and then replicate the logic used in brackets.

For preprocessor directives using `TextObjects` wasn't a option, so it
was implemented through a text based query
that searches for the next preprocessor directives. Using text based
queries might not be the best for performance, so I'm open to any
suggestions.

Release Notes:

- Fixed vim's matching '%' to handle multiline comments `/* */` and
preprocessor directives `#if #else #endif`.
2026-04-07 02:51:54 +00:00

19 lines
704 B
JSON

{"Put":{"state":"#ˇif\n\n#else\n\n#endif\n"}}
{"Key":"%"}
{"Get":{"state":"#if\n\nˇ#else\n\n#endif\n","mode":"Normal"}}
{"Key":"%"}
{"Get":{"state":"#if\n\n#else\n\nˇ#endif\n","mode":"Normal"}}
{"Key":"%"}
{"Get":{"state":"ˇ#if\n\n#else\n\n#endif\n","mode":"Normal"}}
{"Put":{"state":"#ˇif\n #if\n\n #else\n\n #endif\n\n#else\n#endif\n"}}
{"Key":"%"}
{"Get":{"state":"#if\n #if\n\n #else\n\n #endif\n\nˇ#else\n#endif\n","mode":"Normal"}}
{"Key":"%"}
{"Key":"%"}
{"Get":{"state":"ˇ#if\n #if\n\n #else\n\n #endif\n\n#else\n#endif\n","mode":"Normal"}}
{"Key":"j"}
{"Key":"%"}
{"Key":"%"}
{"Key":"%"}
{"Get":{"state":"#if\n ˇ#if\n\n #else\n\n #endif\n\n#else\n#endif\n","mode":"Normal"}}