diff options
author | bfredl <bjorn.linse@gmail.com> | 2022-03-19 13:48:03 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2022-03-20 18:02:41 +0100 |
commit | 6eca9b69c4a1f40f27a6b41961af787327259de8 (patch) | |
tree | 5991bdfd77a3ad463edb54e39e4ee2a7b4841d37 /test | |
parent | 463738938d2f3ec4cff6f016937c3c02daae1184 (diff) | |
download | rneovim-6eca9b69c4a1f40f27a6b41961af787327259de8.tar.gz rneovim-6eca9b69c4a1f40f27a6b41961af787327259de8.tar.bz2 rneovim-6eca9b69c4a1f40f27a6b41961af787327259de8.zip |
feat(ui): allow conceal to be defined in decorations
Unlike syntax conceal, change highlight of concealed char
Can be used in tree-sitter using "conceal" metadata.
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/treesitter/highlight_spec.lua | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/functional/treesitter/highlight_spec.lua b/test/functional/treesitter/highlight_spec.lua index ed28d8a37d..5ec0a8a060 100644 --- a/test/functional/treesitter/highlight_spec.lua +++ b/test/functional/treesitter/highlight_spec.lua @@ -672,6 +672,46 @@ describe('treesitter highlighting', function() ]]} end) + it("supports conceal attribute", function() + if pending_c_parser(pending) then return end + insert(hl_text) + + -- conceal can be empty or a single cchar. + exec_lua [=[ + vim.opt.cole = 2 + local parser = vim.treesitter.get_parser(0, "c") + test_hl = vim.treesitter.highlighter.new(parser, {queries = {c = [[ + ("static" @keyword + (set! conceal "R")) + + ((identifier) @Identifier + (set! conceal "") + (eq? @Identifier "lstate")) + ]]}}) + ]=] + + screen:expect{grid=[[ + /// Schedule Lua callback on main loop's event queue | + {4:R} int nlua_schedule(lua_State *const ) | + { | + if (lua_type(, 1) != LUA_TFUNCTION | + || != ) { | + lua_pushliteral(, "vim.schedule: expected function"); | + return lua_error(); | + } | + | + LuaRef cb = nlua_ref(, 1); | + | + multiqueue_put(main_loop.events, nlua_schedule_event, | + 1, (void *)(ptrdiff_t)cb); | + return 0; | + ^} | + {1:~ }| + {1:~ }| + | + ]]} + end) + it("hl_map has the correct fallback behavior", function() exec_lua [[ local hl_map = vim.treesitter.highlighter.hl_map |