Add missing files

This commit is contained in:
Alexander Gehrke 2023-01-23 14:47:01 +01:00
parent 903b28d533
commit 5ee962ee3c
4 changed files with 56 additions and 0 deletions

16
lua/conf/treesitter.lua Normal file
View file

@ -0,0 +1,16 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = { "typescript" },
sync_install = true,
auto_install = true,
highlight = {
enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
-- Using this option may slow down your editor, and you may see some duplicate highlights.
-- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false,
},
indent = {
enable = true
},
}

8
lua/lsp/installer.lua Normal file
View file

@ -0,0 +1,8 @@
local status, lsp_installer = pcall(require,"nvim-lsp-installer")
if (not status) then return end
lsp_installer.on_server_ready(function(server)
local opts = {}
server:setup(opts)
end)

19
lua/lsp/metals.lua Normal file
View file

@ -0,0 +1,19 @@
local status, metals = pcall(require, "metals")
if (not status) then return function() end end
return function(on_attach)
metals_config = metals.bare_config()
metals_config.init_options.statusBarProvider = "on"
metals_config.settings = { showImplicitArguments = true }
metals_config.on_attach = on_attach
metals_config.capabilities = require("cmp_nvim_lsp").default_capabilities()
vim.cmd [[augroup lsp]]
vim.cmd [[au!]]
vim.cmd([[autocmd FileType scala setlocal omnifunc=v:lua.vim.lsp.omnifunc]])
vim.cmd [[au FileType scala,sbt lua require("metals").initialize_or_attach(metals_config)]]
vim.cmd [[augroup end]]
return metals_config
end

13
lua/lsp/typescript.lua Normal file
View file

@ -0,0 +1,13 @@
local status, nvim_lsp = pcall(require, "lspconfig")
if (not status) then return function() end end
return function(on_attach)
local protocol = require('vim.lsp.protocol')
-- TypeScript
nvim_lsp.tsserver.setup {
on_attach = on_attach,
filetypes = { "typescript", "typescriptreact", "typescript.tsx" },
cmd = { "typescript-language-server", "--stdio" }
}
end