@@ -186,24 +186,27 @@ local is_google3 = function(fname)
186186 end
187187end
188188
189+ local ciderlsp = ' ciderlsp'
190+
189191-- TODO: Shove google-specific config elsewhere.
190192vim .lsp .config (' ciderlsp' , {
191193 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' },
193194 -- root_markers = { '.citc' },
194195 root_dir = function (bufnr , on_dir )
195196 local citc_dir = is_google3 (vim .api .nvim_buf_get_name (bufnr ))
196197 if citc_dir then
197198 on_dir (citc_dir )
198199 end
199200 end ,
201+ name = ciderlsp ,
200202})
203+
201204vim .lsp .enable ' ciderlsp'
202205
203206-- clangd is set up differently than all of the other LSPs due to
204207-- https://github.com/mason-org/mason.nvim/issues/1578?
205208vim .lsp .config (' clangd' , {
206- cmd = { ' clangd' , ' --background-index' , ' --limit-references=1000 ' , ' --limit-results=1000 ' },
209+ cmd = { ' clangd' , ' --background-index' },
207210 root_markers = { ' .clangd' , ' compile_commands.json' },
208211 root_dir = function (bufnr , on_dir )
209212 local fname = vim .api .nvim_buf_get_name (bufnr )
@@ -662,24 +665,12 @@ require('lazy').setup({
662665 ' saghen/blink.cmp' ,
663666 },
664667 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
675668 vim .api .nvim_create_autocmd (' LspAttach' , {
676669 group = vim .api .nvim_create_augroup (' kickstart-lsp-attach' , { clear = true }),
677670 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.
680671 local map = function (keys , func , desc , mode )
681672 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 })
683674 end
684675
685676 map (' <localleader>R' , vim .lsp .buf .rename , ' [R]e[n]ame' )
@@ -752,6 +743,14 @@ require('lazy').setup({
752743 vim .lsp .inlay_hint .enable (not vim .lsp .inlay_hint .is_enabled { bufnr = event .buf })
753744 end , ' [T]oggle Inlay [H]ints' )
754745 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
755754 end ,
756755 })
757756
@@ -1045,6 +1044,23 @@ require('lazy').setup({
10451044 -- - Show your current context: https://github.com/nvim-treesitter/nvim-treesitter-context
10461045 -- - Treesitter + textobjects: https://github.com/nvim-treesitter/nvim-treesitter-textobjects
10471046 },
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+ },
10481064
10491065 -- The following comments only work if you have downloaded the kickstart repo, not just copy pasted the
10501066 -- init.lua. If you want these files, they are in the repository, so you can just download them and
0 commit comments