Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/javahello/java-deps.nvim
Preview jar package dependencies
https://github.com/javahello/java-deps.nvim
java neovim neovim-plugin nvim nvim-java-dependency
Last synced: about 13 hours ago
JSON representation
Preview jar package dependencies
- Host: GitHub
- URL: https://github.com/javahello/java-deps.nvim
- Owner: JavaHello
- License: mit
- Created: 2023-01-05T14:30:46.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-22T02:10:07.000Z (3 months ago)
- Last Synced: 2024-08-22T12:57:02.173Z (3 months ago)
- Topics: java, neovim, neovim-plugin, nvim, nvim-java-dependency
- Language: Lua
- Homepage:
- Size: 62.5 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java Projects
## 安装
[English](https://github.com/JavaHello/java-deps.nvim/issues/2)
- lazy.nvim
```lua
{
"JavaHello/java-deps.nvim",
lazy = true,
ft = "java",
dependencies = "mfussenegger/nvim-jdtls",
config = function()
require("java-deps").setup({})
end,
}```
- 手动编译 `vscode-java-dependency` (可选)
```sh
git clone https://github.com/microsoft/vscode-java-dependency.git
cd vscode-java-dependency
npm install
npm run build-server
```- 将 `vscode-java-dependency` 的 `jar` 包添加到 jdtls_config["init_options"].bundles 中
```lua
local jdtls_config = {}
local bundles = {}
-- ...
local java_dependency_bundle = vim.split(
vim.fn.glob(
"/path?/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-*.jar"
),
"\n"
)if java_dependency_bundle[1] ~= "" then
vim.list_extend(bundles, java_dependency_bundle)
endjdtls_config["init_options"] = {
bundles = bundles,
extendedClientCapabilities = extendedClientCapabilities,
}
```- 添加命令
```lua
jdtls_config["on_attach"] = function(client, buffer)
-- 添加命令
local create_command = vim.api.nvim_buf_create_user_command
create_command(buffer, "JavaProjects", require("java-deps").toggle_outline, {
nargs = 0,
})
end
```- Usage
```vim
:lua require('java-deps').toggle_outline()
:lua require('java-deps').open_outline()
:lua require('java-deps').close_outline()
```## 参考实现
- 使用 [symbols-outline](https://github.com/simrat39/symbols-outline.nvim) 代码实现预览
- [vscode-java-dependency](https://github.com/Microsoft/vscode-java-dependency) 提供数据支持