add vim-fugitive
parent
5636d0e913
commit
044d74b814
@ -0,0 +1,160 @@
|
|||||||
|
-- JDTLS (Java LSP) configuration
|
||||||
|
local home = vim.env.HOME -- Get the home directory
|
||||||
|
|
||||||
|
local jdtls = require 'jdtls'
|
||||||
|
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
|
||||||
|
local workspace_dir = home .. '/jdtls-workspace/' .. project_name
|
||||||
|
|
||||||
|
local system_os = ''
|
||||||
|
|
||||||
|
-- Determine OS
|
||||||
|
if vim.fn.has 'mac' == 1 then
|
||||||
|
system_os = 'mac'
|
||||||
|
elseif vim.fn.has 'unix' == 1 then
|
||||||
|
system_os = 'linux'
|
||||||
|
elseif vim.fn.has 'win32' == 1 or vim.fn.has 'win64' == 1 then
|
||||||
|
system_os = 'win'
|
||||||
|
else
|
||||||
|
print "OS not found, defaulting to 'linux'"
|
||||||
|
system_os = 'linux'
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Needed for debugging
|
||||||
|
local bundles = {
|
||||||
|
vim.fn.glob(home .. '/.local/share/nvim/mason/share/java-debug-adapter/com.microsoft.java.debug.plugin.jar'),
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Needed for running/debugging unit tests
|
||||||
|
vim.list_extend(bundles, vim.split(vim.fn.glob(home .. '/.local/share/nvim/mason/share/java-test/*.jar', 1), '\n'))
|
||||||
|
|
||||||
|
-- See `:help vim.lsp.start_client` for an overview of the supported `config` options.
|
||||||
|
local config = {
|
||||||
|
-- The command that starts the language server
|
||||||
|
-- See: https://github.com/eclipse/eclipse.jdt.ls#running-from-the-command-line
|
||||||
|
cmd = {
|
||||||
|
'/home/lucas/.sdkman/candidates/java/21.0.2-open/bin/java',
|
||||||
|
'-Declipse.application=org.eclipse.jdt.ls.core.id1',
|
||||||
|
'-Dosgi.bundles.defaultStartLevel=4',
|
||||||
|
'-Declipse.product=org.eclipse.jdt.ls.core.product',
|
||||||
|
'-Dlog.protocol=true',
|
||||||
|
'-Dlog.level=ALL',
|
||||||
|
'-javaagent:' .. home .. '/.local/share/nvim/mason/share/jdtls/lombok.jar',
|
||||||
|
'-Xmx4g',
|
||||||
|
'--add-modules=ALL-SYSTEM',
|
||||||
|
'--add-opens',
|
||||||
|
'java.base/java.util=ALL-UNNAMED',
|
||||||
|
'--add-opens',
|
||||||
|
'java.base/java.lang=ALL-UNNAMED',
|
||||||
|
|
||||||
|
-- Eclipse jdtls location
|
||||||
|
'-jar',
|
||||||
|
home .. '/.local/share/nvim/mason/share/jdtls/plugins/org.eclipse.equinox.launcher.jar',
|
||||||
|
'-configuration',
|
||||||
|
home .. '/.local/share/nvim/mason/packages/jdtls/config_' .. system_os,
|
||||||
|
'-data',
|
||||||
|
workspace_dir,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- This is the default if not provided, you can remove it. Or adjust as needed.
|
||||||
|
-- One dedicated LSP server & client will be started per unique root_dir
|
||||||
|
root_dir = vim.fs.root(0, { '.git', 'mvnw', 'gradlew' }),
|
||||||
|
|
||||||
|
-- Here you can configure eclipse.jdt.ls specific settings
|
||||||
|
-- See https://github.com/eclipse/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request
|
||||||
|
settings = {
|
||||||
|
java = {
|
||||||
|
home = '/home/lucas/.sdkman/candidates/java/21.0.2-open',
|
||||||
|
eclipse = {
|
||||||
|
downloadSources = true,
|
||||||
|
},
|
||||||
|
configuration = {
|
||||||
|
updateBuildConfiguration = 'interactive',
|
||||||
|
-- TODO Update this by adding any runtimes that you need to support your Java projects and removing any that you don't have installed
|
||||||
|
-- The runtime name parameters need to match specific Java execution environments. See https://github.com/tamago324/nlsp-settings.nvim/blob/2a52e793d4f293c0e1d61ee5794e3ff62bfbbb5d/schemas/_generated/jdtls.json#L317-L334
|
||||||
|
runtimes = {
|
||||||
|
{
|
||||||
|
name = 'JavaSE-11',
|
||||||
|
path = '/home/lucas/.sdkman/candidates/java/11.0.22-ms',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = 'JavaSE-21',
|
||||||
|
path = '/home/lucas/.sdkman/candidates/java/21.0.2-open',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
maven = {
|
||||||
|
downloadSources = true,
|
||||||
|
},
|
||||||
|
implementationsCodeLens = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
referencesCodeLens = {
|
||||||
|
enabled = true,
|
||||||
|
},
|
||||||
|
references = {
|
||||||
|
includeDecompiledSources = true,
|
||||||
|
},
|
||||||
|
signatureHelp = { enabled = true },
|
||||||
|
format = {
|
||||||
|
enabled = true,
|
||||||
|
-- Formatting works by default, but you can refer to a specific file/URL if you choose
|
||||||
|
-- settings = {
|
||||||
|
-- url = "https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml",
|
||||||
|
-- profile = "GoogleStyle",
|
||||||
|
-- },
|
||||||
|
},
|
||||||
|
completion = {
|
||||||
|
favoriteStaticMembers = {
|
||||||
|
'org.hamcrest.MatcherAssert.assertThat',
|
||||||
|
'org.hamcrest.Matchers.*',
|
||||||
|
'org.hamcrest.CoreMatchers.*',
|
||||||
|
'org.junit.jupiter.api.Assertions.*',
|
||||||
|
'java.util.Objects.requireNonNull',
|
||||||
|
'java.util.Objects.requireNonNullElse',
|
||||||
|
'org.mockito.Mockito.*',
|
||||||
|
},
|
||||||
|
importOrder = {
|
||||||
|
'java',
|
||||||
|
'javax',
|
||||||
|
'lombok',
|
||||||
|
'springfox',
|
||||||
|
'org',
|
||||||
|
'com',
|
||||||
|
'io',
|
||||||
|
'br',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
sources = {
|
||||||
|
organizeImports = {
|
||||||
|
starThreshold = 9999,
|
||||||
|
staticStarThreshold = 9999,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
codeGeneration = {
|
||||||
|
toString = {
|
||||||
|
template = '${object.className}{${member.name()}=${member.value}, ${otherMembers}}',
|
||||||
|
},
|
||||||
|
useBlocks = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
-- Needed for auto-completion with method signatures and placeholders
|
||||||
|
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||||
|
flags = {
|
||||||
|
allow_incremental_sync = true,
|
||||||
|
},
|
||||||
|
init_options = {
|
||||||
|
-- References the bundles defined above to support Debugging and Unit Testing
|
||||||
|
bundles = bundles,
|
||||||
|
extendedClientCapabilities = jdtls.extendedClientCapabilities,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Needed for debugging
|
||||||
|
config['on_attach'] = function(client, bufnr)
|
||||||
|
jdtls.setup_dap { hotcodereplace = 'auto' }
|
||||||
|
require('jdtls.dap').setup_dap_main_class_configs()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- This starts a new client & server, or attaches to an existing client & server based on the `root_dir`.
|
||||||
|
jdtls.start_or_attach(config)
|
@ -0,0 +1,28 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'rcasia/neotest-java',
|
||||||
|
ft = 'java',
|
||||||
|
dependencies = {
|
||||||
|
'mfussenegger/nvim-jdtls',
|
||||||
|
'mfussenegger/nvim-dap', -- for the debugger
|
||||||
|
'rcarriga/nvim-dap-ui', -- recommended
|
||||||
|
'theHamsta/nvim-dap-virtual-text', -- recommended
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'nvim-neotest/neotest',
|
||||||
|
dependencies = {
|
||||||
|
'rcasia/neotest-java',
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'nvim-treesitter/nvim-treesitter',
|
||||||
|
},
|
||||||
|
init = function()
|
||||||
|
require('neotest').setup {
|
||||||
|
adapters = {
|
||||||
|
require 'neotest-java' {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -0,0 +1,143 @@
|
|||||||
|
-- Debugging Support
|
||||||
|
return {
|
||||||
|
-- https://github.com/rcarriga/nvim-dap-ui
|
||||||
|
'rcarriga/nvim-dap-ui',
|
||||||
|
event = 'VeryLazy',
|
||||||
|
dependencies = {
|
||||||
|
-- https://github.com/mfussenegger/nvim-dap
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
-- https://github.com/nvim-neotest/nvim-nio
|
||||||
|
'nvim-neotest/nvim-nio',
|
||||||
|
-- https://github.com/theHamsta/nvim-dap-virtual-text
|
||||||
|
'theHamsta/nvim-dap-virtual-text', -- inline variable text while debugging
|
||||||
|
-- https://github.com/nvim-telescope/telescope-dap.nvim
|
||||||
|
'nvim-telescope/telescope-dap.nvim', -- telescope integration with dap
|
||||||
|
},
|
||||||
|
opts = {
|
||||||
|
controls = {
|
||||||
|
element = 'repl',
|
||||||
|
enabled = false,
|
||||||
|
icons = {
|
||||||
|
disconnect = '',
|
||||||
|
pause = '',
|
||||||
|
play = '',
|
||||||
|
run_last = '',
|
||||||
|
step_back = '',
|
||||||
|
step_into = '',
|
||||||
|
step_out = '',
|
||||||
|
step_over = '',
|
||||||
|
terminate = '',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
element_mappings = {},
|
||||||
|
expand_lines = true,
|
||||||
|
floating = {
|
||||||
|
border = 'single',
|
||||||
|
mappings = {
|
||||||
|
close = { 'q', '<Esc>' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
force_buffers = true,
|
||||||
|
icons = {
|
||||||
|
collapsed = '',
|
||||||
|
current_frame = '',
|
||||||
|
expanded = '',
|
||||||
|
},
|
||||||
|
layouts = {
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
{
|
||||||
|
id = 'scopes',
|
||||||
|
size = 0.50,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 'stacks',
|
||||||
|
size = 0.30,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 'watches',
|
||||||
|
size = 0.10,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id = 'breakpoints',
|
||||||
|
size = 0.10,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
size = 40,
|
||||||
|
position = 'left', -- Can be "left" or "right"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
elements = {
|
||||||
|
'repl',
|
||||||
|
'console',
|
||||||
|
},
|
||||||
|
size = 10,
|
||||||
|
position = 'bottom', -- Can be "bottom" or "top"
|
||||||
|
},
|
||||||
|
},
|
||||||
|
mappings = {
|
||||||
|
edit = 'e',
|
||||||
|
expand = { '<CR>', '<2-LeftMouse>' },
|
||||||
|
open = 'o',
|
||||||
|
remove = 'd',
|
||||||
|
repl = 'r',
|
||||||
|
toggle = 't',
|
||||||
|
},
|
||||||
|
render = {
|
||||||
|
indent = 1,
|
||||||
|
max_value_lines = 100,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
local dap = require 'dap'
|
||||||
|
require('dapui').setup(opts)
|
||||||
|
|
||||||
|
-- Customize breakpoint signs
|
||||||
|
vim.api.nvim_set_hl(0, 'DapStoppedHl', { fg = '#98BB6C', bg = '#2A2A2A', bold = true })
|
||||||
|
vim.api.nvim_set_hl(0, 'DapStoppedLineHl', { bg = '#204028', bold = true })
|
||||||
|
vim.fn.sign_define('DapStopped', { text = '', texthl = 'DapStoppedHl', linehl = 'DapStoppedLineHl', numhl = '' })
|
||||||
|
vim.fn.sign_define('DapBreakpoint', { text = '', texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
|
||||||
|
vim.fn.sign_define('DapBreakpointCondition', { text = '', texthl = 'DiagnosticSignWarn', linehl = '', numhl = '' })
|
||||||
|
vim.fn.sign_define('DapBreakpointRejected', { text = '', texthl = 'DiagnosticSignError', linehl = '', numhl = '' })
|
||||||
|
vim.fn.sign_define('DapLogPoint', { text = '', texthl = 'DiagnosticSignInfo', linehl = '', numhl = '' })
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized['dapui_config'] = function()
|
||||||
|
require('dapui').open()
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.listeners.before.event_terminated['dapui_config'] = function()
|
||||||
|
-- Commented to prevent DAP UI from closing when unit tests finish
|
||||||
|
-- require('dapui').close()
|
||||||
|
end
|
||||||
|
|
||||||
|
dap.listeners.before.event_exited['dapui_config'] = function()
|
||||||
|
-- Commented to prevent DAP UI from closing when unit tests finish
|
||||||
|
-- require('dapui').close()
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Add dap configurations based on your language/adapter settings
|
||||||
|
-- https://github.com/mfussenegger/nvim-dap/wiki/Debug-Adapter-installation
|
||||||
|
dap.configurations.java = {
|
||||||
|
{
|
||||||
|
name = 'Debug Launch (2GB)',
|
||||||
|
type = 'java',
|
||||||
|
request = 'launch',
|
||||||
|
vmArgs = '' .. '-Xmx2g ',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = 'Debug Attach (8000)',
|
||||||
|
type = 'java',
|
||||||
|
request = 'attach',
|
||||||
|
hostName = '127.0.0.1',
|
||||||
|
port = 8000,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name = 'Debug Attach (5005)',
|
||||||
|
type = 'java',
|
||||||
|
request = 'attach',
|
||||||
|
hostName = '127.0.0.1',
|
||||||
|
port = 5005,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
return {
|
||||||
|
-- https://github.com/theHamsta/nvim-dap-virtual-text
|
||||||
|
'theHamsta/nvim-dap-virtual-text',
|
||||||
|
lazy = true,
|
||||||
|
opts = {
|
||||||
|
-- Display debug text as a comment
|
||||||
|
commented = true,
|
||||||
|
-- Customize virtual text
|
||||||
|
display_callback = function(variable, buf, stackframe, node, options)
|
||||||
|
if options.virt_text_pos == 'inline' then
|
||||||
|
return ' = ' .. variable.value
|
||||||
|
else
|
||||||
|
return variable.name .. ' = ' .. variable.value
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
return {
|
||||||
|
'mfussenegger/nvim-jdtls',
|
||||||
|
ft = 'java',
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
return {
|
return {
|
||||||
{
|
-- {
|
||||||
'pmizio/typescript-tools.nvim',
|
-- 'pmizio/typescript-tools.nvim',
|
||||||
dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
|
-- dependencies = { 'nvim-lua/plenary.nvim', 'neovim/nvim-lspconfig' },
|
||||||
opts = {},
|
-- opts = {},
|
||||||
},
|
-- },
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'tpope/vim-fugitive',
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue