Skip to content

Commit

Permalink
feat(nvim): setup LSP and completion using blink
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanpinn committed Dec 19, 2024
1 parent 60653ee commit f1a2049
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
30 changes: 30 additions & 0 deletions nvim/lua/plugins/blink.lua
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" },
},
}
68 changes: 68 additions & 0 deletions nvim/lua/plugins/lsp-config.lua
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,
},
}

0 comments on commit f1a2049

Please sign in to comment.