dotfiles
bugabingas dorkfiles
owned by bugabinga
neovim: next attempt to configure neovim for java...
5d760c08dddcd846e38b4c51a9b843901d3b51e5
Oliver Krylow <o.krylow@isp-insoft.de> ยท
unsigned
Browse filesCompare with HEAD
Changed files (5)
neovim/after/ftplugin/java.lua
Deleteddeleted file mode 100644 1 -local puk
= require 'std.puk' 2 -local project
= require 'std.project' 4 -puk.defer
'jdtls' (
function(jdtls)
13 - '-Declipse.application=org.eclipse.jdt.ls.core.id1',
14 - '-Dosgi.bundles.defaultStartLevel=4',
15 - '-Declipse.product=org.eclipse.jdt.ls.core.product',
16 - '-Dlog.protocol=true',
19 - '--add-modules=ALL-SYSTEM',
20 - '--add-opens',
'java.base/java.util=ALL-UNNAMED',
21 - '--add-opens',
'java.base/java.lang=ALL-UNNAMED',
24 - '-jar',
'/path/to/jdtls_install_location/plugins/org.eclipse.equinox.launcher_VERSION_NUMBER.jar',
31 - '-configuration',
'/path/to/jdtls_install_location/config_SYSTEM',
39 - '-data',
'/path/to/unique/per/project/workspace/folder' 41 - root_dir = project.find_java_project_root(),
55 - path =
"/usr/lib/jvm/java-11-openjdk/",
59 - path =
"/usr/lib/jvm/java-17-openjdk/",
90 - vim.notify(vim.inspect(cfg))
43 43 require 'bugabinga.save_actions' 45 45 require 'bugabinga.lsp' 46 +require 'bugabinga.java' 46 47 vim.schedule(
function ()
47 48 require 'bugabinga.in_and_out' 48 49 require 'bugabinga.mkdir' neovim/lua/bugabinga/java.lua
Addednew file mode 100644 1 +local puk
= require 'std.puk' 2 +local project
= require 'std.project' 3 +local auto
= require 'std.auto' 5 +local function parse_toolchains( toolchains_path )
7 + local file
= io.
open( toolchains_path,
'r' )
9 + print(
'Could not open toolchains.xml at ' .. toolchains_path )
13 + local content
= file:read
'*all' 16 + for toolchain
in content:gmatch
'<toolchain>(.-)</toolchain>' do 17 + local type = toolchain:match
'<type>(.-)</type>' 18 + if type == 'jdk' then 19 + local version
= toolchain:match
'<version>(.-)</version>' 20 + local jdk_path
= toolchain:match
'<home>(.-)</home>' 21 + if version
and jdk_path
then 22 + table.
insert( runtimes, {
23 + name =
'JavaSE-' .. version,
33 +local data_path
= vim.fn.stdpath
'data' 34 +if type( data_path )
== 'table' then 35 + data_path
= data_path[
1]
37 +local home
= vim.fs.abspath
'~' 38 +local jdtls_install_path
= vim.fs.joinpath( home,
'Tools',
'jdt-language-server-1.47.0-202504100338' )
39 +local toolchain_path
= vim.fs.joinpath( home,
'.m2',
'toolchains.xml' )
40 +local jdtls_path
= vim.fs.joinpath( jdtls_install_path,
'plugins',
41 + 'org.eclipse.equinox.launcher_1.7.0.v20250404-1055.jar' )
43 +local create_config = function ( syntax_server_mode, path )
44 + local root_dir
= project.find_java_project_root( path )
45 + local jdlts_config_dir
46 + if syntax_server_mode
then 47 + jdlts_config_dir
= vim.fn.has
'win32' and 'config_ss_win' or 'config_ss_linux' 49 + jdlts_config_dir
= vim.fn.has
'win32' and 'config_win' or 'config_linux' 51 + local config_dir
= vim.fs.joinpath( jdtls_install_path, jdlts_config_dir )
52 + local workspace_dir
= vim.fs.joinpath( data_path,
'jdtls-workspace', vim.fs.basename( root_dir ) )
56 + '-Declipse.application=org.eclipse.jdt.ls.core.id1',
57 + '-Dosgi.bundles.defaultStartLevel=4',
58 + '-Declipse.product=org.eclipse.jdt.ls.core.product',
59 + '-Dlog.level=ERROR',
62 + '--add-modules=ALL-SYSTEM',
63 + '--add-opens',
'java.base/java.util=ALL-UNNAMED',
64 + '--add-opens',
'java.base/java.lang=ALL-UNNAMED',
66 + '-configuration', config_dir,
67 + '-data', workspace_dir,
70 + if syntax_server_mode
then 71 + table.
insert( cmd,
2,
'-Dsyntaxserver=true' )
74 + local runtimes
= parse_toolchains( toolchain_path )
76 + name = syntax_server_mode
and 'jdtlsss' or 'jdtls',
78 + root_dir = root_dir,
81 + signatureHelp = {
enabled =
true },
83 + autobuild = {
enabled =
true },
84 + signatureHelp = {
enabled =
true },
85 + saveActions = {
origanizeImports =
true },
87 + starThreshold =
9999,
88 + staticStarThreshold =
9999,
92 + template =
'${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
94 + hashCodeEquals = {
useJava7Objects =
true },
97 + eclipse = {
downloadSources =
true },
100 + updateBuildConfiguration =
'interactive',
101 + runtimes = runtimes,
103 + maven = {
downloadSources =
true },
104 + implementationsCodeLens = {
enabled =
true },
105 + referencesCodeLens = {
enabled =
true },
106 + references = {
includeDecompiledSources =
true },
107 + inlayHints = {
parameterNames = {
enabled =
'all' } },
108 + format = {
enabled =
true },
112 + [
'language/status'] =
function ( _, status )
113 + if status.message
== 'ServiceReady' and not syntax_server_mode
then 122 +auto
'start_jdtls' {
124 + events =
'FileType',
125 + description =
'Starts jdlts (with syntax mode initially)',
126 + command =
function ()
127 + local path
= vim.api.nvim_buf_get_name(
0 )
128 + puk
'jdtls'.start_or_attach( create_config(
true, path ) )
129 + puk
'jdtls'.start_or_attach( create_config(
false, path ) )
neovim/lua/bugabinga/lsp.lua
Modified 25 - root_dir = project.find_java_project_root,
28 - signatureHelp = {
enabled =
true },
30 - autobuild = {
enabled =
true },
31 - signatureHelp = {
enabled =
true },
32 - saveActions = {
origanizeImports =
true },
34 - starThreshold =
9999,
35 - staticStarThreshold =
9999,
39 - template =
'${object.className}{${member.name()}=${member.value()}, ${otherMembers}}',
41 - hashCodeEquals = {
useJava7Objects =
true },
44 - eclipse = {
downloadSources =
true },
47 - updateBuildConfiguration =
'interactive',
49 - maven = {
downloadSources =
true },
50 - implementationsCodeLens = {
enabled =
true },
51 - referencesCodeLens = {
enabled =
true },
52 - references = {
includeDecompiledSources =
true },
53 - inlayHints = {
parameterNames = {
enabled =
'all' } },
54 - format = {
enabled =
true },
58 24 zls
= {
root_dir = project.find_zig_project_root },
59 25 ziggy
= {
root_dir = project.find_zig_project_root },
60 26 ziggy_schema
= {
root_dir = project.find_zig_project_root },
neovim/lua/bugabinga/statusbar.lua
Modified284 284 local svn_get_relative_url = function ()
285 285 local result
= vim.system {
'svn',
'info',
'--show-item',
'relative-url',
'--no-newline' }:wait()
286 286 if result.code
== 0 then 287 - vim.print( result )
288 287 return result.stdout
290 289 return result.stderr