Skip to content

Commit 2d00eaf

Browse files
Anthony-Fiddessfrick
authored andcommitted
Fix Mason setup issue and run stylua.
1 parent 58a8724 commit 2d00eaf

File tree

1 file changed

+21
-24
lines changed

1 file changed

+21
-24
lines changed

init.lua

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ require('lazy').setup({
8181
'neovim/nvim-lspconfig',
8282
dependencies = {
8383
-- Automatically install LSPs to stdpath for neovim
84-
{ 'williamboman/mason.nvim', config = true },
84+
'williamboman/mason.nvim',
8585
'williamboman/mason-lspconfig.nvim',
8686

8787
-- Useful status updates for LSP
@@ -178,7 +178,7 @@ require('lazy').setup({
178178
'lukas-reineke/indent-blankline.nvim',
179179
-- Enable `lukas-reineke/indent-blankline.nvim`
180180
-- See `:help indent_blankline.txt`
181-
main = "ibl",
181+
main = 'ibl',
182182
opts = {},
183183
},
184184

@@ -331,26 +331,18 @@ vim.keymap.set('n', '<leader>sr', require('telescope.builtin').resume, { desc =
331331

332332
-- [[ Configure Treesitter ]]
333333
-- See `:help nvim-treesitter`
334-
require('nvim-treesitter.configs').setup {
335-
-- Add languages to be installed here that you want installed for treesitter
336-
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'java', 'json', 'yaml', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
337-
338-
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
339-
auto_install = false,
340-
341-
highlight = { enable = true },
342-
indent = { enable = true },
343-
incremental_selection = {
344-
enable = true,
345-
keymaps = {
346-
init_selection = '<c-space>',
347-
node_incremental = '<c-space>',
348-
scope_incremental = '<c-s>',
349-
node_decremental = '<M-space>',
350-
},
351-
},
352-
textobjects = {
353-
select = {
334+
-- Defer Treesitter setup after first render to improve startup time of 'nvim {filename}'
335+
vim.defer_fn(function()
336+
require('nvim-treesitter.configs').setup {
337+
-- Add languages to be installed here that you want installed for treesitter
338+
ensure_installed = { 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'javascript', 'typescript', 'vimdoc', 'vim' },
339+
340+
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
341+
auto_install = false,
342+
343+
highlight = { enable = true },
344+
indent = { enable = true },
345+
incremental_selection = {
354346
enable = true,
355347
keymaps = {
356348
init_selection = '<c-space>',
@@ -459,15 +451,15 @@ local on_attach = function(_, bufnr)
459451
end
460452

461453
-- document existing key chains
462-
require('which-key').register({
454+
require('which-key').register {
463455
['<leader>c'] = { name = '[C]ode', _ = 'which_key_ignore' },
464456
['<leader>d'] = { name = '[D]ocument', _ = 'which_key_ignore' },
465457
['<leader>g'] = { name = '[G]it', _ = 'which_key_ignore' },
466458
['<leader>h'] = { name = 'More git', _ = 'which_key_ignore' },
467459
['<leader>r'] = { name = '[R]ename', _ = 'which_key_ignore' },
468460
['<leader>s'] = { name = '[S]earch', _ = 'which_key_ignore' },
469461
['<leader>w'] = { name = '[W]orkspace', _ = 'which_key_ignore' },
470-
})
462+
}
471463

472464
-- Enable the following language servers
473465
-- Feel free to add/remove any LSPs that you want here. They will automatically be installed.
@@ -501,6 +493,11 @@ require('neodev').setup()
501493
local capabilities = vim.lsp.protocol.make_client_capabilities()
502494
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
503495

496+
-- mason-lspconfig requires that these setup functions are called in this order
497+
-- before setting up the servers.
498+
require('mason').setup()
499+
require('mason-lspconfig').setup()
500+
504501
-- Ensure the servers above are installed
505502
local mason_lspconfig = require 'mason-lspconfig'
506503

0 commit comments

Comments
 (0)