adding gradle support
This commit is contained in:
parent
df597acb32
commit
7de2e678fd
|
|
@ -5,3 +5,4 @@ test.sh
|
||||||
nvim
|
nvim
|
||||||
|
|
||||||
spell/
|
spell/
|
||||||
|
.DS_Store
|
||||||
169
init.lua
169
init.lua
|
|
@ -796,6 +796,93 @@ require('lazy').setup({
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'j-hui/fidget.nvim',
|
||||||
|
opts = {},
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"olimorris/codecompanion.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
-- Optional but nice:
|
||||||
|
--"hrsh7th/nvim-cmp", -- for chat buffer completion
|
||||||
|
"nvim-telescope/telescope.nvim", -- for action palette
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
-- Global plugin options
|
||||||
|
opts = {
|
||||||
|
-- set to "DEBUG" or "TRACE" if you want verbose logs:
|
||||||
|
-- log_level = "DEBUG",
|
||||||
|
},
|
||||||
|
|
||||||
|
----------------------------------------------------------------
|
||||||
|
-- Use Ollama as default adapter
|
||||||
|
----------------------------------------------------------------
|
||||||
|
-- Ollama is supported out-of-the-box as an HTTP adapter.
|
||||||
|
-- This assumes `ollama serve` is running on 127.0.0.1:11434.
|
||||||
|
strategies = {
|
||||||
|
chat = {
|
||||||
|
adapter = "litellm",
|
||||||
|
},
|
||||||
|
inline = {
|
||||||
|
adapter = "litellm",
|
||||||
|
},
|
||||||
|
cmd = {
|
||||||
|
adapter = "litellm",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Optional: customize the built-in Ollama adapter (e.g. default model)
|
||||||
|
adapters = {
|
||||||
|
http = {
|
||||||
|
litellm = function()
|
||||||
|
-- `openai_compatible` is meant exactly for gateways like LiteLLM
|
||||||
|
return require("codecompanion.adapters").extend("openai_compatible", {
|
||||||
|
env = {
|
||||||
|
-- URL of your LiteLLM proxy / gateway
|
||||||
|
-- (default Quickstart is http://0.0.0.0:4000) :contentReference[oaicite:0]{index=0}
|
||||||
|
url = "http://127.0.0.1:4000",
|
||||||
|
|
||||||
|
-- Name of the ENV VAR that holds your LiteLLM API key
|
||||||
|
-- If your proxy accepts any key, you can do:
|
||||||
|
-- export LITELLM_API_KEY='anything'
|
||||||
|
api_key = "sk-1234",
|
||||||
|
|
||||||
|
-- LiteLLM’s OpenAI-style chat endpoint
|
||||||
|
-- (by default it exposes `/chat/completions` for chat) :contentReference[oaicite:1]{index=1}
|
||||||
|
chat_url = "/chat/completions",
|
||||||
|
},
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
["Content-Type"] = "application/json",
|
||||||
|
-- `${api_key}` gets replaced with the resolved env value
|
||||||
|
["Authorization"] = "Bearer ${api_key}",
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Default model LiteLLM should route to
|
||||||
|
-- Must match the *model_name* you configured in litellm_config.yaml
|
||||||
|
-- e.g. "ollama/qwen2.5-coder" or "gpt-4o", etc.
|
||||||
|
schema = {
|
||||||
|
model = {
|
||||||
|
default = "ollama/gemma3:4b",
|
||||||
|
--default = "eu.anthropic.claude-3-7-sonnet-20250219-v1:0",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Optional, but nice: force streaming
|
||||||
|
parameters = {
|
||||||
|
stream = true,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
{ -- Autoformat
|
{ -- Autoformat
|
||||||
'stevearc/conform.nvim',
|
'stevearc/conform.nvim',
|
||||||
event = { 'BufWritePre' },
|
event = { 'BufWritePre' },
|
||||||
|
|
@ -1095,6 +1182,8 @@ require('lazy').setup({
|
||||||
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
|
||||||
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
-- init.lua. If you want these files, they are in the repository, so you can just download them and
|
||||||
-- place them in the correct locations.
|
-- place them in the correct locations.
|
||||||
|
|
@ -1115,32 +1204,64 @@ require('lazy').setup({
|
||||||
|
|
||||||
-- Scala language support
|
-- Scala language support
|
||||||
{
|
{
|
||||||
'scalameta/nvim-metals',
|
'scalameta/nvim-metals',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
'nvim-lua/plenary.nvim',
|
{
|
||||||
|
'j-hui/fidget.nvim',
|
||||||
|
opts = {},
|
||||||
},
|
},
|
||||||
ft = { 'scala', 'sbt' },
|
--{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
opts = function()
|
-- IMPORTANT: no need to depend on nvim-dap here anymore
|
||||||
local metals_config = require('metals').bare_config()
|
|
||||||
metals_config.settings = {
|
|
||||||
showImplicitArguments = true,
|
|
||||||
showInferredType = true,
|
|
||||||
excludedPackages = { 'akka.actor.typed.javadsl', 'com.github.swagger.akka.javadsl' },
|
|
||||||
}
|
|
||||||
metals_config.capabilities = require('blink.cmp').get_lsp_capabilities()
|
|
||||||
return metals_config
|
|
||||||
end,
|
|
||||||
config = function(self, metals_config)
|
|
||||||
local nvim_metals_group = vim.api.nvim_create_augroup('nvim-metals', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
pattern = self.ft,
|
|
||||||
callback = function()
|
|
||||||
require('metals').initialize_or_attach(metals_config)
|
|
||||||
end,
|
|
||||||
group = nvim_metals_group,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
},
|
},
|
||||||
|
ft = { 'scala', 'sbt', 'java' },
|
||||||
|
opts = function()
|
||||||
|
local metals_config = require('metals').bare_config()
|
||||||
|
|
||||||
|
metals_config.settings = {
|
||||||
|
showImplicitArguments = true,
|
||||||
|
gradleScript = vim.fn.getcwd() .. '/gradlew',
|
||||||
|
customProjectRoot = vim.fn.getcwd(),
|
||||||
|
excludedPackages = { 'akka.actor.typed.javadsl', 'com.github.swagger.akka.javadsl' },
|
||||||
|
}
|
||||||
|
|
||||||
|
metals_config.init_options.statusBarProvider = 'off'
|
||||||
|
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
local ok, cmp_lsp = pcall(require, 'cmp_nvim_lsp')
|
||||||
|
if ok then
|
||||||
|
capabilities = cmp_lsp.default_capabilities(capabilities)
|
||||||
|
end
|
||||||
|
metals_config.capabilities = capabilities
|
||||||
|
|
||||||
|
metals_config.on_attach = function(client, bufnr)
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
-- THIS LINE IS CRITICAL FOR DEBUGGING:
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
require('metals').setup_dap()
|
||||||
|
|
||||||
|
-- your LSP mappings ...
|
||||||
|
local map = vim.keymap.set
|
||||||
|
map('n', 'gD', vim.lsp.buf.definition)
|
||||||
|
map('n', 'K', vim.lsp.buf.hover)
|
||||||
|
-- (rest of your mappings: gi, gr, gds, gws, etc…)
|
||||||
|
|
||||||
|
-- you can now drop the old dap keymaps here,
|
||||||
|
-- since they live in your unified nvim-dap config
|
||||||
|
end
|
||||||
|
|
||||||
|
return metals_config
|
||||||
|
end,
|
||||||
|
config = function(self, metals_config)
|
||||||
|
local nvim_metals_group = vim.api.nvim_create_augroup('nvim-metals', { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
|
pattern = self.ft,
|
||||||
|
callback = function()
|
||||||
|
require('metals').initialize_or_attach(metals_config)
|
||||||
|
end,
|
||||||
|
group = nvim_metals_group,
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||||
-- This is the easiest way to modularize your config.
|
-- This is the easiest way to modularize your config.
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
{
|
|
||||||
"LuaSnip": { "branch": "master", "commit": "5a1e39223db9a0498024a77b8441169d260c8c25" },
|
|
||||||
"blink.cmp": { "branch": "main", "commit": "b19413d214068f316c78978b08264ed1c41830ec" },
|
|
||||||
"codecompanion.nvim": { "branch": "main", "commit": "e7762c68daf24c3e356401f5223eeb5217047754" },
|
|
||||||
"conform.nvim": { "branch": "master", "commit": "4993e07fac6679d0a5005aa7499e0bad2bd39f19" },
|
|
||||||
"copilot.vim": { "branch": "release", "commit": "f89e977c87180519ba3b942200e3d05b17b1e2fc" },
|
|
||||||
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
|
|
||||||
"fidget.nvim": { "branch": "main", "commit": "e32b672d8fd343f9d6a76944fedb8c61d7d8111a" },
|
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "cdafc320f03f2572c40ab93a4eecb733d4016d07" },
|
|
||||||
"guess-indent.nvim": { "branch": "main", "commit": "84a4987ff36798c2fc1169cbaff67960aed9776f" },
|
|
||||||
"iron.nvim": { "branch": "master", "commit": "746414e67adcd3ad2ad5dbe6262543b55ac3f3cd" },
|
|
||||||
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
|
|
||||||
"lazydev.nvim": { "branch": "main", "commit": "5231c62aa83c2f8dc8e7ba957aa77098cda1257d" },
|
|
||||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "7d527c76c43f46294de9c19d39c5a86317809b4b" },
|
|
||||||
"mason-nvim-dap.nvim": { "branch": "main", "commit": "9a10e096703966335bd5c46c8c875d5b0690dade" },
|
|
||||||
"mason-tool-installer.nvim": { "branch": "main", "commit": "517ef5994ef9d6b738322664d5fdd948f0fdeb46" },
|
|
||||||
"mason.nvim": { "branch": "main", "commit": "57e5a8addb8c71fb063ee4acda466c7cf6ad2800" },
|
|
||||||
"mini.nvim": { "branch": "main", "commit": "72b0194c56c984476c5975b62eb340fd1aa1686a" },
|
|
||||||
"neo-tree.nvim": { "branch": "main", "commit": "f3df514fff2bdd4318127c40470984137f87b62e" },
|
|
||||||
"nui.nvim": { "branch": "main", "commit": "de740991c12411b663994b2860f1a4fd0937c130" },
|
|
||||||
"nvim-dap": { "branch": "master", "commit": "5860c7c501eb428d3137ee22c522828d20cca0b3" },
|
|
||||||
"nvim-dap-python": { "branch": "master", "commit": "64652d1ae1db80870d9aac7132d76e37acd86a26" },
|
|
||||||
"nvim-dap-ui": { "branch": "master", "commit": "cf91d5e2d07c72903d052f5207511bf7ecdb7122" },
|
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "30a2b191bccf541ce1797946324c9329e90ec448" },
|
|
||||||
"nvim-metals": { "branch": "main", "commit": "40f7b9ea6ded898319136f4d6a94da9487584309" },
|
|
||||||
"nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" },
|
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" },
|
|
||||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "5ca4aaa6efdcc59be46b95a3e876300cfead05ef" },
|
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "8dcb311b0c92d460fac00eac706abd43d94d68af" },
|
|
||||||
"plenary.nvim": { "branch": "master", "commit": "b9fd5226c2f76c951fc8ed5923d85e4de065e509" },
|
|
||||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "6fea601bd2b694c6f2ae08a6c6fab14930c60e2c" },
|
|
||||||
"telescope-ui-select.nvim": { "branch": "master", "commit": "6e51d7da30bd139a6950adf2a47fda6df9fa06d2" },
|
|
||||||
"telescope.nvim": { "branch": "master", "commit": "1f8a534a320dca8d73f6de58c2e8eea4dd4ced89" },
|
|
||||||
"todo-comments.nvim": { "branch": "main", "commit": "31e3c38ce9b29781e4422fc0322eb0a21f4e8668" },
|
|
||||||
"tokyonight.nvim": { "branch": "main", "commit": "5da1b76e64daf4c5d410f06bcb6b9cb640da7dfd" },
|
|
||||||
"which-key.nvim": { "branch": "main", "commit": "3aab2147e74890957785941f0c1ad87d0a44c15a" }
|
|
||||||
}
|
|
||||||
|
|
@ -1,14 +1,8 @@
|
||||||
-- debug.lua
|
|
||||||
--
|
|
||||||
-- Unified debugging configuration for multiple languages.
|
|
||||||
-- Supports Python (with debugpy) and Scala (with nvim-metals).
|
|
||||||
-- Can be extended to other languages as well.
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
-- Main DAP plugin
|
-- Main DAP plugin
|
||||||
'mfussenegger/nvim-dap',
|
'mfussenegger/nvim-dap',
|
||||||
dependencies = {
|
dependencies = {
|
||||||
-- Creates a beautiful debugger UI
|
-- DAP UI
|
||||||
'rcarriga/nvim-dap-ui',
|
'rcarriga/nvim-dap-ui',
|
||||||
|
|
||||||
-- Required dependency for nvim-dap-ui
|
-- Required dependency for nvim-dap-ui
|
||||||
|
|
@ -20,21 +14,9 @@ return {
|
||||||
|
|
||||||
-- Python debugging support
|
-- Python debugging support
|
||||||
'mfussenegger/nvim-dap-python',
|
'mfussenegger/nvim-dap-python',
|
||||||
|
|
||||||
-- Scala debugging and LSP support
|
|
||||||
{
|
|
||||||
'scalameta/nvim-metals',
|
|
||||||
ft = { 'scala', 'sbt', 'java' },
|
|
||||||
},
|
|
||||||
|
|
||||||
-- Fidget for LSP progress notifications
|
|
||||||
{
|
|
||||||
'j-hui/fidget.nvim',
|
|
||||||
opts = {},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
-- Unified keymaps for debugging (works for both Python and Scala)
|
-- Unified keymaps for debugging (works for both Python & Scala)
|
||||||
{ '<leader>dc', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
|
{ '<leader>dc', function() require('dap').continue() end, desc = 'Debug: Start/Continue' },
|
||||||
{ '<leader>dr', function() require('dap').repl.toggle() end, desc = 'Debug: Toggle REPL' },
|
{ '<leader>dr', function() require('dap').repl.toggle() end, desc = 'Debug: Toggle REPL' },
|
||||||
{ '<leader>dK', function() require('dap.ui.widgets').hover() end, desc = 'Debug: Hover Widget' },
|
{ '<leader>dK', function() require('dap.ui.widgets').hover() end, desc = 'Debug: Hover Widget' },
|
||||||
|
|
@ -43,7 +25,11 @@ return {
|
||||||
{ '<leader>dsi', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
|
{ '<leader>dsi', function() require('dap').step_into() end, desc = 'Debug: Step Into' },
|
||||||
{ '<leader>dl', function() require('dap').run_last() end, desc = 'Debug: Run Last' },
|
{ '<leader>dl', function() require('dap').run_last() end, desc = 'Debug: Run Last' },
|
||||||
{ '<leader>du', function() require('dapui').toggle() end, desc = 'Debug: Toggle DAP UI' },
|
{ '<leader>du', function() require('dapui').toggle() end, desc = 'Debug: Toggle DAP UI' },
|
||||||
{ '<leader>dB', function() require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') end, desc = 'Debug: Set Conditional Breakpoint' },
|
{ '<leader>dB', function()
|
||||||
|
require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ')
|
||||||
|
end,
|
||||||
|
desc = 'Debug: Set Conditional Breakpoint',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require 'dap'
|
local dap = require 'dap'
|
||||||
|
|
@ -81,16 +67,18 @@ return {
|
||||||
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
dap.listeners.before.event_terminated['dapui_config'] = dapui.close
|
||||||
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
dap.listeners.before.event_exited['dapui_config'] = dapui.close
|
||||||
|
|
||||||
-- === PYTHON DEBUGGING SETUP ===
|
---------------------------------------------------------------------------
|
||||||
|
-- PYTHON DEBUGGING SETUP
|
||||||
|
---------------------------------------------------------------------------
|
||||||
local function setup_python_debugging()
|
local function setup_python_debugging()
|
||||||
-- Function to find the best Python executable with debugpy
|
-- Function to find the best Python executable with debugpy
|
||||||
local function find_python_with_debugpy()
|
local function find_python_with_debugpy()
|
||||||
local python_candidates = {
|
local python_candidates = {
|
||||||
'~/.config/nvim/.venv/bin/python', -- nvim config venv
|
'~/.config/nvim/.venv/bin/python', -- nvim config venv
|
||||||
vim.fn.exepath('python3'), -- system python3
|
vim.fn.exepath('python3'), -- system python3
|
||||||
vim.fn.exepath('python'), -- system python
|
vim.fn.exepath('python'), -- system python
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, python_path in ipairs(python_candidates) do
|
for _, python_path in ipairs(python_candidates) do
|
||||||
if python_path and python_path ~= '' and vim.fn.executable(python_path) == 1 then
|
if python_path and python_path ~= '' and vim.fn.executable(python_path) == 1 then
|
||||||
-- Test if this python has debugpy
|
-- Test if this python has debugpy
|
||||||
|
|
@ -104,14 +92,15 @@ return {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Fallback to the nvim config venv
|
-- Fallback to the nvim config venv
|
||||||
return '~/.config/nvim/.venv/bin/python'
|
return '~/.config/nvim/.venv/bin/python'
|
||||||
end
|
end
|
||||||
|
|
||||||
require('dap-python').setup(find_python_with_debugpy())
|
require('dap-python').setup(find_python_with_debugpy())
|
||||||
|
|
||||||
-- Add Python debugging configurations
|
-- Add Python debugging configuration
|
||||||
|
dap.configurations.python = dap.configurations.python or {}
|
||||||
table.insert(dap.configurations.python, {
|
table.insert(dap.configurations.python, {
|
||||||
type = 'python',
|
type = 'python',
|
||||||
request = 'launch',
|
request = 'launch',
|
||||||
|
|
@ -130,103 +119,30 @@ return {
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- === SCALA DEBUGGING SETUP ===
|
---------------------------------------------------------------------------
|
||||||
local function setup_scala_debugging()
|
-- SCALA DEBUGGING SETUP (from your Metals config)
|
||||||
-- Scala DAP configurations
|
---------------------------------------------------------------------------
|
||||||
dap.configurations.scala = {
|
dap.configurations.scala = {
|
||||||
{
|
{
|
||||||
type = 'scala',
|
type = 'scala',
|
||||||
request = 'launch',
|
request = 'launch',
|
||||||
name = 'RunOrTest',
|
name = 'RunOrTest',
|
||||||
metals = {
|
metals = {
|
||||||
runType = 'runOrTestFile',
|
runType = 'runOrTestFile',
|
||||||
},
|
-- args = { "firstArg", "secondArg", "thirdArg" }, -- example
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
type = 'scala',
|
{
|
||||||
request = 'launch',
|
type = 'scala',
|
||||||
name = 'Test Target',
|
request = 'launch',
|
||||||
metals = {
|
name = 'Test Target',
|
||||||
runType = 'testTarget',
|
metals = {
|
||||||
},
|
runType = 'testTarget',
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
end
|
}
|
||||||
|
|
||||||
-- === METALS (SCALA LSP) SETUP ===
|
-- Initialize debugging support
|
||||||
local function setup_metals()
|
|
||||||
local metals_config = require('metals').bare_config()
|
|
||||||
|
|
||||||
metals_config.settings = {
|
|
||||||
showImplicitArguments = true,
|
|
||||||
gradleScript = vim.fn.getcwd() .. '/gradlew',
|
|
||||||
customProjectRoot = vim.fn.getcwd(),
|
|
||||||
excludedPackages = { 'akka.actor.typed.javadsl', 'com.github.swagger.akka.javadsl' },
|
|
||||||
}
|
|
||||||
|
|
||||||
metals_config.init_options.statusBarProvider = 'off'
|
|
||||||
-- metals_config.capabilities = require('cmp_nvim_lsp').default_capabilities()
|
|
||||||
|
|
||||||
metals_config.on_attach = function(client, bufnr)
|
|
||||||
require('metals').setup_dap()
|
|
||||||
|
|
||||||
-- Helper function for buffer-local keymaps
|
|
||||||
local function map(mode, lhs, rhs, opts)
|
|
||||||
opts = opts or {}
|
|
||||||
opts.buffer = bufnr
|
|
||||||
vim.keymap.set(mode, lhs, rhs, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- LSP mappings (Scala-specific)
|
|
||||||
map('n', 'gD', vim.lsp.buf.definition)
|
|
||||||
map('n', 'K', vim.lsp.buf.hover)
|
|
||||||
map('n', 'gi', vim.lsp.buf.implementation)
|
|
||||||
map('n', 'gr', vim.lsp.buf.references)
|
|
||||||
map('n', 'gds', vim.lsp.buf.document_symbol)
|
|
||||||
map('n', 'gws', vim.lsp.buf.workspace_symbol)
|
|
||||||
map('n', '<leader>cl', vim.lsp.codelens.run)
|
|
||||||
map('n', '<leader>sh', vim.lsp.buf.signature_help)
|
|
||||||
map('n', '<leader>rn', vim.lsp.buf.rename)
|
|
||||||
map('n', '<leader>f', vim.lsp.buf.format)
|
|
||||||
map('n', '<leader>ca', vim.lsp.buf.code_action)
|
|
||||||
|
|
||||||
-- Scala worksheet support
|
|
||||||
map('n', '<leader>ws', function()
|
|
||||||
require('metals').hover_worksheet()
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Diagnostic mappings
|
|
||||||
map('n', '<leader>aa', vim.diagnostic.setqflist) -- all workspace diagnostics
|
|
||||||
map('n', '<leader>ae', function() -- all workspace errors
|
|
||||||
vim.diagnostic.setqflist { severity = 'E' }
|
|
||||||
end)
|
|
||||||
map('n', '<leader>aw', function() -- all workspace warnings
|
|
||||||
vim.diagnostic.setqflist { severity = 'W' }
|
|
||||||
end)
|
|
||||||
map('n', '<leader>d', vim.diagnostic.setloclist) -- buffer diagnostics only
|
|
||||||
|
|
||||||
map('n', '[c', function()
|
|
||||||
vim.diagnostic.goto_prev { wrap = false }
|
|
||||||
end)
|
|
||||||
map('n', ']c', function()
|
|
||||||
vim.diagnostic.goto_next { wrap = false }
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Auto-attach Metals for Scala files
|
|
||||||
local nvim_metals_group = vim.api.nvim_create_augroup('nvim-metals', { clear = true })
|
|
||||||
vim.api.nvim_create_autocmd('FileType', {
|
|
||||||
pattern = { 'scala', 'sbt', 'java' },
|
|
||||||
callback = function()
|
|
||||||
require('metals').initialize_or_attach(metals_config)
|
|
||||||
end,
|
|
||||||
group = nvim_metals_group,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Initialize debugging support for all languages
|
|
||||||
setup_python_debugging()
|
setup_python_debugging()
|
||||||
setup_scala_debugging()
|
|
||||||
setup_metals()
|
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue