Add option to disable ts virtual_text

Fixes #191
Closes #188
This commit is contained in:
Andy K. Massimino
2021-11-04 22:05:34 -04:00
parent 42c91ec8cc
commit 50cadec5e6
2 changed files with 5 additions and 3 deletions

View File

@@ -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]],

View File

@@ -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)