Skip to content

Commit

Permalink
disable treesitter textojects due to a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbuhr committed Jun 29, 2024
1 parent dbd2460 commit d817c7e
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
4 changes: 1 addition & 3 deletions lua/config/keymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -299,13 +299,11 @@ wk.register({
f = { '<cmd>Telescope find_files<cr>', '[f]iles' },
h = { '<cmd>Telescope help_tags<cr>', '[h]elp' },
k = { '<cmd>Telescope keymaps<cr>', '[k]eymaps' },
r = { '<cmd>Telescope lsp_references<cr>', '[r]eferences' },
g = { '<cmd>Telescope live_grep<cr>', '[g]rep' },
b = { '<cmd>Telescope current_buffer_fuzzy_find<cr>', '[b]uffer fuzzy find' },
m = { '<cmd>Telescope marks<cr>', '[m]arks' },
M = { '<cmd>Telescope man_pages<cr>', '[M]an pages' },
c = { '<cmd>Telescope git_commits<cr>', 'git [c]ommits' },
s = { '<cmd>Telescope lsp_document_symbols<cr>', 'document [s]ymbols' },
['<space>'] = { '<cmd>Telescope buffers<cr>', '[ ] buffers' },
d = { '<cmd>Telescope buffers<cr>', '[d] buffers' },
q = { '<cmd>Telescope quickfix<cr>', '[q]uickfix' },
Expand Down Expand Up @@ -347,7 +345,7 @@ wk.register({
},
l = {
name = '[l]anguage/lsp',
r = { '<cmd>Telescope lsp_references<cr>', '[r]eferences' },
r = { vim.lsp.buf.references, '[r]eferences' },
R = { '[R]ename' },
D = { vim.lsp.buf.type_definition, 'type [D]efinition' },
a = { vim.lsp.buf.code_action, 'code [a]ction' },
Expand Down
2 changes: 1 addition & 1 deletion lua/plugins/completion.lua
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ return {
},
},
sources = {
{ name = 'otter' }, -- for code chunks in quarto
-- { name = 'otter' }, -- for code chunks in quarto
{ name = 'path' },
{ name = 'nvim_lsp' },
{ name = 'nvim_lsp_signature_help' },
Expand Down
1 change: 1 addition & 0 deletions lua/plugins/editing.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ return {
formatters_by_ft = {
lua = { 'mystylua' },
python = { 'isort', 'black' },
quarto = { 'injected' },
},
formatters = {
mystylua = {
Expand Down
18 changes: 10 additions & 8 deletions lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ return {
vim.api.nvim_create_autocmd('LspAttach', {
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
callback = function(event)
local telescope = require 'telescope.builtin'
local function map(keys, func, desc)
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end
local function vmap(keys, func, desc)
vim.keymap.set('v', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
end

local client = vim.lsp.get_client_by_id(event.data.client_id)
assert(client, 'LSP client not found')
Expand All @@ -110,6 +112,7 @@ return {
map('<leader>ll', vim.lsp.codelens.run, '[l]ens run')
map('<leader>lR', vim.lsp.buf.rename, '[l]sp [R]ename')
map('<leader>lf', vim.lsp.buf.format, '[l]sp [f]ormat')
vmap('<leader>lf', vim.lsp.buf.format, '[l]sp [f]ormat')
map('<leader>lq', vim.diagnostic.setqflist, '[l]sp diagnostic [q]uickfix')
end,
})
Expand All @@ -119,11 +122,10 @@ return {
debounce_text_changes = 150,
}

local telescope_builtin = require 'telescope.builtin'
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(vim.lsp.handlers.hover, { border = require('misc.style').border })
vim.lsp.handlers['textDocument/signatureHelp'] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = require('misc.style').border })
-- TODO: handle this
vim.lsp.handlers['textDocument/references'] = telescope_builtin.lsp_references
-- vim.lsp.handlers['textDocument/references'] = telescope_builtin.lsp_references

local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
Expand All @@ -133,11 +135,11 @@ return {
-- $home/.config/marksman/config.toml :
-- [core]
-- markdown.file_extensions = ["md", "markdown", "qmd"]
-- lspconfig.marksman.setup {
-- capabilities = capabilities,
-- filetypes = { 'markdown', 'quarto' },
-- root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'),
-- }
lspconfig.marksman.setup {
capabilities = capabilities,
filetypes = { 'markdown', 'quarto' },
root_dir = util.root_pattern('.git', '.marksman.toml', '_quarto.yml'),
}

lspconfig.r_language_server.setup {
capabilities = capabilities,
Expand Down
8 changes: 7 additions & 1 deletion lua/plugins/treesitter.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
return {
{
'nvim-treesitter/nvim-treesitter',
dev = false,
dependencies = {
{ 'nvim-treesitter/nvim-treesitter-textobjects' },
-- {
-- -- currently broken for R
-- 'nvim-treesitter/nvim-treesitter-textobjects',
-- dev = false,
-- enabled = false,
-- },
},
run = ':TSUpdate',
config = function()
Expand Down

0 comments on commit d817c7e

Please sign in to comment.