stuff idk
This commit is contained in:
@ -45,7 +45,7 @@ return {
|
|||||||
local cmp = require("cmp")
|
local cmp = require("cmp")
|
||||||
|
|
||||||
local conditionalSources = cmp.config.sources({
|
local conditionalSources = cmp.config.sources({
|
||||||
{ name = "nvim_lsp", priority = 6 },
|
{ name = "nvim_lsp", priority = 100 },
|
||||||
{ name = "nvim_lsp_signature_help", priority = 6 },
|
{ name = "nvim_lsp_signature_help", priority = 6 },
|
||||||
{ name = "luasnip", priority = 7 },
|
{ name = "luasnip", priority = 7 },
|
||||||
{ name = "calc" },
|
{ name = "calc" },
|
||||||
@ -69,7 +69,7 @@ return {
|
|||||||
if use_google() then
|
if use_google() then
|
||||||
require("cmp_nvim_ciderlsp").setup()
|
require("cmp_nvim_ciderlsp").setup()
|
||||||
table.insert(conditionalSources, { name = "analysislsp" })
|
table.insert(conditionalSources, { name = "analysislsp" })
|
||||||
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 8 })
|
table.insert(conditionalSources, { name = "nvim_ciderlsp", priority = 80 })
|
||||||
else
|
else
|
||||||
table.insert(conditionalSources, { name = "cmp_tabnine" })
|
table.insert(conditionalSources, { name = "cmp_tabnine" })
|
||||||
end
|
end
|
||||||
@ -160,20 +160,18 @@ return {
|
|||||||
|
|
||||||
formatting = {
|
formatting = {
|
||||||
format = lspkind.cmp_format({
|
format = lspkind.cmp_format({
|
||||||
with_text = true,
|
mode = "symbol_text",
|
||||||
|
before = function(entry, vim_item)
|
||||||
-- mode = "symbol_text",
|
if entry.source.name == "nvim_ciderlsp" then
|
||||||
-- before = function(entry, vim_item)
|
if entry.completion_item.is_multiline then
|
||||||
-- if entry.source.name == "nvim_ciderlsp" then
|
-- multi-line specific formatting here
|
||||||
-- if entry.completion_item.is_multiline then
|
vim_item.menu = " "
|
||||||
-- -- multi-line specific formatting here
|
else
|
||||||
-- vim_item.menu = " "
|
vim_item.menu = ""
|
||||||
-- else
|
end
|
||||||
-- vim_item.menu = ""
|
end
|
||||||
-- end
|
return vim_item
|
||||||
-- end
|
end,
|
||||||
-- return vim_item
|
|
||||||
-- end,
|
|
||||||
maxwidth = 50, -- half max width
|
maxwidth = 50, -- half max width
|
||||||
menu = {
|
menu = {
|
||||||
nvim_ciderlsp = "",
|
nvim_ciderlsp = "",
|
||||||
@ -188,8 +186,8 @@ return {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|
||||||
experimental = {
|
experimental = {
|
||||||
|
native_menu = false,
|
||||||
ghost_text = true,
|
ghost_text = true,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
@ -137,16 +137,18 @@ return {
|
|||||||
-- Here are all the options and their default values:
|
-- Here are all the options and their default values:
|
||||||
require("google.comments").setup({
|
require("google.comments").setup({
|
||||||
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
|
-- command = {'/google/bin/releases/editor-devtools/get_comments.par', '--full', '--json', "-x=''"},
|
||||||
-- stubby = true,
|
stubby = true,
|
||||||
|
-- command = {
|
||||||
|
-- "/google/bin/releases/editor-devtools/get_comments.par",
|
||||||
|
-- "--json",
|
||||||
|
-- "--full",
|
||||||
|
-- "--noresolved",
|
||||||
|
-- "--cl_comments",
|
||||||
|
-- "--file_comments",
|
||||||
|
-- },
|
||||||
command = {
|
command = {
|
||||||
"/google/bin/releases/editor-devtools/get_comments.par",
|
'stubby --output_json call blade:codereview-rpc CodereviewRpcService.GetComments "changelist_number: $(/google/data/ro/teams/fig/bin/vcstool pending-change-number)"',
|
||||||
"--json",
|
|
||||||
"--full",
|
|
||||||
"--noresolved",
|
|
||||||
"--cl_comments",
|
|
||||||
"--file_comments",
|
|
||||||
},
|
},
|
||||||
-- command = {'stubby --output_json call blade:codereview-rpc CodereviewRpcService.GetComments "changelist_number: $(/google/data/ro/teams/fig/bin/vcstool pending-change-number)"'},
|
|
||||||
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
|
-- Define your own icon by `vim.fn.sign_define('ICON_NAME', {text = ' '})`.
|
||||||
-- See :help sign_define
|
-- See :help sign_define
|
||||||
-- The sign property passed to setup should be the 'ICON_NAME' in the define
|
-- The sign property passed to setup should be the 'ICON_NAME' in the define
|
||||||
|
@ -1,197 +1,192 @@
|
|||||||
return {
|
return {
|
||||||
{
|
{
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
-- event = "VimEnter",
|
-- event = "VimEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
"nvim-lua/lsp-status.nvim",
|
"nvim-lua/lsp-status.nvim",
|
||||||
"VonHeikemen/lsp-zero.nvim",
|
"VonHeikemen/lsp-zero.nvim",
|
||||||
"rcarriga/nvim-notify",
|
"rcarriga/nvim-notify",
|
||||||
},
|
},
|
||||||
keys = {
|
keys = {
|
||||||
{ "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>" },
|
{ "<leader>rn", "<cmd>lua vim.lsp.buf.rename()<CR>" },
|
||||||
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>" },
|
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>" },
|
||||||
{ "L", "<cmd>lua vim.lsp.buf.hover()<CR>" },
|
{ "L", "<cmd>lua vim.lsp.buf.hover()<CR>" },
|
||||||
{ "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>" },
|
{ "g0", "<cmd>lua vim.lsp.buf.document_symbol()<CR>" },
|
||||||
{ "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>" },
|
{ "gW", "<cmd>lua vim.lsp.buf.workspace_symbol()<CR>" },
|
||||||
{ "gd", "<cmd>lua vim.lsp.buf.definition()<CR>" },
|
{ "gd", "<cmd>lua vim.lsp.buf.definition()<CR>" },
|
||||||
{ "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>" },
|
{ "gD", "<cmd>tab split | lua vim.lsp.buf.definition()<CR>" },
|
||||||
{ "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>" },
|
{ "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>" },
|
||||||
{ "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>" },
|
{ "gI", "<cmd>lua vim.lsp.buf.implementation()<CR>" },
|
||||||
{ "gR", "<cmd>lua vim.lsp.buf.references()<CR>" },
|
{ "gR", "<cmd>lua vim.lsp.buf.references()<CR>" },
|
||||||
{ "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>" },
|
{ "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>" },
|
||||||
{ "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>" },
|
{ "gt", "<cmd>lua vim.lsp.buf.type_definition()<CR>" },
|
||||||
{ "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", mode = "i" },
|
{ "<C-g>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", mode = "i" },
|
||||||
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", mode = "v" },
|
{ "<leader>ca", "<cmd>lua vim.lsp.buf.code_action()<CR>", mode = "v" },
|
||||||
},
|
},
|
||||||
config = function()
|
config = function()
|
||||||
local use_google = require("utils").use_google
|
local use_google = require("utils").use_google
|
||||||
local notify = require("notify")
|
local notify = require("notify")
|
||||||
|
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local configs = require("lspconfig.configs")
|
local configs = require("lspconfig.configs")
|
||||||
local lsp_status = require("lsp-status")
|
local lsp_status = require("lsp-status")
|
||||||
lsp_status.register_progress()
|
lsp_status.register_progress()
|
||||||
|
|
||||||
-- CiderLSP
|
-- Don't show the dumb matching stuff
|
||||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
vim.opt.shortmess:append("c")
|
||||||
-- Don't show the dumb matching stuff
|
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||||
vim.opt.shortmess:append("c")
|
|
||||||
|
|
||||||
vim.opt.spell = true
|
vim.opt.spell = true
|
||||||
vim.opt.spelllang = { "en_us" }
|
vim.opt.spelllang = { "en_us" }
|
||||||
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
|
vim.lsp.handlers["window/showMessage"] = function(_, result, ctx)
|
||||||
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
local client = vim.lsp.get_client_by_id(ctx.client_id)
|
||||||
local lvl = ({
|
local lvl = ({ "ERROR", "WARN", "INFO", "DEBUG" })[result.type]
|
||||||
"ERROR",
|
notify({ result.message }, lvl, {
|
||||||
"WARN",
|
title = "LSP | " .. client.name,
|
||||||
"INFO",
|
timeout = 1000,
|
||||||
"DEBUG",
|
keep = function()
|
||||||
})[result.type]
|
return lvl == "ERROR" or lvl == "WARN"
|
||||||
notify({ result.message }, lvl, {
|
end,
|
||||||
title = "LSP | " .. client.name,
|
})
|
||||||
timeout = 1000,
|
end
|
||||||
keep = function()
|
|
||||||
return lvl == "ERROR" or lvl == "WARN"
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
if use_google() then
|
if use_google() then
|
||||||
configs.ciderlsp = {
|
configs.ciderlsp = {
|
||||||
default_config = {
|
default_config = {
|
||||||
cmd = {
|
cmd = {
|
||||||
"/google/bin/releases/cider/ciderlsp/ciderlsp",
|
"/google/bin/releases/cider/ciderlsp/ciderlsp",
|
||||||
"--tooltag=nvim-cmp",
|
"--tooltag=nvim-lsp",
|
||||||
"--forward_sync_responses",
|
"--forward_sync_responses",
|
||||||
},
|
},
|
||||||
offset_encoding = "utf-8",
|
offset_encoding = "utf-8",
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"c",
|
"c",
|
||||||
"cpp",
|
"cpp",
|
||||||
"java",
|
"java",
|
||||||
"kotlin",
|
"kotlin",
|
||||||
"objc",
|
"objc",
|
||||||
"proto",
|
"proto",
|
||||||
"textproto",
|
"textproto",
|
||||||
"go",
|
"go",
|
||||||
"python",
|
"python",
|
||||||
"bzl",
|
"bzl",
|
||||||
"typescript",
|
"typescript",
|
||||||
},
|
},
|
||||||
-- required for proto generated files jump
|
-- required for proto generated files jump
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
|
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
|
||||||
end,
|
end,
|
||||||
settings = {},
|
settings = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
configs.analysislsp = {
|
configs.analysislsp = {
|
||||||
default_config = {
|
default_config = {
|
||||||
cmd = {
|
cmd = {
|
||||||
"/google/bin/users/lerm/glint-ale/analysis_lsp/server",
|
"/google/bin/users/lerm/glint-ale/analysis_lsp/server",
|
||||||
"--lint_on_save=false",
|
"--lint_on_save=false",
|
||||||
"--max_qps=10",
|
"--max_qps=10",
|
||||||
},
|
},
|
||||||
offset_encoding = "utf-8",
|
offset_encoding = "utf-8",
|
||||||
filetypes = {
|
filetypes = {
|
||||||
"c",
|
"c",
|
||||||
"cpp",
|
"cpp",
|
||||||
"java",
|
"java",
|
||||||
"kotlin",
|
"kotlin",
|
||||||
"objc",
|
"objc",
|
||||||
"proto",
|
"proto",
|
||||||
"textproto",
|
"textproto",
|
||||||
"go",
|
"go",
|
||||||
"python",
|
"python",
|
||||||
"bzl",
|
"bzl",
|
||||||
"markdown",
|
"markdown",
|
||||||
"typescript",
|
"typescript",
|
||||||
"javascript",
|
"javascript",
|
||||||
},
|
},
|
||||||
root_dir = function(fname)
|
root_dir = function(fname)
|
||||||
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
|
return string.match(fname, "(/google/src/cloud/[%w_-]+/[%w_-]+/google3/).+$")
|
||||||
end,
|
end,
|
||||||
settings = {},
|
settings = {},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
local capabilities =
|
local capabilities =
|
||||||
require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||||
capabilities["codeLens"] = { dynamicRegistration = false }
|
capabilities["codeLens"] = { dynamicRegistration = false }
|
||||||
capabilities.textDocument.publishDiagnostics = {
|
capabilities.textDocument.publishDiagnostics = {
|
||||||
relatedInformation = true,
|
relatedInformation = true,
|
||||||
versionSupport = false,
|
versionSupport = false,
|
||||||
tagSupport = {
|
tagSupport = {
|
||||||
valueSet = {
|
valueSet = {
|
||||||
1,
|
1,
|
||||||
2,
|
2,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
codeDescriptionSupport = true,
|
codeDescriptionSupport = true,
|
||||||
dataSupport = true,
|
dataSupport = true,
|
||||||
layeredDiagnostics = true,
|
layeredDiagnostics = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
|
capabilities = vim.tbl_extend("keep", capabilities or {}, lsp_status.capabilities)
|
||||||
|
|
||||||
local my_on_attach = function(client, bufnr)
|
local my_on_attach = function(client, bufnr)
|
||||||
require("lualine").refresh()
|
require("lualine").refresh()
|
||||||
|
|
||||||
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
|
vim.api.nvim_command("autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()")
|
||||||
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
|
vim.api.nvim_command("autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()")
|
||||||
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
|
vim.api.nvim_command("autocmd CursorMoved <buffer> lua vim.lsp.util.buf_clear_references()")
|
||||||
|
|
||||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||||
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
||||||
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
||||||
end
|
end
|
||||||
if vim.lsp.tagfunc then
|
if vim.lsp.tagfunc then
|
||||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||||
end
|
end
|
||||||
|
|
||||||
lsp_status.on_attach(client)
|
lsp_status.on_attach(client)
|
||||||
end
|
end
|
||||||
|
|
||||||
if use_google() then
|
if use_google() then
|
||||||
local cider_on_attach = function(client, bufnr)
|
local cider_on_attach = function(client, bufnr)
|
||||||
my_on_attach(client, bufnr)
|
my_on_attach(client, bufnr)
|
||||||
vim.b["is_cider_lsp_attached"] = "no"
|
vim.b["is_cider_lsp_attached"] = "no"
|
||||||
end
|
end
|
||||||
|
|
||||||
local cider_lsp_handlers = {
|
local cider_lsp_handlers = {
|
||||||
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
["textDocument/publishDiagnostics"] = vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||||
underline = true,
|
underline = true,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
||||||
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
|
-- is_cider_lsp_attached has been setup via on_init, but hasn't received
|
||||||
-- sync response yet.
|
-- sync response yet.
|
||||||
local first_fire = vim.b["is_cider_lsp_attached"] == "no"
|
local first_fire = vim.b["is_cider_lsp_attached"] == "no"
|
||||||
vim.b["is_cider_lsp_attached"] = "yes"
|
vim.b["is_cider_lsp_attached"] = "yes"
|
||||||
if first_fire then
|
if first_fire then
|
||||||
notify("CiderLSP attached", "info", { timeout = 500 })
|
notify("CiderLSP attached", "info", { timeout = 500 })
|
||||||
require("lualine").refresh()
|
require("lualine").refresh()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
require("cmp_nvim_ciderlsp").setup({
|
||||||
|
multiline_summary_symbol = "…",
|
||||||
|
})
|
||||||
|
capabilities = require("cmp_nvim_ciderlsp").update_capabilities(capabilities)
|
||||||
|
capabilities.workspace.codeLens = { refreshSupport = true }
|
||||||
|
capabilities.workspace.diagnostics = { refreshSupport = true }
|
||||||
|
|
||||||
capabilities = require("cmp_nvim_ciderlsp").update_capabilities(capabilities)
|
lspconfig.ciderlsp.setup({
|
||||||
capabilities.workspace.codeLens = { refreshSupport = true }
|
capabilities = capabilities,
|
||||||
capabilities.workspace.diagnostics = { refreshSupport = true }
|
on_attach = cider_on_attach,
|
||||||
|
handlers = cider_lsp_handlers,
|
||||||
lspconfig.analysislsp.setup({
|
})
|
||||||
capabilities = capabilities,
|
lspconfig.analysislsp.setup({
|
||||||
})
|
capabilities = capabilities,
|
||||||
|
})
|
||||||
lspconfig.ciderlsp.setup({
|
end
|
||||||
capabilities = capabilities,
|
end,
|
||||||
on_attach = cider_on_attach,
|
},
|
||||||
handlers = cider_lsp_handlers,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,8 @@ return {
|
|||||||
lazy = false,
|
lazy = false,
|
||||||
config = function()
|
config = function()
|
||||||
vim.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_lines = { only_current_line = true },
|
-- virtual_lines = { only_current_line = true },
|
||||||
|
virtual_lines = true,
|
||||||
|
|
||||||
-- update_in_insert = true,
|
-- update_in_insert = true,
|
||||||
virtual_text = false,
|
virtual_text = false,
|
||||||
|
Reference in New Issue
Block a user