small changes
This commit is contained in:
parent
a4a698bc8a
commit
ab38e88daa
21
init.lua
21
init.lua
|
@ -85,6 +85,7 @@ require('lazy').setup({
|
|||
-- Automatically install LSPs to stdpath for neovim
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
-- to enable linters please use https://github.com/mfussenegger/nvim-lint
|
||||
|
||||
-- Useful status updates for LSP
|
||||
-- NOTE: `opts = {}` is the same as calling `require('fidget').setup({})`
|
||||
|
@ -299,27 +300,25 @@ vim.o.mouse = 'a'
|
|||
-- See `:help 'clipboard'`
|
||||
-- vim.o.clipboard = 'unnamedplus'
|
||||
--- Copy-paste
|
||||
vim.keymap.set('n', '<leader>p', '"_dP')
|
||||
vim.keymap.set('n', '<leader>p', '"+p')
|
||||
vim.keymap.set('v', '<leader>p', '"+p')
|
||||
vim.keymap.set('n', '<leader>y', '"+y')
|
||||
vim.keymap.set('v', '<leader>y', '"+y')
|
||||
vim.keymap.set('n', '<leader>Y', 'gg"+yG')
|
||||
vim.keymap.set('n', '<leader>d', '"_d')
|
||||
vim.keymap.set('v', '<leader>d', '"_d')
|
||||
-- vim.keymap.set('n', '<leader>d', '"_d')
|
||||
-- vim.keymap.set('v', '<leader>d', '"_d')
|
||||
|
||||
|
||||
-- Needed to sync windows clipboard with wsl
|
||||
vim.g.clipboard = {
|
||||
name = 'WslClipboard',
|
||||
copy = {
|
||||
['+'] = '/mnt/c/Windows/System32/clip.exe',
|
||||
['*'] = '/mnt/c/Windows/System32/clip.exe',
|
||||
['+'] = '/mnt/c/tools/win32yank.exe -i --crlf',
|
||||
['*'] = '/mnt/c/tools/win32yank.exe -i --crlf',
|
||||
},
|
||||
paste = {
|
||||
['+'] =
|
||||
'/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))',
|
||||
['*'] =
|
||||
'/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/tools/win32yank.exe -o --lf',
|
||||
},
|
||||
cache_enabled = 0,
|
||||
}
|
||||
|
@ -341,7 +340,7 @@ vim.cmd([[
|
|||
augroup markdown
|
||||
autocmd!
|
||||
autocmd FileType markdown set wrap
|
||||
autocmd FileType markdown set textwidth=144
|
||||
autocmd FileType markdown set textwidth=120
|
||||
augroup end
|
||||
]])
|
||||
|
||||
|
@ -349,7 +348,7 @@ augroup end
|
|||
vim.opt.colorcolumn = "144"
|
||||
|
||||
-- Always have lines in the bottom of the file
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.wo.signcolumn = 'yes'
|
||||
|
|
|
@ -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_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_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_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"/>
|
||||
|
@ -377,4 +377,4 @@
|
|||
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
|
||||
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
|
||||
</profile>
|
||||
</profiles>
|
||||
</profiles>
|
||||
|
|
|
@ -15,9 +15,7 @@ return {
|
|||
local mason_registry = require("mason-registry")
|
||||
local jdtls_pkg = mason_registry.get_package("jdtls")
|
||||
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 = 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_path = java_test_pkg:get_install_path()
|
||||
|
@ -30,8 +28,8 @@ return {
|
|||
local jar_patterns = {
|
||||
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
|
||||
-- java_test_path .. "/extension/server/*.jar",
|
||||
vscode_java_test_path .. "/*.jar"
|
||||
java_test_path .. "/extension/server/*.jar",
|
||||
--vscode_java_test_path .. "/*.jar"
|
||||
}
|
||||
|
||||
local bundles = {}
|
||||
|
@ -43,7 +41,7 @@ return {
|
|||
|
||||
local settings = {
|
||||
java = {
|
||||
signatureHelp = { enabled = true },
|
||||
signatureHelp = { enabled = true, description = { enabled = true } },
|
||||
contentProvider = { preferred = 'fernflower' },
|
||||
completion = {
|
||||
favoriteStaticMembers = {
|
||||
|
@ -63,6 +61,7 @@ return {
|
|||
},
|
||||
},
|
||||
references = {
|
||||
includeAccessors = true,
|
||||
includeDecompiledSources = true,
|
||||
},
|
||||
codeGeneration = {
|
||||
|
@ -73,7 +72,7 @@ return {
|
|||
format = {
|
||||
enabled = true,
|
||||
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",
|
||||
},
|
||||
},
|
||||
|
@ -96,24 +95,27 @@ return {
|
|||
enabled = "all", -- literals, all, none
|
||||
},
|
||||
},
|
||||
server = {
|
||||
launchMode = "Hybrid"
|
||||
},
|
||||
configuration = {
|
||||
updateBuildConfiguration = "interactive",
|
||||
updateBuildConfiguration = "automatic",
|
||||
maven = {
|
||||
userSettings = nil,
|
||||
},
|
||||
runtimes = {
|
||||
{
|
||||
name = "JavaSE-1.8",
|
||||
path = "/usr/lib/jvm/java-8-openjdk-amd64",
|
||||
},
|
||||
{
|
||||
name = "JavaSE-11",
|
||||
path = "/usr/lib/jvm/java-11-openjdk-amd64",
|
||||
path = home .. "/.sdkman/candidates/java/8",
|
||||
default = true,
|
||||
},
|
||||
{
|
||||
name = "JavaSE-11",
|
||||
path = home .. "/.sdkman/candidates/java/11",
|
||||
},
|
||||
{
|
||||
name = "JavaSE-17",
|
||||
path = "/usr/lib/jvm/java-17-openjdk-amd64",
|
||||
path = home .. "/.sdkman/candidates/java/17.0.10-tem",
|
||||
},
|
||||
-- {
|
||||
-- name = "JavaSE-19",
|
||||
|
@ -122,7 +124,10 @@ return {
|
|||
}
|
||||
},
|
||||
project = {
|
||||
},
|
||||
referencedLibraries = {
|
||||
{ home .. "/.sdkman/candidates/java/8/lib/tools.jar" }
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -205,66 +210,56 @@ return {
|
|||
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 = {
|
||||
-- --
|
||||
-- -- -- ??
|
||||
-- "/usr/lib/jvm/java-17-openjdk-amd64/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",
|
||||
-- "-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
|
||||
-- jdtls_bin,
|
||||
-- "--jvm-arg=-javaagent:" .. jdtls_path .. "/lombok.jar",
|
||||
-- "--jvm-arg=-Dlog.level=ALL",
|
||||
-- "--jvm-arg=--add-exports jdk.compiler/com.sun.javac.tree=ALL-UNNAMED",
|
||||
-- "-data",
|
||||
-- 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'
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
-- we naively believe that the whole project is versioned through git, and therefore
|
||||
root_dir = vim.fs.dirname(
|
||||
vim.fs.find({ ".git" }, { upward = true })[1]
|
||||
),
|
||||
root_dir = require('jdtls.setup').find_root({ '.git', 'mvnw', 'gradlew' }),
|
||||
settings = settings,
|
||||
flags = {
|
||||
allow_incremental_sync = true,
|
||||
|
|
Loading…
Reference in New Issue