Skip to content

Commit

Permalink
perf(lsp): update lsp config
Browse files Browse the repository at this point in the history
  • Loading branch information
liubang committed Aug 5, 2023
1 parent 8b389ec commit 8f59d82
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 33 deletions.
28 changes: 0 additions & 28 deletions lua/plugins/editor.lua
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@ return {
{
"iamcco/markdown-preview.nvim", -- {{{
ft = { "markdown" },
enabled = function()
return vim.fn.executable "deno" == 0 and vim.fn.executable "npm" == 1
end,
build = function()
vim.fn["mkdp#util#install"]()
end,
Expand All @@ -201,31 +198,6 @@ return {
-- }}}
},

{
"toppair/peek.nvim", -- {{{
build = "deno task --quiet build:fast",
enabled = function()
return vim.fn.executable "deno" == 1
end,
ft = { "markdown" },
keys = {
{
"<leader>mp",
function()
local peek = require "peek"
if peek.is_open() then
peek.close()
else
peek.open()
end
end,
desc = "Peek (Markdown Preview)",
},
},
opts = { theme = "light" },
-- }}}
},

{
"saecki/crates.nvim", -- {{{
event = { "BufReadPre Cargo.toml" },
Expand Down
3 changes: 1 addition & 2 deletions lua/plugins/lsp/handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ vim.diagnostic.config { -- {{{
},
} -- }}}

-- {{{
local signs = {
local signs = { -- {{{
Error = "",
Warn = "",
Info = "",
Expand Down
18 changes: 15 additions & 3 deletions lua/plugins/lsp/servers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,18 @@ lspconfig.clangd.setup(c.default {
-- }}}

-- {{{ gopls
local get_current_gomod = function()
local file = io.open("go.mod", "r")
if file == nil then
return nil
end

local first_line = file:read()
local mod_name = first_line:gsub("module ", "")
file:close()
return mod_name
end

lspconfig.gopls.setup(c.default {
-- share the gopls instance if there is one already
cmd = { "gopls", "-remote.debug=:0" },
Expand Down Expand Up @@ -141,15 +153,15 @@ lspconfig.gopls.setup(c.default {
"-**/node_modules",
"-/tmp",
},
usePlaceholders = true,
verboseOutput = false, -- useful for debugging when true.
["local"] = get_current_gomod(),
semanticTokens = true,
usePlaceholders = true,
completeUnimported = true,
completionDocumentation = true,
staticcheck = true,
gofumpt = true,
linksInHover = true,
buildFlags = { "-tags=integration,e2e" },
buildFlags = { "-tags", "integration" },
},
},
})
Expand Down

0 comments on commit 8f59d82

Please sign in to comment.