Skip to content

Commit

Permalink
fix: do not activate in special buffers (fixes #164) (#165)
Browse files Browse the repository at this point in the history
Check bufname and do not attach to special buffers, eg. 'fugitive://'
  • Loading branch information
osthomas authored Feb 2, 2025
1 parent 1cb2d24 commit bb710f4
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lua/quarto/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,20 @@ M.searchHelp = function(cmd_input)
vim.fn.jobstart(cmd)
end

-- from https://github.com/neovim/nvim-lspconfig/blob/f98fa715acc975c2dd5fb5ba7ceddeb1cc725ad2/lua/lspconfig/util.lua#L23
function M.bufname_valid(bufname)
if bufname:match '^/' or bufname:match '^[a-zA-Z]:' or bufname:match '^zipfile://' or bufname:match '^tarfile:' then
return true
end
return false
end

M.activate = function()
local bufname = vim.api.nvim_buf_get_name(0)
-- do not activate in special buffers, for example 'fugitive://...'
if not M.bufname_valid(bufname) then
return
end
local tsquery = nil
if cfg.config.lspFeatures.chunks == 'curly' then
tsquery = [[
Expand Down

0 comments on commit bb710f4

Please sign in to comment.