explore workspace dir pusing oil.nvim to configure libraries manually

This commit is contained in:
Baipyrus 2024-11-05 11:42:23 +01:00
parent ad214db84e
commit c3569c1b51

View File

@ -29,6 +29,9 @@ return {
-- Allows extra capabilities provided by nvim-cmp
'hrsh7th/cmp-nvim-lsp',
-- Needed to explore Workspace in Java
'stevearc/oil.nvim',
},
config = function()
-- Brief aside: **What is LSP?**
@ -273,11 +276,15 @@ return {
end
vim.api.nvim_create_autocmd('FileType', {
pattern = 'java',
callback = function()
callback = function(opt)
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':p:h:t')
-- calculate workspace dir
local workspace_dir = vim.fn.stdpath 'data' .. '/site/java/workspace-root/' .. project_name
require('jdtls').start_or_attach(generate_config(workspace_dir))
vim.keymap.set('n', '<leader>we', '<cmd>Oil ' .. workspace_dir .. '<cr>', {
desc = '[W]orkspace [E]xplorer',
buffer = opt.buf,
})
end,
})
end