Skip to content

Add instructions #2

Closed
Closed

Description

@bedware

Can you provide how to install and how to use your extension?

Activity

  1. JavaHello commented on Oct 17, 2023

    @JavaHello
    Owner

    The current plugin is not yet complete, only ensuring that it opens without errors.

    I've added the instructions to the Readme.

    • lazy.nvim
    {
        "JavaHello/java-deps.nvim",
        lazy = true,
        ft = "java",
        dependencies = "mfussenegger/nvim-jdtls",
        config = function()
          require("java-deps").setup({})
        end,
      }
    
    -- jdtls lsp attach
    require("java-deps").attach(client, buffer, root_dir)
  2. bedware commented on Oct 17, 2023

    @bedware
    Author

    Yes, I see - plugin is not so useful at the moment (mostly because of some inconsistencies in tree structure). But it's a great beginning! I can assume you know that most of Java developers like and use that feature in other IDE. So keep on going!

    This is valid config for packer:

        use('mfussenegger/nvim-jdtls')
        use({
            'JavaHello/java-deps.nvim',
            requires = {
                {'mfussenegger/nvim-jdtls'},
                {'simrat39/symbols-outline.nvim'}
            },
            config = function() require('java-deps').setup({}) end
        })
        use({
            'simrat39/symbols-outline.nvim',
            config = function() require('symbols-outline').setup() end
        })
    

    Some modifications I made to my jdtls config to start it working.

    I use Mason, but it doesn't have needed bundles, so you have to manually clone a repo and build it.
    After that you can add it bundles like this:

    local home = vim.fn.getenv("HOME")
    
    local java_dependency_bundle = vim.split(
            vim.fn.glob(home .. '/.local/share/nvim/mason/packages/vscode-java-dependency/jdtls.ext/com.microsoft.jdtls.ext.core/target/com.microso
    ft.jdtls.ext.core-*.jar'),
            '\n'
    )
    
    if java_dependency_bundle[1] ~= '' then
           vim.list_extend(path.bundles, java_dependency_bundle)
    end
    

    Lastly you need to add plugin logic on every attach:

    local function jdtls_on_attach(client, bufnr)
        local root_dir = require('jdtls').setup.find_root(root_files)
        require("java-deps").attach(client, bufnr, root_dir)
    

    To use plugin I found several commands:

    :lua require('java-deps').toggle_outline()
    :lua require('java-deps').open_outline()
    :lua require('java-deps').close_outline()
    

    If there is nothing wrong here, please add this to the plugin description. I just want more people use your plugin. After that I will close this thread.

  3. JavaHello commented on Oct 18, 2023

    @JavaHello
    Owner

    Thank you for the steps you provided, it is correct, I added it to the Readme
    #4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions