84 lines
3.2 KiB
Lua
84 lines
3.2 KiB
Lua
---@type vim.lsp.Config
|
|
--[[
|
|
Example LSP server configuration for Neovim 0.11+ native LSP API
|
|
|
|
This file demonstrates the structure and common patterns for configuring
|
|
LSP servers in the new vim.lsp.Config format. Copy this file and modify
|
|
it for your specific language server.
|
|
|
|
Key components:
|
|
- cmd: Command and arguments to start the server
|
|
- filetypes: File types that should trigger this LSP server
|
|
- root_markers: Files/directories that define project root (nested arrays = equal priority)
|
|
- settings: Server-specific configuration (schema varies by server)
|
|
|
|
For server-specific settings schemas, check the server's documentation:
|
|
- Language servers often provide JSON schemas for their settings
|
|
- Many examples can be found at: https://github.com/neovim/nvim-lspconfig
|
|
|
|
This configuration works with both Neovim 0.11+ (native vim.lsp.config)
|
|
and older versions (via nvim-lspconfig) thanks to the compatibility layer
|
|
in lua/functions/lsp.lua
|
|
--]]
|
|
|
|
return {
|
|
-- Command to start the language server
|
|
-- This should match the executable name installed by Mason or system package manager
|
|
cmd = { "language-server-executable" },
|
|
|
|
-- File types that should automatically attach this LSP server
|
|
filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" },
|
|
|
|
-- Root directory markers - LSP will search for these files/directories
|
|
-- to determine the project root. Nested arrays indicate equal priority.
|
|
-- The first match wins within each priority level.
|
|
root_markers = {
|
|
{ "package.json", "tsconfig.json", "jsconfig.json" }, -- High priority
|
|
{ ".git", ".hg" } -- Fallback markers
|
|
},
|
|
|
|
-- Server-specific settings (varies by language server)
|
|
-- Check your language server's documentation for available options
|
|
settings = {
|
|
-- Example: TypeScript server settings
|
|
typescript = {
|
|
inlayHints = {
|
|
includeInlayParameterNameHints = "all",
|
|
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
|
|
includeInlayFunctionParameterTypeHints = true,
|
|
includeInlayVariableTypeHints = true,
|
|
includeInlayPropertyDeclarationTypeHints = true,
|
|
includeInlayFunctionLikeReturnTypeHints = true,
|
|
includeInlayEnumMemberValueHints = true,
|
|
},
|
|
suggest = {
|
|
includeCompletionsForModuleExports = true,
|
|
},
|
|
preferences = {
|
|
includePackageJsonAutoImports = "auto",
|
|
},
|
|
},
|
|
javascript = {
|
|
-- JavaScript-specific settings
|
|
suggest = {
|
|
includeCompletionsForModuleExports = true,
|
|
},
|
|
},
|
|
},
|
|
|
|
-- Optional: Additional capabilities (usually handled globally)
|
|
-- capabilities = require("blink.cmp").get_lsp_capabilities(),
|
|
|
|
-- Optional: Custom initialization options
|
|
-- init_options = {
|
|
-- hostInfo = "neovim",
|
|
-- },
|
|
|
|
-- Optional: Custom handlers for LSP methods
|
|
-- handlers = {
|
|
-- ["textDocument/hover"] = vim.lsp.with(
|
|
-- vim.lsp.handlers.hover,
|
|
-- { border = "rounded" }
|
|
-- ),
|
|
-- },
|
|
} |