Skip to content

Commit

Permalink
Fix highlighting for matchit namespaces with french quotes.
Browse files Browse the repository at this point in the history
Really this test isn't sufficient because the issue was only
highlighting, not which line we'd jump to, but we can come back and beef
up the test.
  • Loading branch information
Julian committed Sep 15, 2024
1 parent 93bd81a commit 530a75e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ftplugin/lean/lean.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if vim.g.loaded_matchit and not vim.b.match_words then
vim.b.match_ignorecase = 0
vim.b.match_words = vim
.iter({
[[\<\%(namespace\|section\)\s\+\(.\{-}\)\>:\<end\s\+\1\>]],
[[\<\%(namespace\|section\)\s\+\([^«»]\{-}\>\|«.\{-}»\):\<end\s\+\1]],
[[^\s*section\s*$:^end\s*$]],
[[\<if\>:\<then\>:\<else\>]],
})
Expand Down
23 changes: 23 additions & 0 deletions spec/matchit_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,29 @@ describe('matchit', function()
)
)

it(
'jumps between namespaces named with french quote names',
helpers.clean_buffer(
[[
namespace «1.2»
section bar
def f := 37
end bar
end «1.2»
]],
function()
vim.cmd.normal 'gg'
assert.current_line.is 'namespace «1.2»'
vim.cmd.normal '%'
assert.current_line.is 'end «1.2»'
end
)
)

it(
'jumps between if/then/else',
helpers.clean_buffer(
Expand Down

0 comments on commit 530a75e

Please sign in to comment.