simplify google
This commit is contained in:
@ -1,76 +0,0 @@
|
||||
local use_google = require("utils").use_google
|
||||
local M = {}
|
||||
|
||||
function M.setup(capabilities)
|
||||
if use_google() then
|
||||
local lspconfig = require("lspconfig")
|
||||
local configs = require("lspconfig.configs")
|
||||
configs.ciderlsp = {
|
||||
default_config = {
|
||||
-- offset_encoding = "utf-16",
|
||||
cmd = {
|
||||
"/google/bin/releases/cider/ciderlsp/ciderlsp",
|
||||
"--tooltag=nvim-lsp",
|
||||
"--forward_sync_responses",
|
||||
-- "--debug_relay",
|
||||
},
|
||||
filetypes = {
|
||||
"c",
|
||||
"cpp",
|
||||
"java",
|
||||
"kotlin",
|
||||
"objc",
|
||||
"proto",
|
||||
"textproto",
|
||||
"go",
|
||||
"python",
|
||||
"bzl",
|
||||
"typescript",
|
||||
},
|
||||
root_dir = require("lspconfig").util.root_pattern(".citc"),
|
||||
settings = {},
|
||||
},
|
||||
}
|
||||
|
||||
local my_on_attach = function(client, bufnr)
|
||||
require("lualine").refresh()
|
||||
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
|
||||
if vim.lsp.formatexpr then -- Neovim v0.6.0+ only.
|
||||
vim.api.nvim_buf_set_option(bufnr, "formatexpr", "v:lua.vim.lsp.formatexpr")
|
||||
end
|
||||
if vim.lsp.tagfunc then
|
||||
vim.api.nvim_buf_set_option(bufnr, "tagfunc", "v:lua.vim.lsp.tagfunc")
|
||||
end
|
||||
|
||||
local lsp_status = require("lsp-status")
|
||||
lsp_status.on_attach(client)
|
||||
end
|
||||
|
||||
local cider_on_attach = function(client, bufnr)
|
||||
my_on_attach(client, bufnr)
|
||||
vim.b["is_cider_lsp_attached"] = "no"
|
||||
end
|
||||
|
||||
local cider_lsp_handlers = {}
|
||||
-- cider_lsp_handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
-- focusable = false,
|
||||
-- })
|
||||
|
||||
cider_lsp_handlers["$/syncResponse"] = function(_, result, ctx)
|
||||
local first_fire = vim.b["is_cider_lsp_attached"] == "no"
|
||||
vim.b["is_cider_lsp_attached"] = "yes"
|
||||
if first_fire then
|
||||
vim.notify("CiderLSP attached")
|
||||
require("lualine").refresh()
|
||||
end
|
||||
end
|
||||
|
||||
lspconfig.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = cider_on_attach,
|
||||
handlers = cider_lsp_handlers,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
@ -69,16 +69,6 @@ return {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"Bekaboo/dropbar.nvim",
|
||||
-- optional, but required for fuzzy finder support
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
},
|
||||
config = function()
|
||||
vim.ui.select = require("dropbar.utils.menu").select
|
||||
end,
|
||||
},
|
||||
"RRethy/vim-illuminate",
|
||||
"kdheepak/lazygit.nvim",
|
||||
"flwyd/vim-conjoin",
|
||||
@ -90,7 +80,7 @@ return {
|
||||
{ "nvim-lua/plenary.nvim", lazy = false },
|
||||
{ "squk/java-syntax.vim", ft = "java" },
|
||||
{ "udalov/kotlin-vim", event = "VeryLazy", ft = "kotlin" },
|
||||
-- { "andymass/vim-matchup", event = "VimEnter" },
|
||||
{ "andymass/vim-matchup", event = "VimEnter" },
|
||||
{ "jghauser/mkdir.nvim", event = "BufWritePre" },
|
||||
{
|
||||
"rmagatti/auto-session",
|
||||
|
@ -2,6 +2,7 @@ return {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
version = "*",
|
||||
cond = false,
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
opts = {
|
||||
options = {
|
||||
@ -22,7 +23,7 @@ return {
|
||||
separator = true, -- use a "true" to enable the default, or set your own character
|
||||
},
|
||||
},
|
||||
mode = "tabs",
|
||||
-- mode = "tabs",
|
||||
diagnostics = "nvim_lsp",
|
||||
diagnostics_indicator = function(count, level, diagnostics_dict, context)
|
||||
local symbols = { error = " ", warning = " ", info = " ", hint = " " }
|
||||
@ -33,38 +34,38 @@ return {
|
||||
truncate_name = false,
|
||||
show_close_icon = false,
|
||||
show_buffer_close_icons = false,
|
||||
-- groups = {
|
||||
-- options = {
|
||||
-- toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
|
||||
-- },
|
||||
-- items = {
|
||||
-- {
|
||||
-- name = "Tests", -- Mandatory
|
||||
-- highlight = { sp = "lightblue" }, -- Optional
|
||||
-- priority = 2, -- determines where it will appear relative to other groups (Optional)
|
||||
-- icon = " ", -- Optional
|
||||
-- matcher = function(buf) -- Mandatory
|
||||
-- return buf.path:match("%_test.cc$") or buf.path:match("%Test.java$")
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- name = "Docs",
|
||||
-- highlight = { sp = "lightgreen" },
|
||||
-- auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||
-- matcher = function(buf)
|
||||
-- return buf.path:match("%.md$") or buf.path:match("%.txt$")
|
||||
-- end,
|
||||
-- },
|
||||
-- {
|
||||
-- name = "Lua",
|
||||
-- highlight = { sp = "lightblue" },
|
||||
-- auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||
-- matcher = function(buf)
|
||||
-- return buf.path:match("%.lua$")
|
||||
-- end,
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
groups = {
|
||||
options = {
|
||||
toggle_hidden_on_enter = true, -- when you re-enter a hidden group this options re-opens that group so the buffer is visible
|
||||
},
|
||||
items = {
|
||||
{
|
||||
name = "Tests", -- Mandatory
|
||||
highlight = { sp = "lightblue" }, -- Optional
|
||||
priority = 2, -- determines where it will appear relative to other groups (Optional)
|
||||
icon = " ", -- Optional
|
||||
matcher = function(buf) -- Mandatory
|
||||
return buf.path:match("%_test.cc$") or buf.path:match("%Test.java$")
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Docs",
|
||||
highlight = { sp = "lightgreen" },
|
||||
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||
matcher = function(buf)
|
||||
return buf.path:match("%.md$") or buf.path:match("%.txt$")
|
||||
end,
|
||||
},
|
||||
{
|
||||
name = "Lua",
|
||||
highlight = { sp = "lightblue" },
|
||||
auto_close = false, -- whether or not close this group if it doesn't contain the current buffer
|
||||
matcher = function(buf)
|
||||
return buf.path:match("%.lua$")
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -121,8 +121,21 @@ return {
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
local configs = require("lspconfig.configs")
|
||||
require("config.lsp-google").setup(capabilities)
|
||||
|
||||
local nvim_lspconfig = require("lspconfig")
|
||||
local lsp_configs = require("lspconfig.configs")
|
||||
|
||||
lsp_configs.ciderlsp = {
|
||||
default_config = {
|
||||
cmd = { '/google/bin/releases/cider/ciderlsp/ciderlsp', '--tooltag=nvim-lsp', '--noforward_sync_responses' },
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl", "typescript" },
|
||||
offset_encoding = 'utf-8',
|
||||
root_dir = nvim_lspconfig.util.root_pattern('.citc'),
|
||||
settings = {},
|
||||
}
|
||||
}
|
||||
|
||||
nvim_lspconfig.ciderlsp.setup {}
|
||||
-- Godot
|
||||
lspconfig.gdscript.setup({
|
||||
-- flags = {
|
||||
|
@ -1,46 +1,3 @@
|
||||
local split = function(inputstr, sep)
|
||||
local t = {}
|
||||
for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do
|
||||
table.insert(t, str)
|
||||
end
|
||||
return t
|
||||
end
|
||||
local function getCitc()
|
||||
local fname = vim.api.nvim_buf_get_name(0)
|
||||
if string.find(fname, "/google/src/cloud/", 1, true) then
|
||||
local parts = split(fname, "/")
|
||||
return parts[5]
|
||||
end
|
||||
end
|
||||
local function isCiderLspAttached()
|
||||
if vim.b["is_cider_lsp_attached"] then
|
||||
if vim.b["is_cider_lsp_attached"] == "yes" then
|
||||
return "✓"
|
||||
else
|
||||
return "x"
|
||||
end
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
local function getLightbulb()
|
||||
return require("nvim-lightbulb").get_status_text()
|
||||
end
|
||||
|
||||
local function getLGTMs()
|
||||
local comments = require("google.comments")
|
||||
local tracker = require("google.comments.tracker")
|
||||
local dump = require("utils").dump
|
||||
|
||||
print(dump(tracker.get_all_comments()))
|
||||
local lgtm = comments.get_lgtms()
|
||||
local appr = comments.get_approvals()
|
||||
print("lgtms" .. dump(lgtm))
|
||||
print("approvals" .. dump(appr))
|
||||
return "LGTM:" .. table.concat(lgtm, ",") .. " Approval:" .. table.concat(appr, ",")
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
lazy = false,
|
||||
@ -52,16 +9,16 @@ return {
|
||||
theme = "auto",
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
-- tabline = 1000,
|
||||
winbar = 1000,
|
||||
statusline = 100,
|
||||
tabline = 100,
|
||||
winbar = 100,
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch", "diff", getCitc, isCiderLspAttached },
|
||||
lualine_b = { "branch", "diff" },
|
||||
lualine_c = {
|
||||
getLightbulb,
|
||||
require("nvim-lightbulb").get_status_text,
|
||||
{
|
||||
"filename",
|
||||
path = 4, -- 0 = just filename, 1 = relative path, 2 = absolute path
|
||||
|
@ -40,6 +40,7 @@ end
|
||||
local keys = {
|
||||
-- { "<leader>e", ":lua search_cwd()<CR>", desc = "Find Files in Buffer Directory" },
|
||||
{ "<leader>ts", require('telescope.builtin').live_grep },
|
||||
{ "<leader>tb", ":Telescope buffers<CR>" },
|
||||
{ "<leader>TS", function() require('telescope.builtin').live_grep { default_text = vim.fn.expand("<cword>") } end, },
|
||||
{
|
||||
"<leader>t.",
|
||||
|
Reference in New Issue
Block a user