metals improvements 2

This commit is contained in:
Salar Rahmanian 2023-02-11 13:59:53 -08:00
parent 7b6176d6d7
commit 89193f43b4
2 changed files with 49 additions and 7 deletions

View file

@ -2,13 +2,47 @@ return {
"nvim-lualine/lualine.nvim",
lazy = false,
config = function()
require("lualine").setup({
-- Default from its README then customized
-- Added metals status
require('lualine').setup {
options = {
icons_enabled = false,
theme = "tokyonight",
component_separators = "|",
section_separators = "",
icons_enabled = true,
theme = 'auto',
component_separators = { left = '', right = ''},
section_separators = { left = '', right = ''},
disabled_filetypes = {
statusline = {},
winbar = {},
},
ignore_focus = {},
always_divide_middle = true,
globalstatus = false,
refresh = {
statusline = 1000,
tabline = 1000,
winbar = 1000,
}
},
})
sections = {
lualine_a = {'mode'},
lualine_b = {'branch', 'diff', 'diagnostics'},
lualine_c = {'filename'},
lualine_x = {'g:metals_status', 'encoding', 'fileformat', 'filetype'},
lualine_y = {'progress'},
lualine_z = {'location'}
},
inactive_sections = {
lualine_a = {},
lualine_b = {},
lualine_c = {'filename'},
lualine_x = {'location'},
lualine_y = {},
lualine_z = {}
},
tabline = {},
winbar = {},
inactive_winbar = {},
extensions = {}
}
end,
}

View file

@ -10,19 +10,27 @@ return {
},
config = function()
local metals_config = require("metals").bare_config()
metals_config.tvp = {
icons = {
enabled = true,
},
}
metals_config.settings = {
serverVersion = "latest.snapshot",
showImplicitArguments = true,
showImplicitConversionsAndClasses = true,
showInferredType = true,
bloopSbtAlreadyInstalled = true,
excludedPackages = { "akka.actor.typed.javadsl", "com.github.swagger.akka.javadsl" },
fallbackScalaVersion = "2.13.8",
-- fallbackScalaVersion = "2.13.8",
superMethodLensesEnabled = true,
javaHome = "/Users/salar/.nix-profile",
}
metals_config.on_attach = function(client, bufnr)
vim.keymap.set("n", "<leader>tt", require("metals.tvp").toggle_tree_view)
vim.keymap.set("n", "<leader>tr", require("metals.tvp").reveal_in_tree)
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
vim.cmd([[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]])
vim.cmd([[autocmd BufEnter,CursorHold,InsertLeave <buffer> lua vim.lsp.codelens.refresh()]])