telescope and dap

This commit is contained in:
Christian Nieves
2023-11-01 18:36:50 +00:00
parent 96273ea4f0
commit d0f618d46f
5 changed files with 104 additions and 35 deletions

View File

@ -57,6 +57,7 @@
"nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" }, "nui.nvim": { "branch": "main", "commit": "c0c8e347ceac53030f5c1ece1c5a5b6a17a25b32" },
"nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" }, "nvim-cmp": { "branch": "main", "commit": "51260c02a8ffded8e16162dcf41a23ec90cfba62" },
"nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" }, "nvim-cmp-buffer-lines": { "branch": "master", "commit": "924ccc04dc5c919b6baa05d45818025baa82699a" },
"nvim-dap": { "branch": "master", "commit": "79dbc70eb79271ad801e4ff293887cde324c28d0" },
"nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" }, "nvim-lightbulb": { "branch": "master", "commit": "8f00b89dd1b1dbde16872bee5fbcee2e58c9b8e9" },
"nvim-lint": { "branch": "master", "commit": "962a76877a4479a535b935bd7ef35ad41ba308b2" }, "nvim-lint": { "branch": "master", "commit": "962a76877a4479a535b935bd7ef35ad41ba308b2" },
"nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" }, "nvim-lspconfig": { "branch": "master", "commit": "d0467b9574b48429debf83f8248d8cee79562586" },
@ -70,7 +71,10 @@
"registers.nvim": { "branch": "main", "commit": "7a16c6e6fe96f3c9c8bb55b95047d745dd34ca4d" }, "registers.nvim": { "branch": "main", "commit": "7a16c6e6fe96f3c9c8bb55b95047d745dd34ca4d" },
"rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" }, "rust-tools.nvim": { "branch": "master", "commit": "0cc8adab23117783a0292a0c8a2fbed1005dc645" },
"scss-syntax.vim": { "branch": "master", "commit": "bda22a93d1dcfcb8ee13be1988560d9bb5bd0fef" }, "scss-syntax.vim": { "branch": "master", "commit": "bda22a93d1dcfcb8ee13be1988560d9bb5bd0fef" },
"sqlite.lua": { "branch": "master", "commit": "b7e28c8463254c46a8e61c52d27d6a2040492fc3" },
"tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" }, "tabular": { "branch": "master", "commit": "339091ac4dd1f17e225fe7d57b48aff55f99b23a" },
"telescope-dap.nvim": { "branch": "master", "commit": "4e2d5efb92062f0b865fe59b200b5ed7793833bf" },
"telescope-smart-history.nvim": { "branch": "master", "commit": "81a4cceaa54d65d5f7c7c26178ee63b634d3e26d" },
"telescope.nvim": { "branch": "master", "commit": "4522d7e3ea75ffddabdc39957168a8a7060b5df0" }, "telescope.nvim": { "branch": "master", "commit": "4522d7e3ea75ffddabdc39957168a8a7060b5df0" },
"telescope_citc": { "branch": "main", "commit": "d6421d5bfe058915ece0daec55e488f8ea05f207" }, "telescope_citc": { "branch": "main", "commit": "d6421d5bfe058915ece0daec55e488f8ea05f207" },
"telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" }, "telescope_codesearch": { "branch": "main", "commit": "a26077ad3c68cf897ae1c31da903d6516ebb9c92" },

View File

@ -46,8 +46,7 @@ nnoremap <Leader>br :call BlazeRun()<cr>
nnoremap <Leader>bb :call BlazeBuild()<cr> nnoremap <Leader>bb :call BlazeBuild()<cr>
nnoremap <Leader>bt :call BlazeTest()<cr> nnoremap <Leader>bt :call BlazeTest()<cr>
nnoremap <Leader>btd :call BlazeTestDebug()<cr> nnoremap <Leader>btd :call BlazeTestDebug()<cr>
nnoremap <Leader>bc :call BuildCleanerTarget()<cr> nnoremap <Leader>bc :call BuildCleanerFile()<cr>
nnoremap <Leader>bcf :call BuildCleanerFile()<cr>
nnoremap <Leader>ud :call UnusedDeps()<cr> nnoremap <Leader>ud :call UnusedDeps()<cr>
let g:asyncrun_open = 1 let g:asyncrun_open = 1

View File

@ -0,0 +1,38 @@
return {
"mfussenegger/nvim-dap",
dependencies = {
"nvim-telescope/telescope-dap.nvim",
},
config = function()
-- <leader>dl :lua require'dapui'.open()<CR>
-- <F5> :lua require'dap'.continue()<CR>
-- <leader>dl :lua require'dap'.run_last()<CR>
-- <leader>db :lua require'dap'.toggle_breakpoint()<CR>
-- <leader>dB :lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))<CR>
-- <leader>dlp :lua require'dap'.set_breakpoint(nil, nil, vim.fn.input('Log point message: '))<CR>
-- <leader>dr :lua require'dap'.repl.open()<CR>
--
require("telescope").load_extension("dap")
local dap = require("dap")
dap.adapters.java = function(callback)
-- FIXME:
-- Here a function needs to trigger the `vscode.java.startDebugSession` LSP command
-- The response to the command must be the `port` used below
callback({
type = "server",
host = "127.0.0.1",
port = port,
})
end
dap.configurations.java = {
{
type = "java",
request = "attach",
name = "Debug (Attach) - Remote",
hostName = "127.0.0.1",
port = 5005,
},
}
end,
}

View File

@ -97,12 +97,14 @@ return {
\ Suggest[aidl]=buffer,ripgrep,csearch,prompt \ Suggest[aidl]=buffer,ripgrep,csearch,prompt
]]) ]])
end, end,
keys = { lazy = false,
{ "<leader>i", ":ImpSuggest <C-r><C-w><cr>" },
},
}, },
{ {
"flwyd/vim-imp", "flwyd/vim-imp",
lazy = false,
keys = {
{ "<leader>i", ":ImpSuggest <C-r><C-w><cr>" },
},
}, },
{ {
name = "ai.nvim", name = "ai.nvim",

View File

@ -37,6 +37,7 @@ local keys = {
{ "<leader>ff", ":Telescope current_buffer_fuzzy_find<CR>", desc = "[T]elescope [F]uzzy [F]ind" }, { "<leader>ff", ":Telescope current_buffer_fuzzy_find<CR>", desc = "[T]elescope [F]uzzy [F]ind" },
{ "<leader>tg", ":Telescope git_files<CR>", desc = "[T]elescope [G]it Files" }, { "<leader>tg", ":Telescope git_files<CR>", desc = "[T]elescope [G]it Files" },
{ "<leader>tr", ":Telescope resume<CR>", desc = "[T]elescope [R]esume" },
{ "<leader>t*", "<cmd>lua require('telescope.builtin').grep_string{}<CR>", desc = "[T]elescope current [W]ord" }, { "<leader>t*", "<cmd>lua require('telescope.builtin').grep_string{}<CR>", desc = "[T]elescope current [W]ord" },
{ "<leader>th", "<cmd>lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" }, { "<leader>th", "<cmd>lua require('telescope.builtin').help_tags{}<CR>", desc = "[T]elescope [H]elp" },
} }
@ -56,41 +57,66 @@ end
return { return {
"nvim-telescope/telescope.nvim", "nvim-telescope/telescope.nvim",
dependencies = {}, dependencies = {
-- "nvim-telescope/telescope-smart-history.nvim",
-- "kkharji/sqlite.lua",
},
config = function() config = function()
require("telescope").setup({ require("telescope").setup({
experimental = true, defaults = {
-- The vertical layout strategy is good to handle long paths like those in -- The vertical layout strategy is good to handle long paths like those in
-- google3 repos because you have nearly the full screen to display a file path. -- google3 repos because you have nearly the full screen to display a file path.
-- The caveat is that the preview area is smaller. -- The caveat is that the preview area is smaller.
layout_strategy = "vertical", layout_strategy = "vertical",
-- Common paths in google3 repos are collapsed following the example of Cider -- Common paths in google3 repos are collapsed following the example of Cider
-- It is nice to keep this as a user config rather than part of -- It is nice to keep this as a user config rather than part of
-- telescope-codesearch because it can be reused by other telescope pickers. -- telescope-codesearch because it can be reused by other telescope pickers.
path_display = function(opts, path) path_display = function(opts, path)
-- Do common substitutions -- Do common substitutions
path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1) path = path:gsub("^/google/src/cloud/[^/]+/[^/]+/google3/", "google3/", 1)
path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1) path = path:gsub("^google3/java/com/google/", "//j/c/g/", 1)
path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1) path = path:gsub("^google3/javatests/com/google/", "//jt/c/g/", 1)
path = path:gsub("^google3/third_party/", "//3p/", 1) path = path:gsub("^google3/third_party/", "//3p/", 1)
path = path:gsub("^google3/", "//", 1) path = path:gsub("^google3/", "//", 1)
-- Do truncation. This allows us to combine our custom display formatter -- Do truncation. This allows us to combine our custom display formatter
-- with the built-in truncation. -- with the built-in truncation.
-- `truncate` handler in transform_path memoizes computed truncation length in opts.__length. -- `truncate` handler in transform_path memoizes computed truncation length in opts.__length.
-- Here we are manually propagating this value between new_opts and opts. -- Here we are manually propagating this value between new_opts and opts.
-- We can make this cleaner and more complicated using metatables :) -- We can make this cleaner and more complicated using metatables :)
local new_opts = { local new_opts = {
path_display = { path_display = {
truncate = true, truncate = true,
},
__length = opts.__length,
}
path = require("telescope.utils").transform_path(new_opts, path)
opts.__length = new_opts.__length
return path
end,
mappings = {
i = {
["<S-Down>"] = function()
require("telescope.actions").cycle_history_next()
end,
["<S-Up>"] = function()
require("telescope.actions").cycle_history_prev()
end,
}, },
__length = opts.__length, },
} -- history = {
path = require("telescope.utils").transform_path(new_opts, path) -- path = "~/.local/share/nvim/databases/telescope_history.sqlite3",
opts.__length = new_opts.__length -- limit = 200,
return path -- },
end, },
extensions = {
codesearch = {
experimental = true, -- enable results from google3/experimental
},
},
}) })
-- require("telescope").load_extension("smart_history")
end, end,
keys = keys, keys = keys,
} }