@@ -186,24 +186,27 @@ local is_google3 = function(fname)
186
186
end
187
187
end
188
188
189
+ local ciderlsp = ' ciderlsp'
190
+
189
191
-- TODO: Shove google-specific config elsewhere.
190
192
vim .lsp .config (' ciderlsp' , {
191
193
cmd = { ' /google/bin/releases/cider/ciderlsp/ciderlsp' , ' --tooltag=nvim-lsp' , ' --noforward_sync_responses' },
192
- filetypes = { ' c' , ' cpp' , ' cc' , ' java' , ' kotlin' , ' objc' , ' proto' , ' textpb' , ' go' , ' python' , ' bzl' , ' typescript' },
193
194
-- root_markers = { '.citc' },
194
195
root_dir = function (bufnr , on_dir )
195
196
local citc_dir = is_google3 (vim .api .nvim_buf_get_name (bufnr ))
196
197
if citc_dir then
197
198
on_dir (citc_dir )
198
199
end
199
200
end ,
201
+ name = ciderlsp ,
200
202
})
203
+
201
204
vim .lsp .enable ' ciderlsp'
202
205
203
206
-- clangd is set up differently than all of the other LSPs due to
204
207
-- https://github.com/mason-org/mason.nvim/issues/1578?
205
208
vim .lsp .config (' clangd' , {
206
- cmd = { ' clangd' , ' --background-index' , ' --limit-references=1000 ' , ' --limit-results=1000 ' },
209
+ cmd = { ' clangd' , ' --background-index' },
207
210
root_markers = { ' .clangd' , ' compile_commands.json' },
208
211
root_dir = function (bufnr , on_dir )
209
212
local fname = vim .api .nvim_buf_get_name (bufnr )
@@ -662,24 +665,12 @@ require('lazy').setup({
662
665
' saghen/blink.cmp' ,
663
666
},
664
667
config = function ()
665
- -- Thus, Language Servers are external tools that must be installed separately from
666
- -- Neovim. This is where `mason` and related plugins come into play.
667
- --
668
- -- If you're wondering about lsp vs treesitter, you can check out the wonderfully
669
- -- and elegantly composed help section, `:help lsp-vs-treesitter`
670
-
671
- -- This function gets run when an LSP attaches to a particular buffer.
672
- -- That is to say, every time a new file is opened that is associated with
673
- -- an lsp (for example, opening `main.rs` is associated with `rust_analyzer`) this
674
- -- function will be executed to configure the current buffer
675
668
vim .api .nvim_create_autocmd (' LspAttach' , {
676
669
group = vim .api .nvim_create_augroup (' kickstart-lsp-attach' , { clear = true }),
677
670
callback = function (event )
678
- -- In this case, we create a function that lets us more easily define mappings specific
679
- -- for LSP related items. It sets the mode, buffer and description for us each time.
680
671
local map = function (keys , func , desc , mode )
681
672
mode = mode or ' n'
682
- vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = ' LSP: ' .. desc })
673
+ vim .keymap .set (mode , keys , func , { buffer = event .buf , desc = desc })
683
674
end
684
675
685
676
map (' <localleader>R' , vim .lsp .buf .rename , ' [R]e[n]ame' )
@@ -752,6 +743,14 @@ require('lazy').setup({
752
743
vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
753
744
end , ' [T]oggle Inlay [H]ints' )
754
745
end
746
+
747
+ -- TODO: Google-specific!
748
+ if client .name == ciderlsp then
749
+ print ' Trying to override to CS'
750
+ vim .keymap .set (' n' , ' <leader>*' , function ()
751
+ vim .cmd ' Telescope codesearch find_query'
752
+ end , { buffer = event .buf , desc = ' code search' })
753
+ end
755
754
end ,
756
755
})
757
756
@@ -1045,6 +1044,23 @@ require('lazy').setup({
1045
1044
-- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
1046
1045
-- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
1047
1046
},
1047
+ {
1048
+ -- TODO: Google-specific
1049
+ -- https://g3doc.corp.google.com/experimental/users/vintharas/telescope-codesearch.nvim/README.md
1050
+ ' vintharas/telescope-codesearch.nvim' ,
1051
+ dependencies = { ' nvim-telescope/telescope.nvim' },
1052
+ url = ' sso://user/vintharas/telescope-codesearch.nvim' ,
1053
+ keys = {
1054
+ {
1055
+ ' <leader>sc' ,
1056
+ ' <cmd>Telescope codesearch find_query<cr>' ,
1057
+ desc = ' [S]earch [C]oogle via CodeSearch' ,
1058
+ },
1059
+ },
1060
+ config = function ()
1061
+ require (' telescope' ).load_extension ' codesearch'
1062
+ end ,
1063
+ },
1048
1064
1049
1065
-- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
1050
1066
-- init.lua. If you want these files, they are in the repository, so you can just download them and
0 commit comments