Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ghostbuster91/nvim-metals-tvp-neotree
https://github.com/ghostbuster91/nvim-metals-tvp-neotree
Last synced: 12 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/ghostbuster91/nvim-metals-tvp-neotree
- Owner: ghostbuster91
- License: mit
- Created: 2024-01-14T09:56:36.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-01-28T19:50:27.000Z (9 months ago)
- Last Synced: 2024-10-05T03:01:09.191Z (about 1 month ago)
- Language: Lua
- Size: 54.7 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Metals TreeViewProtocol Neotree Integration
Additional [neo-tree](https://github.com/nvim-neo-tree/neo-tree.nvim) source that allows you to explore data from the [tree-view protocol](https://scalameta.org/metals/docs/integrations/tree-view-protocol/).
## Motivation
Most of the time filesystem tree is enough for me. But there are cases where I want to explore 3rd party library by walking through its packages.
This is not possible using filesystem tree because of how metals handles such files internally.But nvim-metals already supports treeViewProtocol!
That is correct, however I really care about consistent feel & behavior in my neovim hence I want all tree-like sources to be managed by neotree.
## Current state
treeViewProtocol is still experimental, so everything might break without prior notice.
Supported features:
- navigation around the tree and fetching of not-yet loaded nodes
- reveal in tree
- follow_cursorOther neotree benefits:
- extensive ability to customize rendering
Known issues:
- Modules have to be compiled first otherwise you will get no results.
Toggling a non-compiled module triggers the compilation, but results are not reported.
Once the module was compiled, toggling it once again should work.
This does not work on metals 1.2.0. See [#6023](https://github.com/scalameta/metals/issues/6029) for details.[Demo.webm](https://github.com/ghostbuster91/nvim-metals-tvp-neotree/releases/download/v0.1.0/Kooha-2024-01-27-20-37-52.webm)
## Getting started
neotree configuration:
```lua
require("neo-tree").setup({
sources = { "filesystem", "git_status", "buffers", "metals_tvp" },
source_selector = {
sources = {
{ source = "filesystem" },
{ source = "buffers" },
{ source = "git_status" },
{ source = "metals_tvp" },
},
metals_tvp = {
follow_cursor = true,
renderers = {
root = {
{ "indent" },
{ "icon", default = "C" },
{ "name", zindex = 10 },
},
symbol = {
{ "indent", with_expanders = true },
{ "kind_icon", default = "?" },
{
"container",
content = {
{ "name", zindex = 10 },
{ "kind_name", zindex = 20, align = "right" },
}
}
},
},
window = {
mappings = {
[""] = "toggle_node",
[""] = "execute_node_command",
},
}
},
})
```metals configuration:
```lua
metals_config.handlers = {
["metals/treeViewDidChange"] = function(_, result)
require("metals_tvp.api").tree_view_did_change(result)
end
}
```## Developer notes
What to test:
- open source before it is loaded
- open source once loaded -> libraries -> expand/collapse nodes
- jumping between metals-tvp and another buffer (make sure that we don't request any new data)
- follow_cursor both library and project
- make sure that non-compiled modules can be loaded eventually
- open a file from library and call reveal without having the tvp opened before