mirror of
https://github.com/zoriya/dotfiles.git
synced 2025-12-06 06:36:17 +00:00
Adding a scala configuration
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.DS_Store
|
||||
@@ -54,6 +54,7 @@ local lsp_keymaps = function(bufnr)
|
||||
["<leader>l"] = {
|
||||
r = { '<cmd>lua vim.lsp.buf.rename()<CR>', "Rename" },
|
||||
a = { '<cmd>lua vim.lsp.buf.code_action()<CR>', "Code action" },
|
||||
l = { '<cmd>lua vim.lsp.codelens.run()<CR>', "Run code lens" },
|
||||
f = { '<cmd>lua vim.lsp.buf.formatting()<CR>', "Format" },
|
||||
}
|
||||
}, {
|
||||
@@ -61,9 +62,14 @@ local lsp_keymaps = function(bufnr)
|
||||
})
|
||||
end
|
||||
|
||||
local lsp_codelens = function()
|
||||
-- vim.cmd [[ autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh() ]]
|
||||
end
|
||||
|
||||
M.on_attach = function(client, bufnr)
|
||||
lsp_keymaps(bufnr)
|
||||
lsp_highlight_document(client)
|
||||
lsp_codelens()
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
@@ -2,4 +2,5 @@ require "lsp.lsp-install"
|
||||
require("lsp.handlers").setup()
|
||||
require "lsp.cmp"
|
||||
require "lsp.signature"
|
||||
require "lsp.metals"
|
||||
|
||||
|
||||
32
nvim/nvim/config/nvim.ln/lua/lsp/metals.lua
Normal file
32
nvim/nvim/config/nvim.ln/lua/lsp/metals.lua
Normal file
@@ -0,0 +1,32 @@
|
||||
local ok, metals = pcall(require, "metals")
|
||||
if not ok then
|
||||
return
|
||||
end
|
||||
|
||||
-- NOTE: You may or may not want java included here. You will need it if you want basic Java support
|
||||
-- but it may also conflict if you are using something like nvim-jdtls which also works on a java filetype
|
||||
-- autocmd.
|
||||
vim.cmd [[
|
||||
augroup lsp
|
||||
au!
|
||||
au FileType java,scala,sbt lua require("metals").initialize_or_attach(metals_config)
|
||||
augroup end
|
||||
]]
|
||||
|
||||
metals_config = metals.bare_config()
|
||||
|
||||
-- Example of settings
|
||||
metals_config.settings = {
|
||||
showImplicitArguments = true,
|
||||
}
|
||||
metals_config.on_attach = function(client, bufnr)
|
||||
metals.setup_dap()
|
||||
require "lsp.handlers".on_attach(client, bufnr)
|
||||
end
|
||||
|
||||
local tok, telescope = pcall(require, "telescope")
|
||||
if not tok then
|
||||
return
|
||||
end
|
||||
telescope.load_extension('metals')
|
||||
|
||||
@@ -79,6 +79,7 @@ return packer.startup(function(use)
|
||||
'williamboman/nvim-lsp-installer',
|
||||
}
|
||||
use "Hoffs/omnisharp-extended-lsp.nvim"
|
||||
use({'scalameta/nvim-metals', requires = { "nvim-lua/plenary.nvim" }})
|
||||
use "b0o/schemastore.nvim"
|
||||
use {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
|
||||
Reference in New Issue
Block a user