Skip to content

Commit

Permalink
doc: add nvim-lspconfig example
Browse files Browse the repository at this point in the history
  • Loading branch information
Robzz committed Oct 9, 2024
1 parent 7cf9477 commit d75b0d6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions examples/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,20 @@ local lsp_ai_init_options_json = [[
}
]]

-- The configuration
-- 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.
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(),
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(),
init_options = vim.fn.json_decode(lsp_ai_init_options_json),
init_options = lsp_ai_init_options,
}

-- Start lsp-ai when opening a buffer
vim.api.nvim_create_autocmd("BufEnter", {
callback = function(args)
local bufnr = args.buf
Expand Down

0 comments on commit d75b0d6

Please sign in to comment.