Coder Social home page Coder Social logo

glance.nvim's People

Contributors

aspeddro avatar dnlhc avatar ldelossa avatar lostl1ght avatar lvim-tech avatar rafi avatar williamboman 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

glance.nvim's Issues

Exposing preview's win_opts via config

What are your thoughts on exposing the win_opts table in the preview module to the config?

My goal here is to set "wrap=false".

Was seeing if I could do this from the hook, but I think all the window options are internal to preview.lua module.

Split to right/below

Hi!
Thank you for creating this fantastic plugin.

So, is there any split to right/ split to bottom actions when I jump to the definition

hooks are nil

Can no longer open definitions in Glance.

Error executing vim.schedule lua callback: ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:155: attempt to index local 'hooks' (a nil value)                                                                              
stack traceback:                                                                                                                                                                                                                      
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:155: in function 'cb'                                                                                                                                             
        .../louis/.config/nvim/after/glance.nvim/lua/glance/lsp.lua:31: in function 'handler'                                                                                                                                         
        /usr/share/nvim/runtime/lua/vim/lsp.lua:1388: in function ''                                                                                                                                                                  
        vim/_editor.lua: in function <vim/_editor.lua:0>   

invalid win errors

Really cool plug.

Seeing this tho immediately when opening glance.

Error detected while processing WinScrolled Autocommands for "*":                                                                                                                                                                     
Error executing lua callback: ...ouis/.config/nvim/after/glance.nvim/lua/glance/utils.lua:34: Invalid window id: 1014                                                                                                                 
stack traceback:                                                                                                                                                                                                                      
        [C]: in function 'nvim_win_get_config'                                                                                                                                                                                        
        ...ouis/.config/nvim/after/glance.nvim/lua/glance/utils.lua:34: in function 'is_float_win'                                                                                                                                    
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:108: in function <...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:107>  

Seems to make it unusable. This is with Gopls.

Bug: attempt to call field 'inlay_hint' (a nil value) when going to references

I get the following error after updating the plugin:

│E5108: Error executing lua: ...local/share/nvim/lazy/glance.nvim/lua/glance/preview.lua:178: attempt to call field 'inlay_hint' (a nil value)                                                                                                │
│stack traceback:                                                                                                                                                                                                                             │
│        ...local/share/nvim/lazy/glance.nvim/lua/glance/preview.lua:178: in function 'close'                                                                                                                                                 │
│        ...v/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:502: in function 'close'                                                                                                                                                 │
│        ...v/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:443: in function 'jump'                                                                                                                                                  │
│        ...v/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:300: in function <...v/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:299>                                                                                       │

Version (neovim's master as of a couple months ago):

NVIM v0.10.0-dev-425+g780109106
Build type: Release
LuaJIT 2.1.0-beta3

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

I believe this has to do with this commit, and this was solved for me by recompiling my neovim from the latest master, but just wanted to let you know that the version check is probably incorrect (or I have a very weird version).

Any way to make peek window not create an entry in `:oldfiles`?

Is there any way to have a file opened in the glance window not create an entry in :oldfiles?

I'd only want an :oldfiles entry if I actually open the file in a normal editor buffer.

This is an awesome plugin btw, looks super nice and works great 👏

Bug: When closing Glance, jumps to the end of the buffer

When I close the Glance window without opening an item (i.e, q or esc), then the cursor jumps to the last line in the buffer, as if I had pressed G.

It seems my jump history is somewhat messed up by Glance: when I do jump to a definition/reference, jumping back leads me to the last line of the buffer as well instead of jumping to the actual location I opened glance from.


A far from ideal workaround I use for now:

hooks = {
	before_open = function(results, open, _)
		vim.cmd.mkview(3)
		open(results)
	end,
	after_close = function()
		local isOnLastLine = vim.fn.line(".") == vim.fn.line("$")
		if isOnLastLine then vim.cmd.loadview(3) end
	end,
},

Trouble integration

I would really love if C-q could open folke/trouble.nvim instead of running copen.
Consider something like gitsigns.nvim is doing:

      if config.trouble then
        require('trouble').open('quickfix')
      else
        vim.cmd.copen()
      end

As a workaround I mapped C-q to do:

      mappings = {
        list = {
          ["<c-q>"] = function()
            local glance = require("glance")
            glance.actions.quickfix()
            vim.cmd("cclose")
            vim.cmd("Trouble quickfix")
          end,
        },
      },

attempt to index upvalue '' (a nil value)

Error when passing mappings

Error:

packer.nvim: Error running config for glance.nvim: [string "..."]:0: attempt to index upvalue '' (a nil value)

Config:

  {
    "dnlhc/glance.nvim",
    config = function()
      require('glance').setup({
        mappings = {
          list = {
            ['j'] = actions.next, -- Bring the cursor to the next item in the list
            ['k'] = actions.previous, -- Bring the cursor to the previous item in the list
          }
        },
      })
    end,
  },

“Attempt to index local 'hooks' (a nil value)”

Hi there, thanks for your work on this plugin, it looks like an excellent addition to my setup!

I am unfortunately experiencing a problem in my AstroNvim setup when trying to invoke :Glance references -- I get the following error message and stack trace:

Error executing vim.schedule lua callback: ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:136: attempt to index local 'hooks' (a nil value)
stack traceback:
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:136: in function 'handler'
        ...im/site/pack/packer/start/glance.nvim/lua/glance/lsp.lua:31: in function 'handler'
        ...w/Cellar/neovim/0.8.0/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

It seems like the hooks map is always nil for some reason. This is my Packer init:

...

"dnlhc/glance.nvim",
config = function()
  require("glance").setup({})
end,

...

}

So, it should be set up with the default options which should have {} as default for its hooks, but it somehow gets converted into a nil value.

I also tried to configure it like:

require("glance").setup({
  hooks = {
    "before_open" = function(results, open, jump, method)
      open(results)
    end,
  },
})

But I still receive the same error message when running :Glance references

I'll continue with my debugging, but any help would be greatly appreciated! 🙇

Bug: Hangs if not enough space for window to open

With my setup:

       {
		height = 25, -- Height of the window
		border = {
			enable = false, -- Show window borders. Only horizontal borders allowed
		},
		list = {
			position = "right", -- Position of the list window 'left'|'right'
			width = 0.33, -- 33% width relative to the active window, min 0.1, max 0.5
		},
		theme = { -- This feature might not work properly in nvim-0.7.2
			enable = true, -- Will generate colors for the plugin based on your current colorscheme
			mode = "auto", -- 'brighten'|'darken'|'auto', 'auto' will set mode based on the brightness of your colorscheme
		},
		mappings = {},
		hooks = {},
		folds = {
			fold_closed = "",
			fold_open = "",
			folded = true, -- Automatically fold list on startup
		},
		indent_lines = {
			enable = true,
			icon = "│",
		},
		winbar = {
			enable = true, -- Available strating from nvim-0.8+
		},
	}

when opening glance in a small terminal window that has less than the defined number of lines with the "height" setting, glance seems to just hang until I press CTRL+C a couple of times to interrupt. Would be nice if it would check the max height and use that if height > max available.

Feature Request: support many more lsp operations?

Hi, is there a plan to support more operations?
Declaration, incoming calls, outgoing calls, code actions, in the same style.
Even diagnostics, hover, signature help, since I really love this style.

Error border a nil value

Hey got this error on trying to open :Glance and each subcommand

Error executing vim.schedule lua callback: ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:290: attempt to index field 'border' (a nil value)
stack traceback:
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:290: in function 'scroll_into_view'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:244: in function 'create'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:84: in function 'create'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:150: in function '_open'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:164: in function 'handler'
        ...w/Cellar/neovim/0.8.1/share/nvim/runtime/lua/vim/lsp.lua:1383: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

Just main editor to currently selected Glance position

In VSCode if I have references glance view sometimes I like to move the main editor to the position of currently selected popup item without closing the popup. It updates the breadcrumbs at the top of the windows and helps me understand where I currently am in the file and I continue from there.

Do you think it's possible to trigger such jump of the main window without closing the popup with glance.nvim?
Another solution I can think of would be to restore the last glance popup to continue my search. Would that be possible?

nil `glance.on_resize` method after glance window close

After patching in #12 I receive an additional error when closing the glance window:

Error executing vim.schedule lua callback: ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:102: attempt to call method 'on_resize' (a nil value)                                                                          
stack traceback:                                                                                                                                                                                                                      
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:102: in function 'fn'                                                                                                                                             
        ...ouis/.config/nvim/after/glance.nvim/lua/glance/utils.lua:165: in function ''                                                                                                                                               
        vim/_editor.lua: in function ''                                                                                                                                                                                               
        vim/_editor.lua: in function <vim/_editor.lua:0>    

This one is not immediately clear to me, but looks like you're loosing the reference to glance var is being captured before its creation.

I.e. if you do this:

  local debounced_on_resize = utils.debounce(function()
    print(vim.inspect(glance))
    glance:on_resize()
  end, 50)

It prints an empty table.

Failed to rename buffer

Error executing vim.schedule lua callback: ...m/site/pack/packer/start/glance.nvim/lua/glance/list.lua:219: Failed to rename buffer
stack traceback:
        [C]: in function 'nvim_buf_set_name'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/list.lua:219: in function 'setup'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/list.lua:41: in function 'create'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:252: in function 'create'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:88: in function 'create'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:154: in function '_open'
        ...m/site/pack/packer/start/glance.nvim/lua/glance/init.lua:168: in function 'handler'
        ...l/Cellar/neovim/0.8.2/share/nvim/runtime/lua/vim/lsp.lua:1383: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>

I have look at #23 and updated to the latest version for glance.nvim, but it still report an error as above. Here is my configuration

local glance = require('glance')
    local actions = glance.actions

    glance.setup({
        height = 18, -- Height of the window
        zindex = 45,
        preview_win_opts = { -- Configure preview window options
            cursorline = true,
            number = true,
            wrap = true,
        },
        border = {
            enable = false, -- Show window borders. Only horizontal borders allowed
            top_char = '―',
            bottom_char = '―',
        },
        list = {
            position = 'right', -- Position of the list window 'left'|'right'
            width = 0.33, -- 33% width relative to the active window, min 0.1, max 0.5
        },
        theme = { -- This feature might not work properly in nvim-0.7.2
            enable = true, -- Will generate colors for the plugin based on your current colorscheme
            mode = 'auto', -- 'brighten'|'darken'|'auto', 'auto' will set mode based on the brightness of your colorscheme
        },
        mappings = {
            list = {
                ['j'] = actions.next, -- Bring the cursor to the next item in the list
                ['k'] = actions.previous, -- Bring the cursor to the previous item in the list
                ['<Down>'] = actions.next,
                ['<Up>'] = actions.previous,
                ['<Tab>'] = actions.next_location, -- Bring the cursor to the next location skipping groups in the list
                ['<S-Tab>'] = actions.previous_location, -- Bring the cursor to the previous location skipping groups in the list
                ['<C-u>'] = actions.preview_scroll_win(5),
                ['<C-d>'] = actions.preview_scroll_win(-5),
                ['v'] = actions.jump_vsplit,
                ['s'] = actions.jump_split,
                ['t'] = actions.jump_tab,
                ['<CR>'] = actions.jump,
                ['o'] = actions.jump,
                ['<leader>l'] = actions.enter_win('preview'), -- Focus preview window
                ['q'] = actions.close,
                ['Q'] = actions.close,
                ['<Esc>'] = actions.close,
                -- ['<Esc>'] = false -- disable a mapping
            },
            preview = {
                ['Q'] = actions.close,
                ['<Tab>'] = actions.next_location,
                ['<S-Tab>'] = actions.previous_location,
                ['<leader>l'] = actions.enter_win('list'), -- Focus list window
            },
        },
        hooks = {},
        folds = {
            fold_closed = '',
            fold_open = '',
            folded = true, -- Automatically fold list on startup
        },
        indent_lines = {
            enable = true,
            icon = '│',
        },
        winbar = {
            enable = true, -- Available strating from nvim-0.8+
        },
    })

nvim versoin

NVIM v0.8.2
Build type: Release
LuaJIT 2.1.0-beta3



Column value outside range

Error in preview.lua:234:

Error executing lua callback: .../site/pack/packer/opt/glance.nvim/lua/glance/preview.lua:234: Column value outside range
stack traceback:
	[C]: in function 'nvim_win_set_cursor'
	.../site/pack/packer/opt/glance.nvim/lua/glance/preview.lua:234: in function 'update'
	...vim/site/pack/packer/opt/glance.nvim/lua/glance/init.lua:243: in function 'update_preview'
	...vim/site/pack/packer/opt/glance.nvim/lua/glance/init.lua:48: in function <...vim/site/pack/packer/opt/glance.nvim/lua/glance/init.lua:47>

Status of this project

I am looking forward to the support of other LSP actions that needs a preview window, e.g. incoming/outgoing calls, declarations, etc. as mentioned in #41 and #29, but seems that there's no code contributed for these features in one year.

So I wonder what is the current state of this project. Is it in a maintenance state and stops implementing new features?

Thanks in advance.

Highligh referenced name

It would be more convenient to see (with a highlight) what the reference is (on the left window) that you are looking (at the right window).

Example. On the screen below I don't know where is the get-id on the left window:
image

LSP operations within preview window

Hey,

How often do you expect users to perform LSP operations within the preview window?

A couple issues I've found is:

  • Calling "Glance definitions" within the preview window doesn't seem to work. IMO, it should close current Glance window and possibly open a new one with the preview of the symbol within the original preview window.

  • Zindex for Glance should be lower then LSP popups such as "hover"

image

In the above image, the preview window is covering the hover info for a symbol's hover info within the preview window.

[Feature] Specify per-request hooks

Hey! I'd like to be able to provide custom hooks on a per-request basis. An example of this would be to create a keymap to only view references within the current buffer, for which I'd exclude any items whose bufnr != current_bufnr. I was not able to find a way to make this work currently.

What I had in mind was adding a 2nd parameter to .open(method, opts), like so:

require("glance").open("references", {
  hooks = {
     before_open = function (results, open, jump, method)
         -- filter results and open()
     end,
  }
})

I'd be happy to contribute with a PR if you think the above approach would make sense.

Show glance window above all buffers

Hi there, currently when I open the glance window the width is restricted to the size of the calling buffer window. This is fine when I only have one buffer open, but is problematic when I have multiple vertical splits open. Is it possible to have it hover above all other buffers when opened? I tried setting zindex = 100, but that didn't help. Thanks!

File Icons

File icons seems to be rendering wrong.
image

How to integrate special server command to retrieve references?

Hey 👋🏾

First of all, thanks for this cool plugin! 🙏🏾

I have a weird request. I'm working with VueJS projects. And the language server for Vue SFCs has a not standardized LSP method that can give you "additional" references.
In case you are not familiar with VueJS, I try to sum it up a little. In Vue you can write so call single-file-components. They are a single file and include template, styling, logic and more for a web component. Anyway, there is a lot of "magic" happening under-the-hood by the Vue TypeScript Compiler. In the end, this file makes a (default) export that is "invisible". With invisible I mean that there is no piece of text/code in this whole file I could call textDocument/reference on to figure out where this component is used.
To solve this problem, the language server added a new special method (not even a workspace/executeCommand). It takes the same parameters as a textDocument/reference request (though, the position gets ignored). The result is also the same format with a list of LSP locations.

My question is now what would be the best way to integrate this into this plugin somehow. By configuration or similar I mean. Not a first-level support for this special case ofc. Do you have an idea? 🙈
Thanks for the help!

Conflict with nvim-ts-rainbow

Hi. I have below error when I have enabled nvim-ts-rainbow plugin for treesitter and going to reference via Glance. I don't know if it's error related to Glance or nvim-ts-rainbow.

Error:

Error executing lua callback: Vim:E315: ml_get: Invalid lnum: 1
stack traceback:
        [C]: in function 'bufload'
        vim/_editor.lua: in function 'region'
        /usr/local/share/nvim/runtime/lua/vim/highlight.lua:30: in function 'range'
        ...share/nvim/lazy/nvim-ts-rainbow/lua/rainbow/internal.lua:86: in function 'update_range'
        ...share/nvim/lazy/nvim-ts-rainbow/lua/rainbow/internal.lua:194: in function 'cb'
        ...l/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:780: in function '_do_callback'
        ...l/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:220: in function 'invalidate'
        ...l/share/nvim/runtime/lua/vim/treesitter/languagetree.lua:921: in function '_on_detach'
        /usr/local/share/nvim/runtime/lua/vim/treesitter.lua:73: in function </usr/local/share/nvim/runtime/lua/vim/treesitter.lua:69>
        [C]: in function 'nvim_buf_delete'
        ...local/share/nvim/lazy/glance.nvim/lua/glance/preview.lua:177: in function 'close'
        ...i/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:502: in function 'close'
        ...i/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:443: in function 'jump'
        ...i/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:300: in function <...i/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:299>

Error: Column value outside range

Error detected while processing CursorMoved Autocommands for "<buffer=63>":
Error executing lua callback: ...local/share/nvim/lazy/glance.nvim/lua/glance/preview.lua:255: Column value outside range
stack traceback:
        [C]: in function 'nvim_win_set_cursor'
        ...local/share/nvim/lazy/glance.nvim/lua/glance/preview.lua:255: in function 'update'
        ...o/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:482: in function 'update_preview'
        ...o/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:152: in function <...o/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:151>

Jump to entry without opening a preview window if it's the only one

Hi,

Would you consider adding an option that would immediately jump to a location if it's a single entry in the preview window? I don't really need a preview in those cases so it's just to avoid a single jump.
Other than that, very nice and useful plugin. Will be replacing Telescope with it.

Jumplists are no pushed to on file location jump

If you jump to a file location using Glance.nvim, you'll notice that the jump locations before and after are not appended to the jumplist. You can see this with 'jumps' after using a file jump.

This breaks 'ctrl-o' and 'ctrl-i`

[Enhancement] after_close hook

For context, I like to hide certain plugins and functionality when using Glance (minimap, my winbar for example). I use the before_open hook to do that cleanly. When I close Glance, it would be great to be able to cleanly restore them via another hook.

Cannot <leader>l back out of preview

Hey,

I've been trying to track down this issue with Glance. It seems like I can use l to jump into the preview window, but once in there, i can't jump back out.

In fact, all the keybindings for the preview window seem to break. I've disabled some obvious culprit plugins, but the issue seems to still be there. Do you experience this at all?

FR: Support for Live Grep

I found the ability to quickly edit files by switching to the preview window to be so helpful, that I kinda wish that this would also work for live-grep results. I can see though that live grep will be a bit tricker to implement, since it would require dealing with a dynamically changed search term.

Nevertheless, thank you for this incredibly useful plugin.

FeatureRequest: Add empty space (virtual lines?) underneath preview + bind scrolling

Hey there @DNLHC !!

First things first: Beautiful!!! :-)
(I actually installed it instead of my rmagatti/goto-preview -plugin ... for now, let's see if it works smoothly for me)

Then, the idea:
I'd love to see the preview window automatically generating virtual lines in the original pane/buffer-window underneath itself,
plus scroll bind the preview window to the original location (relative to its >parent<-buffer).

=>

  • I guess adding virtual lines is not a big deal for you guys (I am not that "advanced" in nvim progging yet ... hehe)
  • I guess scroll binding can be done (as there's like plugins that do that to markdown previews I think I can remember)
  • I guess scrolling the original buffer region out of the viewport could be slightly complicating thing for the floating window, I hope you can just hide the floating window?? or something else??

Why?
I often find myself not wanting to split open a reference/implementation right away, as I am overloading my layout ...
So I would love to leave those little peek-windows open ... for the while!
But without scrollbinding and empty space (virtual lines underneath) this wouldn't work.

Additionally:
I guess it would be necessary to expose some kind of "Glance CloseAll(Buffer)Previews" command should you implement that idea too.

Hmmm, anyway, looking awesome this, great work!!

Cheers, Joehannes

Feature Request - more special server commands

Hey 👋

Here the author of #56. You solved the requested feature pretty fast and nicely by adding the register_method. And I wonder if this feature could be extended. But it doesn't seem too obvious how to extend, so I would like to discuss the solution approach first before thinking about writing a PR.

So I have more LSP server specific commands which are somewhat location related (or could be interpreted like this). So for example the rust-analyzer allows to show a list of tests that are using/related to the piece of code under the cursor. It additionally provides information how to run each individual test etc. pp. Which means it is unfortunately not a simple response with Location[]. Though the request parameter are still just TextDocumentPositionParams.
In this exact case, the response structure of the rust-analyzer looks something like this:

{
  result = {
    {
      runnable = {
        args = { --[[ ... ]] },
        kind = "...",
        label = "...",
        location = { --[[ ... ]] },
      }
    },
    {
      runnable = {
        args = { --[[ ... ]] },
        kind = "...",
        label = "...",
        location = { --[[ ... ]] },
      }
    },
  }
}

So if you take this response and map each entry it to the nested location attribute of it, this would be a regular LSP Location[] data structure again.

Taking this example, I thought about a generic solution approach that puts as less burden as possible on the plugin. And my proposal would be to extend your method representation by adding an optional property called response_preprocessor_callback or something similar (just trying to be expressive). The idea would then be that after the server has responded, the respective logic checks if such a callback is defined and if so, calls it and takes the output of that function to continue processing as always. That would mean for any existing method and all already in use custom ones, nothing changes at all. So it is fully backwards compatible. It also should require not many locations of code to touch and remain hopefully a quite minimal addition.

So an example configuration of a user like me would look the following:

require('glance').register_method(
  name = 'rust-analyzer-related-tests',
  label = 'Related Tests',
  method = 'rust-analyzer/relatedTests',
  response_preprocessor_callback = function(response)
    return vim.tbl_map(function(entry)
        return entry.runnable.location
    end, response.result or {})
  end
)

What do you think?

CallHierarchy support

Code is

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello, world");
    }

    void a() {
        b();
        c();
    }

    void b() {
        c();
    }

    void c() {
        d();
    }

    void d() {
    }
}

Incoming Calls
image

Outgoing Calls
image

attempt to index field 'border' (a nil value)

When running :Glance with any argument I get this error:

Error executing vim.schedule lua callback: ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:320: attempt to index field 'border' (a nil value)
stack traceback:
        ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:320: in function 'scroll_into_view'
        ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:273: in function 'create'
        ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:95: in function 'create'
        ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:175: in function '_open'
        ...g/.local/share/nvim/lazy/glance.nvim/lua/glance/init.lua:195: in function 'handler'
        ...r/neovim/HEAD-e1f03c4/share/nvim/runtime/lua/vim/lsp.lua:1390: in function ''
        vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue

actions.preview_scroll_win(-1) doesn't work reliably

Having these mapping:

	mappings = {
			list = {
				["<C-d>"] = actions.preview_scroll_win(-5),
				["<C-e>"] = actions.preview_scroll_win(-1),
}}

When scrolling while focus is in list-view, Scrolling -1 using doesn't always work. It works a couple of times but then stops and doesn't go further while scrolling -5 with always does the job. Hope you can reproduce this, I'm on neovim 0.9 (99cf111289bfcd14981255e805da43bac5139141).

Stick to bottom ?

Hi there !

Thanks for the plugin !

Is there a way to stick window to the bottom ? In that case, everytime I am looking for an LSP reference or definition, it will open the window at the bottom.

Thansk !

Glance hangs around 10% of the time

I updated glance today and noticed that on about 10% of the time it will cause nvim to hang (running with 100% CPU) calling Glance references for example.

I did roll back to commit 1daea15 now and it works totally fine again. I'm using the latest stable (0.8.1) on neovim.

Failed to rename buffer

Error executing vim.schedule lua callback: ...louis/.config/nvim/after/glance.nvim/lua/glance/list.lua:219: Failed to rename buffer                                                                                                   
stack traceback:                                                                                                                                                                                                                      
        [C]: in function 'nvim_buf_set_name'                                                                                                                                                                                          
        ...louis/.config/nvim/after/glance.nvim/lua/glance/list.lua:219: in function 'setup'                                                                                                                                          
        ...louis/.config/nvim/after/glance.nvim/lua/glance/list.lua:41: in function 'create'                                                                                                                                          
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:240: in function 'create'                                                                                                                                         
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:83: in function 'create'                                                                                                                                          
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:142: in function '_open'                                                                                                                                          
        ...louis/.config/nvim/after/glance.nvim/lua/glance/init.lua:156: in function 'handler'                                                                                                                                        
        /usr/share/nvim/runtime/lua/vim/lsp.lua:1388: in function ''                                                                                                                                                                  
        vim/_editor.lua: in function <vim/_editor.lua:0>  

this occurred when opening references (first a failed attempt, where no references existed) and then a successful reference. On the third attempt, there seems to be a buffer with the same name existing.

Add an action to open folds

I'm trying to setup a list mappings to be able to open a folded list with 'l' instead of enter. However, I did not see any action that would allow me to open folds. I saw a open action but this does not seem to do what I'd like to do and it errors out anyway with:

E5108: Error executing lua: ...k/myNeovimPackages/start/glance-nvim/lua/glance/init.lua:229: method: expected 'definitions'|'type_definitions'|'references'|'implementations', got nil                                                                                               
stack traceback:                                                                                                                                                                                                                                                                     
        [C]: in function 'error'                                                                                                                                                                                                                                                     
        vim/shared.lua: in function 'validate'                                                                                                                                                                                                                                       
        ...k/myNeovimPackages/start/glance-nvim/lua/glance/init.lua:229: in function <...k/myNeovimPackages/start/glance-nvim/lua/glance/init.lua:228>   

Is there currently a way to achieve what I'd like to do?

UX: Display a notification when no results are found

I was trying to Glance definitions on a Lua function imported from another module, but nothing was happening. I tried glancing other identifiers which worked as expected, so I am assuming the LSP server isn't finding any definitions for the first identifier I tried - I confirmed this with vim.lsp.buf.definition() which printed the message "Definition not found".

My suggestion: If no results are found, it'd be helpful if Glance would use vim.notify to let the user know rather than failing silently.

P.s. I've only been using this plugin for a few minutes and I'm already loving it! I always found vim.lsp.buf.definition() to be very clunky, but Glance is super intuitive. Nice work!

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.