enc: move lsp config to auto-lsp.nvim

This commit is contained in:
Pojok Code 2024-10-20 17:21:07 +07:00
parent 5f766a5717
commit c09e320633
22 changed files with 253 additions and 293 deletions

View file

@ -0,0 +1,12 @@
return {
root_dir = require("lspconfig.util").root_pattern(
"build",
"compile_commands.json",
".git",
"mvnw",
"gradlew",
"pom.xml",
"build.gradle"
) or vim.loop.cwd() or vim.fn.getcwd(),
singe_file_support = true,
}

View file

@ -0,0 +1,35 @@
return {
-- add cmd
cmd = { "deno", "lsp" },
-- add file type support
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
-- add root dir support
root_dir = require("lspconfig.util").root_pattern(
"package.json",
"tsconfig.json",
"jsconfig.json",
"deno.json",
"deno.jsonc",
".git"
),
-- add settings
settings = {
deno = {
enable = true,
suggest = {
imports = {
hosts = {
["https://deno.land"] = true,
},
},
},
},
},
}

View file

@ -0,0 +1,24 @@
return {
cmd = { "emmet-ls", "-c", "--stdio" },
-- add file type support
-- filetypes = {
-- "javascript",
-- "javascriptreact",
-- "javascript.jsx",
-- "typescript",
-- "typescriptreact",
-- "typescript.tsx",
-- "astro",
-- "css",
-- "eruby",
-- "html",
-- "htmldjango",
-- "less",
-- "pug",
-- "sass",
-- "scss",
-- "svelte",
-- "vue" -- },
-- add dynamic root dir support
root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
}

View file

@ -0,0 +1,20 @@
return {
-- cmd = { "vscode-eslint-language-server", "--stdio" }, -- add file type support
-- filetypes = {
-- "javascript",
-- "javascriptreact",
-- "javascript.jsx",
-- "typescript",
-- "typescriptreact",
-- "typescript.tsx",
-- },
-- -- add dynamic root dir support
-- root_dir = require("lspconfig.util").root_pattern(
-- "package.json",
-- "tsconfig.json",
-- "jsconfig.json",
-- ".eslintrc.json",
-- ".eslintrc.js",
-- ".eslintrc.cjs"
-- ),
}

View file

@ -0,0 +1,6 @@
return {
cmd = { "intelephense", "--stdio" },
filetypes = { "php" },
root_dir = require("lspconfig.util").root_pattern("composer.json", ".git") or vim.loop.cwd() or vim.fn.getcwd(),
single_file_support = true,
}

View file

@ -0,0 +1,22 @@
return {
cmd = {
"jdtls",
"-configuration",
vim.fn.stdpath("cache") .. "/jdtls/config",
"-data",
vim.fn.stdpath("cache") .. "/jdtls/workspace",
},
filetypes = { "java" },
root_dir = require("lspconfig.util").root_pattern(
-- Single-module projects
{
"build.xml", -- Ant
"pom.xml", -- Maven
"settings.gradle", -- Gradle
"settings.gradle.kts", -- Gradle
},
-- Multi-module projects
{ "build.gradle", "build.gradle.kts" }
) or vim.fn.getcwd(),
singe_file_support = true,
}

View file

@ -0,0 +1,19 @@
return {
settings = {
json = {
schemas = require("schemastore").json.schemas(),
},
},
setup = {
commands = {
Format = {
function()
vim.lsp.buf.range_formatting({}, { 0, 0 }, { vim.fn.line("$"), 0 })
end,
},
},
},
init_options = {
provideFormatter = false,
},
}

View file

@ -0,0 +1,15 @@
return {
cmd = { "kotlin-language-server" },
filetypes = { "kotlin" },
root_dir = require("lspconfig.util").root_pattern(
"build.gradle.kts",
"build.gradle",
"settings.gradle",
"gradlew",
"pom.xml",
"build.gradle.kts",
"build.kts",
".git"
),
singe_file_support = true,
}

View file

@ -0,0 +1,41 @@
-- https://luals.github.io/wiki/settings/
return {
settings = {
Lua = {
format = {
enable = false,
},
diagnostics = {
globals = { "vim", "spec" },
},
runtime = {
version = "LuaJIT",
special = {
spec = "require",
},
},
-- workspace = {
-- checkThirdParty = false,
-- library = {
-- [vim.fn.expand("$VIMRUNTIME/lua")] = true,
-- [vim.fn.stdpath("config") .. "/lua"] = true,
-- },
-- },
workspace = {
checkThirdParty = false,
},
hint = {
enable = false,
arrayIndex = "Disable", -- "Enable" | "Auto" | "Disable"
await = true,
paramName = "Disable", -- "All" | "Literal" | "Disable"
paramType = true,
semicolon = "All", -- "All" | "SameLine" | "Disable"
setType = false,
},
telemetry = {
enable = false,
},
},
},
}

View file

@ -0,0 +1,9 @@
return {
settings = {
python = {
analysis = {
typeCheckingMode = "off",
},
},
},
}

View file

@ -0,0 +1,8 @@
return {
-- cmd = { "sql-language-server", "up", "--method", "stdio" },
-- filetypes = { "sql", "mysql" },
-- -- add root dir support
-- root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")
-- or vim.loop.cwd()
-- or vim.fn.getcwd(),
}

View file

@ -0,0 +1,5 @@
return {
filetypes = { "blade" },
root_dir = require("lspconfig.util").root_pattern("composer.json", ".git") or vim.loop.cwd() or vim.fn.getcwd(),
singe_file_support = true,
}

View file

@ -0,0 +1,92 @@
return {
-- cmd = { "tailwindcss-language-server", "--stdio" },
-- filetypes = {
-- "aspnetcorerazor",
-- "astro",
-- "astro-markdown",
-- "blade",
-- "clojure",
-- "django-html",
-- "htmldjango",
-- "edge",
-- "eelixir",
-- "elixir",
-- "ejs",
-- "erb",
-- "eruby",
-- "gohtml",
-- "gohtmltmpl",
-- "haml",
-- "handlebars",
-- "hbs",
-- "html",
-- "html-eex",
-- "heex",
-- "jade",
-- "leaf",
-- "liquid",
-- "markdown",
-- "mdx",
-- "mustache",
-- "njk",
-- "nunjucks",
-- "php",
-- "razor",
-- "slim",
-- "twig",
-- "css",
-- "less",
-- "postcss",
-- "sass",
-- "scss",
-- "stylus",
-- "sugarss",
-- "javascript",
-- "javascriptreact",
-- "reason",
-- "rescript",
-- "typescript",
-- "typescriptreact",
-- "vue",
-- "svelte",
-- "templ",
-- },
-- -- init options
-- init_options = {
-- userLanguages = {
-- eelixir = "html-eex",
-- eruby = "erb",
-- templ = "html",
-- },
-- },
-- -- root dir
-- root_dir = root_pattern(
-- "tailwind.config.js",
-- "tailwind.config.cjs",
-- "tailwind.config.mjs",
-- "tailwind.config.ts",
-- "postcss.config.js",
-- "postcss.config.cjs",
-- "postcss.config.mjs",
-- "postcss.config.ts",
-- "package.json",
-- "node_modules",
-- ".git"
-- ),
-- -- settings
-- settings = {
-- tailwindCSS = {
-- classAttributes = { "class", "className", "class:list", "classList", "ngClass" },
-- lint = {
-- cssConflict = "warning",
-- invalidApply = "error",
-- invalidConfigPath = "error",
-- invalidScreen = "error",
-- invalidTailwindDirective = "error",
-- invalidVariant = "error",
-- recommendedVariantOrder = "warning",
-- },
-- validate = true,
-- },
-- },
}

View file

@ -0,0 +1,18 @@
return {
-- add cmd
cmd = { "typescript-language-server", "--stdio" },
-- add file type support
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
-- add dynamic root dir support
root_dir = require("lspconfig.util").root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git"),
init_options = {
hostInfo = "neovim",
},
}

View file

@ -0,0 +1,25 @@
local opts = {
setup = {
root_dir = require("lspconfig.util").root_pattern("package.json", "vue.config.js")
or vim.loop.cwd()
or vim.fn.getcwd(),
init_options = {
config = {
vetur = {
completion = {
autoImport = true,
tagCasing = "kebab",
useScaffoldSnippets = true,
},
useWorkspaceDependencies = true,
validation = {
script = true,
style = true,
template = true,
},
},
},
},
},
}
return opts

View file

@ -0,0 +1,16 @@
local opts = {
settings = {
yaml = {
hover = true,
completion = true,
validate = true,
schemaStore = {
enable = true,
url = "https://www.schemastore.org/api/json/catalog.json",
},
schemas = require("schemastore").yaml.schemas(),
},
},
}
return opts