small changes

This commit is contained in:
Jacob Frøkjær Wortmann 2024-01-29 09:07:13 +01:00
parent a4a698bc8a
commit ab38e88daa
3 changed files with 74 additions and 80 deletions

View File

@ -85,6 +85,7 @@ require('lazy').setup({
-- Automatically install LSPs to stdpath for neovim -- Automatically install LSPs to stdpath for neovim
'williamboman/mason.nvim', 'williamboman/mason.nvim',
'williamboman/mason-lspconfig.nvim', 'williamboman/mason-lspconfig.nvim',
-- to enable linters please use https://github.com/mfussenegger/nvim-lint
-- Useful status updates for LSP -- Useful status updates for LSP
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})` -- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
@ -299,27 +300,25 @@ vim.o.mouse = 'a'
-- See `:help 'clipboard'` -- See `:help 'clipboard'`
-- vim.o.clipboard = 'unnamedplus' -- vim.o.clipboard = 'unnamedplus'
--- Copy-paste --- Copy-paste
vim.keymap.set('n', '<leader>p', '"_dP')
vim.keymap.set('n', '<leader>p', '"+p') vim.keymap.set('n', '<leader>p', '"+p')
vim.keymap.set('v', '<leader>p', '"+p')
vim.keymap.set('n', '<leader>y', '"+y') vim.keymap.set('n', '<leader>y', '"+y')
vim.keymap.set('v', '<leader>y', '"+y') vim.keymap.set('v', '<leader>y', '"+y')
vim.keymap.set('n', '<leader>Y', 'gg"+yG') vim.keymap.set('n', '<leader>Y', 'gg"+yG')
vim.keymap.set('n', '<leader>d', '"_d') -- vim.keymap.set('n', '<leader>d', '"_d')
vim.keymap.set('v', '<leader>d', '"_d') -- vim.keymap.set('v', '<leader>d', '"_d')
-- Needed to sync windows clipboard with wsl -- Needed to sync windows clipboard with wsl
vim.g.clipboard = { vim.g.clipboard = {
name = 'WslClipboard', name = 'WslClipboard',
copy = { copy = {
['+'] = '/mnt/c/Windows/System32/clip.exe', ['+'] = '/mnt/c/tools/win32yank.exe -i --crlf',
['*'] = '/mnt/c/Windows/System32/clip.exe', ['*'] = '/mnt/c/tools/win32yank.exe -i --crlf',
}, },
paste = { paste = {
['+'] = ['+'] = '/mnt/c/tools/win32yank.exe -o --lf',
'/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', ['*'] = '/mnt/c/tools/win32yank.exe -o --lf',
['*'] =
'/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
}, },
cache_enabled = 0, cache_enabled = 0,
} }
@ -341,7 +340,7 @@ vim.cmd([[
augroup markdown augroup markdown
autocmd! autocmd!
autocmd FileType markdown set wrap autocmd FileType markdown set wrap
autocmd FileType markdown set textwidth=144 autocmd FileType markdown set textwidth=120
augroup end augroup end
]]) ]])
@ -349,7 +348,7 @@ augroup end
vim.opt.colorcolumn = "144" vim.opt.colorcolumn = "144"
-- Always have lines in the bottom of the file -- Always have lines in the bottom of the file
vim.opt.scrolloff = 8 vim.opt.scrolloff = 10
-- Keep signcolumn on by default -- Keep signcolumn on by default
vim.wo.signcolumn = 'yes' vim.wo.signcolumn = 'yes'

View File

@ -276,7 +276,7 @@
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_preserve"/> <setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_preserve"/> <setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_preserve"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_preserve"/> <setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_if_empty"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/> <setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/> <setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>

View File

@ -15,9 +15,7 @@ return {
local mason_registry = require("mason-registry") local mason_registry = require("mason-registry")
local jdtls_pkg = mason_registry.get_package("jdtls") local jdtls_pkg = mason_registry.get_package("jdtls")
local jdtls_path = jdtls_pkg:get_install_path() local jdtls_path = jdtls_pkg:get_install_path()
local jdtls_bin = jdtls_path .. "/bin/jdtls"
local equinox_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar") local equinox_launcher = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar")
-- local equinox = jdtls_path .. "/plugins/org.eclipse.equinox.launcher_1.6.500.v20230717-2134.jar"
local java_test_pkg = mason_registry.get_package("java-test") local java_test_pkg = mason_registry.get_package("java-test")
local java_test_path = java_test_pkg:get_install_path() local java_test_path = java_test_pkg:get_install_path()
@ -30,8 +28,8 @@ return {
local jar_patterns = { local jar_patterns = {
java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar", java_dbg_path .. "/extension/server/com.microsoft.java.debug.plugin-*.jar",
-- enable java test, and disable vscode_java_test when version of com.microsoft.java.test.plugin-*.jar is 0.40.0 or higher -- enable java test, and disable vscode_java_test when version of com.microsoft.java.test.plugin-*.jar is 0.40.0 or higher
-- java_test_path .. "/extension/server/*.jar", java_test_path .. "/extension/server/*.jar",
vscode_java_test_path .. "/*.jar" --vscode_java_test_path .. "/*.jar"
} }
local bundles = {} local bundles = {}
@ -43,7 +41,7 @@ return {
local settings = { local settings = {
java = { java = {
signatureHelp = { enabled = true }, signatureHelp = { enabled = true, description = { enabled = true } },
contentProvider = { preferred = 'fernflower' }, contentProvider = { preferred = 'fernflower' },
completion = { completion = {
favoriteStaticMembers = { favoriteStaticMembers = {
@ -63,6 +61,7 @@ return {
}, },
}, },
references = { references = {
includeAccessors = true,
includeDecompiledSources = true, includeDecompiledSources = true,
}, },
codeGeneration = { codeGeneration = {
@ -73,7 +72,7 @@ return {
format = { format = {
enabled = true, enabled = true,
settings = { settings = {
url = vim.fn.stdpath("config") .. "/lang_servers/nykredit-java-style.xml", url = vim.fn.stdpath("config") .. "/lang_servers/nykredit_java_style.xml",
profile = "Nykredit", profile = "Nykredit",
}, },
}, },
@ -96,24 +95,27 @@ return {
enabled = "all", -- literals, all, none enabled = "all", -- literals, all, none
}, },
}, },
server = {
launchMode = "Hybrid"
},
configuration = { configuration = {
updateBuildConfiguration = "interactive", updateBuildConfiguration = "automatic",
maven = { maven = {
userSettings = nil, userSettings = nil,
}, },
runtimes = { runtimes = {
{ {
name = "JavaSE-1.8", name = "JavaSE-1.8",
path = "/usr/lib/jvm/java-8-openjdk-amd64", path = home .. "/.sdkman/candidates/java/8",
},
{
name = "JavaSE-11",
path = "/usr/lib/jvm/java-11-openjdk-amd64",
default = true, default = true,
}, },
{
name = "JavaSE-11",
path = home .. "/.sdkman/candidates/java/11",
},
{ {
name = "JavaSE-17", name = "JavaSE-17",
path = "/usr/lib/jvm/java-17-openjdk-amd64", path = home .. "/.sdkman/candidates/java/17.0.10-tem",
}, },
-- { -- {
-- name = "JavaSE-19", -- name = "JavaSE-19",
@ -122,7 +124,10 @@ return {
} }
}, },
project = { project = {
}, referencedLibraries = {
{ home .. "/.sdkman/candidates/java/8/lib/tools.jar" }
}
}
}, },
} }
@ -205,66 +210,56 @@ return {
extendedClientCapabilities = extendedClientCapabilities, extendedClientCapabilities = extendedClientCapabilities,
}, },
cmd = {
"/.sdkman/candidates/java/17.0.10-tem/bin/java", -- or '/path/to/java17_or_newer/bin/java'
-- depends on if `java` is in your $PATH env variable and if it points to the right version.
"-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",
"-Xmx2g",
"-javaagent:" .. jdtls_path .. "/lombok.jar",
"--add-modules=ALL-SYSTEM",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
"-jar", equinox_launcher,
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
-- Must point to the Change this to
-- eclipse.jdt.ls installation the actual version
-- ??
"-configuration", jdtls_path .. "/config_linux",
-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
-- Must point to the Change to one of `linux`, `win` or `mac`
-- eclipse.jdt.ls installation Depending on your system.
-- See `data directory configuration` section in the README
"-data", workspace_folder,
},
-- cmd = { -- cmd = {
-- -- -- jdtls_bin,
-- -- -- ?? -- "--jvm-arg=-javaagent:" .. jdtls_path .. "/lombok.jar",
-- "/usr/lib/jvm/java-17-openjdk-amd64/bin/java", -- or '/path/to/java17_or_newer/bin/java' -- "--jvm-arg=-Dlog.level=ALL",
-- -- depends on if `java` is in your $PATH env variable and if it points to the right version. -- "--jvm-arg=--add-exports jdk.compiler/com.sun.javac.tree=ALL-UNNAMED",
--
-- "-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",
-- "-Xmx1g",
-- "-javaagent:" .. jdtls_path .. "/lombok.jar",
-- "--add-modules=ALL-SYSTEM",
-- "--add-opens", "java.base/java.util=ALL-UNNAMED",
-- "--add-opens", "java.base/java.lang=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
-- "--add-opens", "jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
--
-- -- ??
-- "-jar",
-- equinox_launcher,
-- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
-- -- Must point to the Change this to
-- -- eclipse.jdt.ls installation the actual version
--
-- -- ??
-- "-configuration",
-- jdtls_path .. "/config_linux",
-- -- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^
-- -- Must point to the Change to one of `linux`, `win` or `mac`
-- -- eclipse.jdt.ls installation Depending on your system.
--
-- -- See `data directory configuration` section in the README
-- "-data", -- "-data",
-- workspace_folder, -- workspace_folder,
-- }, -- },
cmd = {
jdtls_bin,
"--jvm-arg=-javaagent:" .. jdtls_path .. "/lombok.jar",
"--jvm-arg=-Dlog.level=ALL",
-- "--jvm-arg=--add-opens jdk.compiler/com.sun.javac.tree=ALL-UNNAMED",
"-data",
workspace_folder,
},
-- -- attach general lsp 'on_attach function' -- -- attach general lsp 'on_attach function'
on_attach = on_attach, on_attach = on_attach,
capabilities = capabilities, capabilities = capabilities,
-- we naively believe that the whole project is versioned through git, and therefore root_dir = require('jdtls.setup').find_root({ '.git', 'mvnw', 'gradlew' }),
root_dir = vim.fs.dirname(
vim.fs.find({ ".git" }, { upward = true })[1]
),
settings = settings, settings = settings,
flags = { flags = {
allow_incremental_sync = true, allow_incremental_sync = true,