update
This commit is contained in:
parent
132854cc0c
commit
203159cee6
8 changed files with 183 additions and 190 deletions
12
init.lua
12
init.lua
|
|
@ -7,7 +7,7 @@ require("user.autopairs")
|
||||||
require("user.telescope")
|
require("user.telescope")
|
||||||
require("user.gruvbox")
|
require("user.gruvbox")
|
||||||
require("user.lsp")
|
require("user.lsp")
|
||||||
require("user.treesitter")
|
-- require("user.treesitter")
|
||||||
require("user.terminal")
|
require("user.terminal")
|
||||||
require("user.markdown")
|
require("user.markdown")
|
||||||
require("user.autocmds")
|
require("user.autocmds")
|
||||||
|
|
@ -41,7 +41,14 @@ return require("packer").startup(function(use)
|
||||||
use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
use("jose-elias-alvarez/nvim-lsp-ts-utils")
|
||||||
|
|
||||||
-- Treesitter
|
-- Treesitter
|
||||||
use("nvim-treesitter/nvim-treesitter")
|
-- use("nvim-treesitter/nvim-treesitter")
|
||||||
|
use({
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
run = ":TSUpdate",
|
||||||
|
config = function()
|
||||||
|
require("user.treesitter") -- Load the config ONLY after plugin is loaded
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- Auto pairs
|
-- Auto pairs
|
||||||
use("windwp/nvim-autopairs")
|
use("windwp/nvim-autopairs")
|
||||||
|
|
@ -102,3 +109,4 @@ return require("packer").startup(function(use)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
local lspconfig = require("lspconfig")
|
-- lua/user/lsp_servers/graphql.lua
|
||||||
|
|
||||||
lspconfig.graphql.setup({
|
vim.lsp.config("graphql", {
|
||||||
capabilities = require("cmp_nvim_lsp").default_capabilities(),
|
capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities()),
|
||||||
filetypes = { "graphql", "gql", "javascript", "typescript" },
|
filetypes = { "graphql", "gql", "javascript", "typescript" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,85 +1,75 @@
|
||||||
local lspconfig = require("lspconfig")
|
-- lua/user/lsp_servers/jdtls.lua
|
||||||
|
|
||||||
|
-- Get capabilities for nvim-cmp
|
||||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
|
|
||||||
-- Java binary (ensure it's Java 21)
|
-- Java binary (ensure it's Java 21)
|
||||||
local java_bin = "/usr/lib/jvm/java-21-openjdk/bin/java"
|
local java_bin = "/usr/lib/jvm/java-21-openjdk/bin/java"
|
||||||
|
|
||||||
-- Find JDTLS and Lombok paths dynamically
|
-- JDTLS paths (Mason-managed)
|
||||||
local jdtls_path = "/home/prabhat/.local/share/nvim/mason/packages/jdtls"
|
local jdtls_path = "/home/prabhat/.local/share/nvim/mason/packages/jdtls"
|
||||||
local jdtls_launcher_jar = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar")
|
local jdtls_launcher_jar = vim.fn.glob(jdtls_path .. "/plugins/org.eclipse.equinox.launcher_*.jar")
|
||||||
local lombok_jar = vim.fn.glob(jdtls_path .. "/lombok.jar")
|
local lombok_jar = vim.fn.glob(jdtls_path .. "/lombok.jar")
|
||||||
|
|
||||||
lspconfig.jdtls.setup({
|
-- Setup JDTLS
|
||||||
cmd = {
|
vim.lsp.config("jdtls", {
|
||||||
java_bin,
|
cmd = {
|
||||||
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
java_bin,
|
||||||
"-Dosgi.bundles.defaultStartLevel=4",
|
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
|
||||||
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
"-Dosgi.bundles.defaultStartLevel=4",
|
||||||
"-Dlog.protocol=true",
|
"-Declipse.product=org.eclipse.jdt.ls.core.product",
|
||||||
"-Dlog.level=INFO",
|
"-Dlog.protocol=true",
|
||||||
"-Xmx2G", -- Max heap size
|
"-Dlog.level=INFO",
|
||||||
"-Xms256m", -- Min heap size
|
"-Xmx2G",
|
||||||
"--add-modules=ALL-SYSTEM",
|
"-Xms256m",
|
||||||
"--add-opens", "java.base/java.util=ALL-UNNAMED",
|
"--add-modules=ALL-SYSTEM",
|
||||||
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
|
"--add-opens", "java.base/java.util=ALL-UNNAMED",
|
||||||
"-javaagent:" .. lombok_jar, -- Lombok support
|
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
|
||||||
"-jar", jdtls_launcher_jar, -- JDTLS launcher
|
"-javaagent:" .. lombok_jar,
|
||||||
"-configuration", jdtls_path .. "/config_linux",
|
"-jar", jdtls_launcher_jar,
|
||||||
"-data", vim.fn.stdpath("data") .. "/jdtls-workspace/" .. vim.fn.fnamemodify(vim.loop.cwd(), ":p:h:t"),
|
"-configuration", jdtls_path .. "/config_linux",
|
||||||
},
|
"-data", vim.fn.stdpath("data") .. "/jdtls-workspace/" .. vim.fn.fnamemodify(vim.loop.cwd(), ":p:h:t"),
|
||||||
capabilities = capabilities,
|
},
|
||||||
root_dir = function()
|
|
||||||
return vim.fs.dirname(
|
capabilities = capabilities,
|
||||||
vim.fs.find({ ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }, { upward = true })[1]
|
|
||||||
)
|
root_dir = function()
|
||||||
end,
|
local root_files = { ".git", "mvnw", "gradlew", "pom.xml", "build.gradle" }
|
||||||
settings = {
|
local found = vim.fs.find(root_files, { upward = true })[1]
|
||||||
java = {
|
return found and vim.fs.dirname(found) or vim.loop.cwd()
|
||||||
completion = {
|
end,
|
||||||
favoriteStaticMembers = {
|
|
||||||
"org.junit.jupiter.api.Assertions.*",
|
settings = {
|
||||||
"org.mockito.Mockito.*",
|
java = {
|
||||||
"java.util.Objects.requireNonNull",
|
completion = {
|
||||||
"java.util.Objects.requireNonNullElse",
|
favoriteStaticMembers = {
|
||||||
},
|
"org.junit.jupiter.api.Assertions.*",
|
||||||
filteredTypes = {
|
"org.mockito.Mockito.*",
|
||||||
"com.sun.*",
|
"java.util.Objects.requireNonNull",
|
||||||
"io.micrometer.shaded.*",
|
"java.util.Objects.requireNonNullElse",
|
||||||
"java.awt.*",
|
|
||||||
"jdk.*",
|
|
||||||
"sun.*",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
import = {
|
|
||||||
exclusions = {
|
|
||||||
"**/internal/**",
|
|
||||||
},
|
|
||||||
maven = {
|
|
||||||
enabled = true,
|
|
||||||
downloadSources = true,
|
|
||||||
},
|
|
||||||
gradle = {
|
|
||||||
enabled = true,
|
|
||||||
},
|
|
||||||
settings = {
|
|
||||||
importOrder = {
|
|
||||||
"java",
|
|
||||||
"javax",
|
|
||||||
"org",
|
|
||||||
"com",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
inlayHints = {
|
|
||||||
parameterNames = { enabled = "all" },
|
|
||||||
},
|
|
||||||
format = {
|
|
||||||
enabled = true,
|
|
||||||
settings = {
|
|
||||||
url = jdtls_path .. "/eclipse-formatter.xml",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
filteredTypes = {
|
||||||
|
"com.sun.*",
|
||||||
|
"io.micrometer.shaded.*",
|
||||||
|
"java.awt.*",
|
||||||
|
"jdk.*",
|
||||||
|
"sun.*",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
import = {
|
||||||
|
exclusions = { "**/internal/**" },
|
||||||
|
maven = { enabled = true, downloadSources = true },
|
||||||
|
gradle = { enabled = true },
|
||||||
|
settings = {
|
||||||
|
importOrder = { "java", "javax", "org", "com" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
inlayHints = { parameterNames = { enabled = "all" } },
|
||||||
|
format = {
|
||||||
|
enabled = true,
|
||||||
|
settings = { url = jdtls_path .. "/eclipse-formatter.xml" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,28 +1,25 @@
|
||||||
-- lua/user/lsp_servers/kotlin_ls.lua
|
-- lua/user/lsp_servers/kotlin_ls.lua
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
vim.lsp.config("kotlin_language_server", {
|
||||||
|
cmd = { "kotlin-language-server" },
|
||||||
|
|
||||||
-- Setup the Kotlin language server
|
on_attach = function(client, bufnr)
|
||||||
lspconfig.kotlin_language_server.setup({
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
cmd = { "kotlin-language-server" }, -- The command to start the server
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
-- Key mappings for LSP functions
|
|
||||||
local opts = { noremap = true, silent = true }
|
|
||||||
local function buf_set_keymap(...)
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
|
||||||
end
|
|
||||||
|
|
||||||
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
buf_set_keymap("n", "<leader>rn", "<Cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
end,
|
end,
|
||||||
flags = {
|
|
||||||
debounce_text_changes = 150,
|
flags = {
|
||||||
},
|
debounce_text_changes = 150,
|
||||||
settings = {
|
},
|
||||||
kotlin = {
|
|
||||||
linting = { enabled = true },
|
settings = {
|
||||||
completion = { enabled = true },
|
kotlin = {
|
||||||
},
|
linting = { enabled = true },
|
||||||
},
|
completion = { enabled = true },
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
local lspconfig = require("lspconfig")
|
vim.lsp.config("marksman", {
|
||||||
-- Setup for Markdown LSP (Marksman)
|
filetypes = { "markdown", "md" },
|
||||||
lspconfig.marksman.setup({
|
|
||||||
-- Add additional settings here
|
|
||||||
filetypes = { "markdown", "md" },
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
local lspconfig = require("lspconfig")
|
vim.lsp.config("pyright", {
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
lspconfig.pyright.setup({
|
-- Custom keymaps and commands for pyright
|
||||||
on_attach = function(client, bufnr)
|
end,
|
||||||
-- Custom keymaps and commands for pyright
|
settings = {
|
||||||
end,
|
python = {
|
||||||
settings = {
|
analysis = {
|
||||||
python = {
|
autoSearchPaths = true,
|
||||||
analysis = {
|
useLibraryCodeForTypes = true,
|
||||||
autoSearchPaths = true,
|
},
|
||||||
useLibraryCodeForTypes = true,
|
},
|
||||||
},
|
},
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,41 +1,44 @@
|
||||||
local lspconfig = require("lspconfig")
|
vim.lsp.config("ts_ls", {
|
||||||
|
on_attach = function(client, bufnr)
|
||||||
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
|
||||||
lspconfig.ts_ls.setup({
|
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
||||||
on_attach = function(client, bufnr)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
-- Custom keymaps and commands for tsserver
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
local opts = { noremap = true, silent = true }
|
end,
|
||||||
-- Example key mappings
|
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
|
filetypes = {
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
|
"typescript",
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, "n", "<leader>rn", "<Cmd>lua vim.lsp.buf.rename()<CR>", opts)
|
"typescriptreact",
|
||||||
end,
|
"javascript",
|
||||||
filetypes = {
|
"javascriptreact",
|
||||||
"typescript",
|
},
|
||||||
"typescriptreact",
|
|
||||||
"typescript.tsx",
|
cmd = { "typescript-language-server", "--stdio" },
|
||||||
"javascript",
|
|
||||||
"javascriptreact",
|
root_dir = vim.fs.root(0, {
|
||||||
"javascript.jsx",
|
"package.json",
|
||||||
},
|
"tsconfig.json",
|
||||||
cmd = { "typescript-language-server", "--stdio" },
|
"jsconfig.json",
|
||||||
root_dir = lspconfig.util.root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
|
".git",
|
||||||
settings = {
|
}),
|
||||||
-- Enable document formatting
|
|
||||||
format = {
|
settings = {
|
||||||
enable = true,
|
format = {
|
||||||
insertSpaceAfterCommaDelimiter = true,
|
enable = true,
|
||||||
insertSpaceAfterSemicolon = true,
|
insertSpaceAfterCommaDelimiter = true,
|
||||||
insertSpaceBeforeAndAfterOperator = true,
|
insertSpaceAfterSemicolon = true,
|
||||||
indentStyle = "smart",
|
insertSpaceBeforeAndAfterOperator = true,
|
||||||
indentSize = 2,
|
indentStyle = "smart",
|
||||||
wrapLineLength = 120,
|
indentSize = 2,
|
||||||
},
|
wrapLineLength = 120,
|
||||||
-- Diagnostics and completion settings
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
completions = {
|
completions = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,33 +1,30 @@
|
||||||
require("nvim-treesitter.configs").setup({
|
-- lua/user/treesitter.lua
|
||||||
ensure_installed = {
|
local ok, configs = pcall(require, "nvim-treesitter.configs")
|
||||||
"markdown",
|
if not ok then
|
||||||
"markdown_inline",
|
vim.notify("nvim-treesitter not found!", vim.log.levels.WARN)
|
||||||
"lua",
|
return
|
||||||
"python",
|
end
|
||||||
"java",
|
|
||||||
"c",
|
configs.setup({
|
||||||
"cpp",
|
ensure_installed = {
|
||||||
"javascript",
|
"markdown",
|
||||||
"kotlin",
|
"lua",
|
||||||
"go",
|
"python",
|
||||||
},
|
"java",
|
||||||
highlight = {
|
"c",
|
||||||
enable = true,
|
"cpp",
|
||||||
use_language_tree = true,
|
"javascript",
|
||||||
},
|
"kotlin",
|
||||||
incremental_selection = {
|
"go",
|
||||||
enable = true,
|
},
|
||||||
},
|
highlight = {
|
||||||
indent = {
|
enable = true,
|
||||||
enable = true,
|
use_language_tree = true,
|
||||||
},
|
},
|
||||||
context_commentstring = {
|
incremental_selection = { enable = true },
|
||||||
enable = true,
|
indent = { enable = true },
|
||||||
},
|
context_commentstring = { enable = true },
|
||||||
autopairs = {
|
autopairs = { enable = true },
|
||||||
enable = true,
|
rainbow = { enable = true },
|
||||||
},
|
|
||||||
rainbow = {
|
|
||||||
enable = true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue