Giter Club home page Giter Club logo

eagle.nvim's Introduction

eagle.nvim

To soar like an eagle is to rise above all the obstacles that come your way.

Following your mouse cursor, this plugin introduces a custom floating (popup) window that displays any Diagnostic (Error, Warning, Hint) with the help of the Diagnostic API of Neovim, along with LSP Information, from the LSP API.

Overview

Enhance your Neovim experience by utilizing the following features:

  • Detect when the mouse hovers over an underlined part of code. Once it goes idle (for a configurable amount of time), the window will be invoked. I tried to mirror the way conventional GUI Editors like VS Code work.
  • Display the Diagnostics under the current mouse position. If there are multiple diagnostics on the same position (ie Error and Warning), display them all in a numbered list. For better user experience, the window is re-rendered only once the mouse encounters a "special" character (like "{}.?:" and more). This means that it stays open if it detects mouse movement and you are still hovering over the same variable/function/operator name.
  • Show LSP information (the same contents as with vim.lsp.buf.hover()).

showcase_eagle This was a C++ workspace, with clangd and clang-tidy configured. You can also shift+click the href links to open them in your browser.

Installation

Using Lazy:

{
    "soulis-1256/eagle.nvim"
},

Important

Until I test it and add it here, don't try setting additional Lazy properties (like main, config, opts) as an alternative way to setup the plugin.

Setup

require("eagle").setup({
-- override the default values found in config.lua
})

-- make sure mousemoveevent is enabled
vim.o.mousemoveevent = true

You can find the description of all the options in config.lua.

image

Note

The plugin has been tested on Neovim versions 0.9.4 and 0.9.5.

Support

You can support me by donating through PayPal and by providing your feedback. You can message me on Discord.

eagle.nvim's People

Contributors

delphinus avatar eucaue avatar soulis-1256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

eagle.nvim's Issues

Does this work with non-focused window?

My initial testing shows that the popup only shows up with the focused window, when there are many splits on screen.
I does not find any info about this explicitly, so does this currently support mousing hovering on non-focused window?

Thanks for the plugin.

Bug: invalid window-id when using zen-mode and/or maximize-window on close-event

When moving the mouse over an lsp-message in a maximized or zen-mode window/pane I get the desired floating-window with it's corresponding message.

Bug:
When moving the mouse away, the window doesn't disappear, instead I get an error:

zen-mode-error:

E5108: Error executing lua: .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: Invalid window id: 1000                                   
stack traceback:                                                                                                                                       
        [C]: in function 'nvim_set_current_win'                                                                                                        
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: in function 'check_mouse_win_collision'                                       
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:246: in function <.../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:237> 

maximize-window-error:

E5108: Error executing lua: .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: Invalid window id: 1000                          
stack traceback:                                                                                                                                       
        [C]: in function 'nvim_set_current_win'                                                                                                        
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:279: in function 'check_mouse_win_collision'                                       
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:126: in function 'close_float_window'                                              
        .../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:254: in function <.../share/nvim/lazy/hoverhints.nvim/lua/hoverhints/init.lua:237>

error-screenie

While it seems the error is possibly caused by other plugins (I don't know who's responsibility it should be?) ...
I'd love to see you safeguard for this error in this plugin.

This plugin gets a big like from me, and I can see it being useful quite a lot...

Anyway:
I frequently use maximized windows because I focus on a pane while having splits in my layout.
If the error isn't fixed, I guess I'll have to disable/uninstall it and look for another solution to display my lsp-errors,
which would be a pity, especially since this plugin brings value on top of my necessity.
I can't have my workflow disrupted this way, having to manually/:q close my overlay every time I hover an lsp-error in a currently maximized window.

Solution:
Can you safeguard the error and make the window disappear anyway?
Maybe you can keep the window-id of the window in which the last overlay was triggered in some global var???
And remove the window when the caught error occurs - instead of having nvim through an error?

Intersection with noice.nvim

Very cool plugin, i love it! Only i am doing something wrong in my config apparently and i was not able to fix it. Here is a screenshot:

image

This shows:

  • The hover window above is what eagle shows me (screenshot does not include mouse pointer, but it is where the cursor is).
  • The hover window below is what vim.lsp.buf.hover() gives me with treesitter and noice installed (if that matters).

In your video in the README.md of this repo, i can see that eagle supports rendered output. So i think there must be something wrong with my setup, but i struggle to find out what it is.

Eagle's config snippet is this:

  {
    "soulis-1256/eagle.nvim", -- Following the mouse cursor hover, a custom floating window displays diagnostics (E/W/H) along with LSP info
    enabled = true,
    config = function()
      require("eagle").setup({
        render_delay = 250,
        title_color = "",  -- didn't like the default, so NO color here
        border_color = "", -- didn't like the default, so NO color here
        border = "rounded",
        window_row = 0,
        window_col = 5,
      })
    end
  },

I played with the config, the lsp server config, noice plugin config etc. but i was never able to get eagle's hover window to display the same colored/formatted output as vim.lsp.buf.hover() does.

Keyboard based workflow?

Is it possible to trigger this just using the keyboard, I avoid using the mouse for anything in vim, but I don't see anything in the docs about keyboard usage.

Also, I wanted to mention I just posted an enhancement request to lsp-saga which I think you might find interesting. Basically my request there is what you seem to be planning, which is "diagnostics & LSP" in the hover a la VS Code.

nvimdev/lspsaga.nvim#1349

Also really nice work here! I'm watching this closely as this is a feature I've missed from nvim for a long time, although I do think that integrating this with a wider set of LSP tools as part of something like lsp-saga offers a lot of scope to further enhance this as a part of a users workflow (as I describe in my above issue).

But maybe you already have similar plans and ideas? ๐Ÿ˜‰

Bug: switching to first window in first tab after onHoverOut automatically

Description:
When hovering and displaying with hover-hint in a split window (which is not the first window in the first tab),
it seems to me ...
it's "onHoverOut" automatically switching the focus/cursor to the first window in the first tab.
There's no error msgs occurring or anything, plus I guess you'll know already anyway ...

Expected Behavior:
I don't want my focus/cursor to be switched to another window/pane at all

hoverhint_window_skip_bug.mp4

LSP hover

Hello, could it also be possible to trigger vim.lsp.buf.hover() on mouse hover?

Does not work with LazyVim

I am using the LazyVim setup I installed this plugin according to the docs. Despite being loaded, the plugin fails to display any content in the hover window motion as expected.

my config:

return {
  {
    "soulis-1256/eagle.nvim",
    -- opts = {},
    -- config = function(_, opts)
    --   require("eagle").setup(opts)
    -- end,
    -- config = true,
    -- init = function()
    --   vim.o.mousemoveevent = true
    -- end,
  },
}

I tried a various combination of configurations but I am not able to run it. Tested on files with python, terraform, and golang.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.