Skip to content

Commit

Permalink
Add option to disable ts virtual_text
Browse files Browse the repository at this point in the history
Fixes #191
Closes #188
  • Loading branch information
andymass committed Nov 5, 2021
1 parent 42c91ec commit 50cadec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion autoload/matchup/matchparen.vim
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,8 @@ function! s:add_matches(corrlist, ...) " {{{1
endif

if exists('s:ns_id')
if strlen(l:corr.match) == 0
if strlen(l:corr.match) == 0 && !matchup#ts_engine#get_option(
\ bufnr('%'), 'disable_virtual_text')
call nvim_buf_set_extmark(0, s:ns_id,
\ l:corr.lnum - 1, l:corr.cnum - 1, {
\ 'virt_text': [['' . a:corrlist[0].match, l:group]],
Expand Down
5 changes: 3 additions & 2 deletions lua/treesitter-matchup/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,10 +320,11 @@ local function opt_tbl_for_lang(opt, lang)
end

function M.get_option(bufnr, opt_name)
local config = configs.get_module('matchup')
local config = configs.get_module('matchup') or {}
local lang = parsers.get_buf_lang(bufnr)
if (opt_name == 'include_match_words'
or opt_name == 'additional_vim_regex_highlighting') then
or opt_name == 'additional_vim_regex_highlighting'
or opt_name == 'disable_virtual_text') then
return opt_tbl_for_lang(config[opt_name], lang)
end
error('invalid option ' .. opt_name)
Expand Down

0 comments on commit 50cadec

Please sign in to comment.