-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nvim): setup LSP and completion using blink
- Loading branch information
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
return { | ||
{ | ||
"saghen/blink.cmp", | ||
-- optional: provides snippets for the snippet source | ||
dependencies = "rafamadriz/friendly-snippets", | ||
|
||
-- use a release tag to download pre-built binaries | ||
version = "v0.*", | ||
opts = { | ||
keymap = { preset = "default" }, | ||
|
||
appearance = { | ||
use_nvim_cmp_as_default = true, | ||
nerd_font_variant = "mono", | ||
}, | ||
|
||
sources = { | ||
default = { "lsp", "path", "snippets", "buffer", "lazydev" }, | ||
}, | ||
providers = { | ||
-- dont show LuaLS require statements when lazydev has items | ||
lsp = { fallback_for = { "lazydev" } }, | ||
lazydev = { name = "LazyDev", module = "lazydev.integrations.blink" }, | ||
}, | ||
|
||
signature = { enabled = true }, | ||
}, | ||
opts_extend = { "sources.default" }, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
return { | ||
-- lspconfig | ||
{ | ||
"neovim/nvim-lspconfig", | ||
dependencies = { | ||
{ | ||
"folke/lazydev.nvim", | ||
ft = "lua", -- only load on lua files | ||
cmd = "LazyDev", | ||
opts = { | ||
library = { | ||
-- See the configuration section for more details | ||
-- Load luvit types when the `vim.uv` word is found | ||
{ path = "${3rd}/luv/library", words = { "vim%.uv" } }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
config = function() | ||
local lspconfig = require("lspconfig") | ||
|
||
lspconfig.lua_ls.setup({ | ||
on_init = function(client) | ||
if client.workspace_folders then | ||
local path = client.workspace_folders[1].name | ||
if vim.loop.fs_stat(path .. "/.luarc.json") or vim.loop.fs_stat(path .. "/.luarc.jsonc") then | ||
return | ||
end | ||
end | ||
|
||
client.config.settings.Lua = vim.tbl_deep_extend("force", client.config.settings.Lua, { | ||
runtime = { | ||
version = "LuaJIT", | ||
}, | ||
-- Make the server aware of Neovim runtime files | ||
workspace = { | ||
checkThirdParty = false, | ||
library = { | ||
vim.env.VIMRUNTIME, | ||
}, | ||
}, | ||
}) | ||
end, | ||
settings = { | ||
Lua = { | ||
codeLens = { | ||
enable = true, | ||
}, | ||
completion = { | ||
callSnippet = "Replace", | ||
}, | ||
doc = { | ||
privateName = { "^_" }, | ||
}, | ||
hint = { | ||
enable = true, | ||
setType = false, | ||
paramType = true, | ||
paramName = "Disable", | ||
semicolon = "Disable", | ||
arrayIndex = "Disable", | ||
}, | ||
}, | ||
}, | ||
}) | ||
end, | ||
}, | ||
} |