Skip to content

A java dependency exloperor using neovim build-in lsp

Notifications You must be signed in to change notification settings

NiYanhhhhh/lighttree-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lighttree-java

Note: This plugin won't update anymore, A new one using is coming on the way. But this plugin is still working with the newest jdtls and ms bundle. I fix it again.


A java dependency exloperor using neovim build-in lsp and vscode-java-dependency bundle.

Installation

Requires:

Configuration:

  • get vscode-java-dependency jdtls extension bundle

    1. Download the vscode extension Project Manager for Java
    2. Extract file com.microsoft.jdtls.ext.core-0.18.7.jar in archive_root:/extension/server/ from the vsix pack to wherever you like

    You can also build it manually from the git repository:

      git clone https://github.com/microsoft/vscode-java-dependency
      cd vscode-java-dependency/jdtls.ext
      ./mvnw clean package
    

    As it returns BUILD SUCCESS, the jar pack will be at vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microsoft.jdtls.ext.core-${version}.jar

  • extend the initializationOptions with which you start eclipse.jdt.ls as follows:

    --- example when using nvim-jdtls
    local config = {}
    local bundles = vim.fn.glob("/path/to/jar/com.microsoft.jdtls.ext.core-*.jar")
    config['init_options']
    ---
    --- your settings
    ---
    require('jdtls').start_or_attach(config)

Feature

feature HierarchcalView: feature2

  • configuration

    "-- variables and its default value:
    " lighttree window position (available: 'topleft', 'botright')
    let g:lighttree_win_pos = 'topleft'
    " lighttree window size ([width, height])
    let g:lighttree_win_size = [30, 25]
    " this setting makes the window appear below the opening nerdtree window, set to empty dict to disable it
    let g:lighttree_win_args = {'follow': 'nerdtree'}
    " indicator show before the directory node (when opening)
    " nerdtree usually using '▾'
    let g:lighttree_sign_open = '-'
    " indicator show before the directory node (when closing)
    " nerdtree usually using '▸'
    let g:lighttree_sign_close = '+'
    
    " decide the appearance of java package in explorer (reference to eclipse project explorer)
    let g:lighttree_java_ishierarchical = v:true
    " this plugin uses sync request, this option decides the timeout the client waits
    let g:lighttree_java_request_timeout = 500
    " you java language server name (which is 'jdt.ls in nvim-jdtls')
    let g:lighttree_java_server_name = 'jdt.ls'
    
    "-- default maps
    " lighttree buffer:
    "close node
    nnoremap <buffer> q <cmd>call lighttree#view#close_win()<cr>
    "toggle node
    nnoremap <buffer> <cr> <cmd>call b:lighttree_ui.toggle(line('.'))<cr>
    nnoremap <buffer> o <cmd>call b:lighttree_ui.toggle(line('.'))<cr>
    "open leaf node using vsplit
    nnoremap <buffer> s <cmd>call b:lighttree_ui.open(line('.'), {'flag': 'v'})<cr>
    "open leaf node using split
    nnoremap <buffer> i <cmd>call b:lighttree_ui.open(line('.'), {'flag': 'h'})<cr>
    "open leaf node in new tab
    nnoremap <buffer> t <cmd>call b:lighttree_ui.open(line('.'), {'flag': 't'})<cr>
    "[WIP] refresh node
    nnoremap <buffer> r <cmd>call b:lighttree_ui.refresh_node0(line('.'))<cr>
    
    "" navigation actions
    "focus on parent node
    nnoremap <buffer> p <cmd>call b:lighttree_ui.focus_node_parent(line('.'))<cr>
    "focus on root node
    nnoremap <buffer> P <cmd>call b:lighttree_ui.focus_node_root(line('.'))<cr>
    "focus on last node in its brother nodes
    nnoremap <buffer> J <cmd>call b:lighttree_ui.focus_node_last(line('.'))<cr>
    "focus on first node in its brother nodes
    nnoremap <buffer> K <cmd>call b:lighttree_ui.focus_node_first(line('.'))<cr>
    "focus on about middle position in its brother nodes
    nnoremap <buffer> <c-n> <cmd>call b:lighttree_ui.focus_node_middle(line('.'))<cr>
    "focus on next node in its brother nodes
    nnoremap <buffer> <c-j> <cmd>call b:lighttree_ui.focus_node_next(line('.'))<cr>
    "focus on previous node in its brother nodes
    nnoremap <buffer> <c-k> <cmd>call b:lighttree_ui.focus_node_prev(line('.'))<cr>
    
    
    " map a function to start (not do in the plugin):
    " nnoremap <silent> <leader><f3> <cmd>call lighttree#plugin#jdt#toggle_win()<cr>

Story

At first I try to hack nerdtree to achieve my goal. However it takes too many time and works not good. Maybe it's a bit hard for me. So I just write a extensible and easy-to-use treeview ui api and it even takes me less time and seems to works good. This api, lighttree, is in the autoload directory, where you can see the source.

Nerdtree is a wonderful plugin. I use it for a long time.

Beacause I'm struggling for my university education, so there is no time to write the document for me and even this plugin will be update slowly.

Millions of thanks to contributors!

License

MIT License.

About

A java dependency exloperor using neovim build-in lsp

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages