Something went wrong. Try again.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117-- Get default capabilities from blink.cmplocal capabilities = require("blink.cmp").get_lsp_capabilities()
-- Enable dynamic registration for watched files on Windowscapabilities.workspace = vim.tbl_deep_extend("force", capabilities.workspace or {}, { didChangeWatchedFiles = { dynamicRegistration = true, },})
-- Apply capabilities globally to all servers in Neovim native LSPvim.lsp.config('*', { capabilities = capabilities,})
local library = { vim.env.VIMRUNTIME,}
-- Add lspconfig library if it existslocal 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 filelocal ps_bundle_path = "C:/Developer/PowerShellEditorServices"
-- 2. Configure the server propertiesvim.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 filesvim.lsp.enable('powershell_es')