Skip to content

Commit

Permalink
fix(examples/nvim): fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
Robzz committed Oct 10, 2024
1 parent 8f8d208 commit 91b91c3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,22 @@ Response:

-- The easiest way to configure the language server is to use the nvim-lspconfig plugin: https://github.com/neovim/nvim-lspconfig
-- Use the following snippet to configure it after installing it with the plugin manager of your choice.
-- See the nvim-lspconfig docs for the supported parameters on top of the init_options at https://github.com/neovim/nvim-lspconfig/blob/master/doc/lspconfig.txt
require('nvim-lspconfig').lsp_ai.setup {
-- See the nvim-lspconfig docs for the supported parameters on top of the init_options at https://github.com/neovim/nvim-lspconfig/blob/master/doc/lspconfig.txt
root_dir = vim.loop.cwd(),
root_dir = vim.fn.getcwd(),
init_options = lsp_ai_init_options,
}

-- Start lsp-ai or attach the active instance when opening a buffer, handled automatically when using nvim-lspconfig
local lsp_ai_config = {
cmd = { 'lsp-ai' },
root_dir = vim.loop.cwd(),
root_dir = vim.fn.getcwd(),
init_options = lsp_ai_init_options,
}
vim.api.nvim_create_autocmd("BufEnter", {
callback = function(args)
local bufnr = args.buf
local client = vim.lsp.get_active_clients({bufnr = bufnr, name = "lsp-ai"})
local client = vim.lsp.get_clients({bufnr = bufnr, name = "lsp-ai"})
if #client == 0 then
vim.lsp.start(lsp_ai_config, {bufnr = bufnr})
end
Expand Down

0 comments on commit 91b91c3

Please sign in to comment.