zed/crates/vim/test_data/test_matching_preprocessor_directives.json
Juan Pablo Briones 0bcf71f786
vim: Add C preprocessor check in matching function (#55515)
Closes #24820

This PR fixes the bug specified in issue
https://github.com/zed-industries/zed/issues/24820, now the matching
function checks if the cursor is above a comment or a directive before
defaulting to a bracket range as neovim does.

It also fixes fixes the `line_end` calculations so that when `%` is
pressed inside a bracket range


https://github.com/user-attachments/assets/f59daa6f-9769-45e8-bb8c-2d533470b59d

Release Notes:

- `fn matching()` checks for `preprocessor directives` or `comments`
before defaulting to any bracket range.
- In `fn matching()`line_end calculations avoid expanding a blank
current line into start..EOF.
2026-05-07 04:25:42 +00:00

24 lines
951 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\n#endif\n"}}
{"Key":"%"}
{"Get":{"state":"#if\n #if\n\n #else\n\n #endif\n\nˇ#else\n\n#endif\n","mode":"Normal"}}
{"Key":"%"}
{"Key":"%"}
{"Get":{"state":"ˇ#if\n #if\n\n #else\n\n #endif\n\n#else\n\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\n#endif\n","mode":"Normal"}}
{"Put":{"state":"#if definedˇ(something)\n\n#endif\n"}}
{"Key":"%"}
{"Get":{"state":"#if defined(somethingˇ)\n\n#endif\n","mode":"Normal"}}
{"Key":"0"}
{"Key":"%"}
{"Get":{"state":"#if defined(something)\n\nˇ#endif\n","mode":"Normal"}}