better google specific loading
This commit is contained in:
@ -1,16 +1,19 @@
|
||||
-- 1. Configure CiderLSP
|
||||
local use_google = require("utils").use_google
|
||||
local lspconfig = require("lspconfig")
|
||||
local configs = require("lspconfig.configs")
|
||||
local notify = require 'notify'
|
||||
configs.ciderlsp = {
|
||||
default_config = {
|
||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses" },
|
||||
-- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'};
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl" },
|
||||
root_dir = lspconfig.util.root_pattern("BUILD"),
|
||||
settings = {},
|
||||
},
|
||||
}
|
||||
if use_google() then
|
||||
configs.ciderlsp = {
|
||||
default_config = {
|
||||
cmd = { "/google/bin/releases/cider/ciderlsp/ciderlsp", "--tooltag=nvim-cmp", "--forward_sync_responses" },
|
||||
-- cmd = {'/google/bin/releases/cider/ciderlsp/ciderlsp', '--forward_sync_responses', '--enable_document_highlight'};
|
||||
filetypes = { "c", "cpp", "java", "kotlin", "objc", "proto", "textproto", "go", "python", "bzl" },
|
||||
root_dir = lspconfig.util.root_pattern("BUILD"),
|
||||
settings = {},
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
local has_words_before = function()
|
||||
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
@ -48,6 +51,28 @@ cmp.setup.cmdline(':', {
|
||||
})
|
||||
})
|
||||
|
||||
local conditionalSources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "vim_vsnip" },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
{
|
||||
name = 'spell',
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
if use_google() then
|
||||
table.insert(conditionalSources, { name = 'nvim_ciderlsp', priority = 9 })
|
||||
end
|
||||
|
||||
cmp.setup({
|
||||
mapping = {
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(-4),
|
||||
@ -97,24 +122,7 @@ cmp.setup({
|
||||
end),
|
||||
},
|
||||
|
||||
sources = {
|
||||
{ name = "nvim_lua" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "path" },
|
||||
{ name = "vim_vsnip" },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = 'nvim_ciderlsp', priority = 9 },
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
{
|
||||
name = 'spell',
|
||||
option = {
|
||||
keep_all_entries = false,
|
||||
enable_in_context = function()
|
||||
return true
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
sources = conditionalSources,
|
||||
|
||||
sorting = {
|
||||
comparators = {
|
||||
@ -257,7 +265,6 @@ end
|
||||
|
||||
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
||||
capabilities['codeLens'] = {dynamicRegistration=false}
|
||||
-- capabilities.workspace.codeLens = {refreshSupport=true}
|
||||
-- capabilities.workspace.diagnostics = {refreshSupport=true}
|
||||
@ -274,12 +281,14 @@ capabilities.textDocument.publishDiagnostics={
|
||||
dataSupport=true,
|
||||
--layeredDiagnostics=true
|
||||
}
|
||||
|
||||
lspconfig.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
handlers = cider_lsp_handlers,
|
||||
})
|
||||
if use_google() then
|
||||
capabilities = require('cmp_nvim_ciderlsp').update_capabilities(capabilities)
|
||||
lspconfig.ciderlsp.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
handlers = cider_lsp_handlers,
|
||||
})
|
||||
end
|
||||
|
||||
local runtime_path = vim.split(package.path, ";")
|
||||
table.insert(runtime_path, "lua/?.lua")
|
||||
|
@ -1,5 +1,6 @@
|
||||
local fn = vim.fn
|
||||
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
|
||||
local use_google = require("utils").use_google
|
||||
if fn.empty(fn.glob(install_path)) > 0 then
|
||||
packer_bootstrap = fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
|
||||
vim.o.runtimepath = vim.fn.stdpath('data') .. '/site/pack/*/start/*,' .. vim.o.runtimepath
|
||||
@ -13,7 +14,6 @@ augroup end
|
||||
]])
|
||||
|
||||
|
||||
local file_exists = require("utils").file_exists
|
||||
|
||||
require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
@ -90,20 +90,22 @@ require('packer').startup(function(use)
|
||||
|
||||
use {
|
||||
'sso://googler@user/vintharas/telescope-codesearch.nvim',
|
||||
cond = file_exists(os.getenv("HOME").."/use_google"),
|
||||
cond = use_google(),
|
||||
}
|
||||
|
||||
use {
|
||||
'sso://googler@user/chmnchiang/google-comments',
|
||||
-- '/google/src/head/depot/google3/experimental/users/chmnchiang/neovim/google-comments',
|
||||
-- '/google/src/cloud/cnieves/google-comments/google3/experimental/users/chmnchiang/neovim/google-comments',
|
||||
cond = file_exists(os.getenv("HOME").."/use_google"),
|
||||
cond = use_google(),
|
||||
requires = {'rcarriga/nvim-notify', 'nvim-lua/plenary.nvim'},
|
||||
config = [[ require("google_comments") ]]
|
||||
}
|
||||
|
||||
use {
|
||||
'/google/src/cloud/cnieves/google-comments/google3/experimental/users/cnieves/neovim/critique',
|
||||
-- cond = file_exists(os.getenv("HOME").."/use_google"),
|
||||
disable = not use_google(),
|
||||
config = [[ require("critique").setup() ]]
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,10 @@ function M.map(mode, lhs, rhs, opts)
|
||||
vim.api.nvim_set_keymap(mode, lhs, rhs, options)
|
||||
end
|
||||
|
||||
function M.use_google()
|
||||
return M.file_exists(os.getenv("HOME").."/use_google")
|
||||
end
|
||||
|
||||
function M.file_exists(name)
|
||||
local f=io.open(name,"r")
|
||||
if f~=nil then io.close(f) return true else return false end
|
||||
|
Reference in New Issue
Block a user