-- Get default capabilities from blink.cmp local capabilities = require("blink.cmp").get_lsp_capabilities() -- Enable dynamic registration for watched files on Windows capabilities.workspace = vim.tbl_deep_extend("force", capabilities.workspace or {}, { didChangeWatchedFiles = { dynamicRegistration = true, }, }) -- Apply capabilities globally to all servers in Neovim native LSP vim.lsp.config('*', { capabilities = capabilities, }) local library = { vim.env.VIMRUNTIME, } -- Add lspconfig library if it exists local lspconfig_path = vim.api.nvim_get_runtime_file("lua/lspconfig", false)[1] if lspconfig_path then table.insert(library, lspconfig_path) end vim.lsp.config('lua_ls', { cmd = { 'lua-language-server' }, root_markers = { '.luarc.json', '.luarc.jsonc', '.git', 'init.lua' }, settings = { Lua = { runtime = { version = 'LuaJIT', path = { 'lua/?.lua', 'lua/?/init.lua', }, }, workspace = { checkThirdParty = false, library = { vim.env.VIMRUNTIME, "${3rd}/luv/library" }, }, telemetry = { enabled = false }, }, }, }) vim.api.nvim_create_autocmd('LspAttach', { group = vim.api.nvim_create_augroup('my.lsp', {}), callback = function(ev) local client = assert(vim.lsp.get_client_by_id(ev.data.client_id)) if client:supports_method('textDocument/implementation') then -- Create a keymap for vim.lsp.buf.implementation ... end -- Enable auto-completion. Note: Use CTRL-Y to select an item. |complete_CTRL-Y| if client:supports_method('textDocument/completion') then -- Optional: trigger autocompletion on EVERY keypress. May be slow! -- local chars = {}; for i = 32, 126 do table.insert(chars, string.char(i)) end -- client.server_capabilities.completionProvider.triggerCharacters = chars vim.lsp.completion.enable(true, client.id, ev.buf, {autotrigger = true}) end -- Auto-format ("lint") on save. -- Usually not needed if server supports "textDocument/willSaveWaitUntil". if not client:supports_method('textDocument/willSaveWaitUntil') and client:supports_method('textDocument/formatting') then vim.api.nvim_create_autocmd('BufWritePre', { group = vim.api.nvim_create_augroup('my.lsp', {clear=false}), buffer = ev.buf, callback = function() vim.lsp.buf.format({ bufnr = ev.buf, id = client.id, timeout_ms = 1000 }) end, }) end end, }) vim.diagnostic.enable(not vim.diagnostic.is_enabled()) vim.diagnostic.config({ virtual_text = true, virtual_lines = true, severity_sort = true, underline = true, }) vim.lsp.enable('lua_ls') vim.lsp.enable('ty') vim.lsp.enable('markdown_oxide') vim.lsp.inline_completion.enable(not vim.lsp.inline_completion.is_enabled()) vim.lsp.inlay_hint.enable(true) -- 1. Point to where you extracted the zip file local ps_bundle_path = "C:/Developer/PowerShellEditorServices" -- 2. Configure the server properties vim.lsp.config('powershell_es', { bundle_path = ps_bundle_path, shell = 'powershell.exe', -- Use 'pwsh' if you have PowerShell Core installed settings = { powershell = { codeFormatting = { Preset = 'OTBS' -- "One True Brace Style" (or use 'Allman' for standard Windows formatting) } } } }) -- 3. Enable it so it attaches automatically to .ps1 files vim.lsp.enable('powershell_es')