Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use goto-preview while it is installed, how to troubleshoot it ? [BUG] #78

Closed
Bastien-mva opened this issue Dec 17, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@Bastien-mva
Copy link

Hello,

Thanks for the repo, it seems to be quite awesome.

I am trying to use it but I am having trouble to make it work.

I installed it using packer.nvim as required in the README.

It seems to be installed since the keymap gdp does different things whether default_mappings is set to true or false in the config file (paste when set to false, and nothing when set to true). When it is set to true, it does nothing and I don't have an error message. I tried to set my own keybinding, similarly nothing happens when I press the keybinding. I made sure it were mapped to nothing before setting it.

I tried with a simple .py file :

def foo(x):
    print(x)


foo("test")

pressing keybindings on the word foo.

I just wanted to know if you have any advice on how to troubleshoot this, since no error message is displayed.

  • Ubuntu 22-04
  • NVIM v0.9.0-dev-494+g407eef473

Thanks :))

@Bastien-mva Bastien-mva added the bug Something isn't working label Dec 17, 2022
@rmagatti
Copy link
Owner

Please link or paste your setup function call. Also, please set debug to true and then paste or screenshot the result of :mess in here, that should give you more info on why nothing is happening.

ex:

require("goto-preview").setup {
  default_mappings = true,
  debug = true,
}

It's probably worth pointing out that this only really works with Neovim's native LSP, and that the specific LSP you are using needs to support the goto definition call (most do).

@Bastien-mva
Copy link
Author

Bastien-mva commented Dec 18, 2022

Hello, here is my setup calling. I just added default_mappings = true, debut = true} as advised:

use {'rmagatti/goto-preview', config = function() require('goto-preview').setup {default_mappings = true, debug = true}end }

Here is the output of :mess:

  border = { "↖", "─", "┐", "│", "┘", "─", "└", "│" },
  bufhidden = "wipe",
  debug = true,
  default_mappings = true,
  dismiss_on_move = false,
  focus_on_open = true,
  force_close = true,
  height = 15,
  lsp_configs = {
    get_config = <function 1>
  },
  references = {
    telescope = {
      border = true,
      borderchars = {
        preview = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
        prompt = { "─", "│", " ", "│", "╭", "╮", "│", "│" },
        results = { "─", "│", "─", "│", "├", "┤", "╯", "╰" }
      },
      hide_preview = false,
      layout_config = {
        height = <function 2>,
        preview_cutoff = 1,
        width = <function 3>
      },
      layout_strategy = "center",
      results_title = false,
      sorting_strategy = "ascending",
      theme = "dropdown"
    }
  },
  resizing_mappings = false,
  stack_floating_preview_windows = true,
  width = 120
}
1 line less; before #1  1 second ago
Already at oldest change
goto-preview: calling new handler
Press ENTER or type command to continue

I am using cmp-nvim-lsp as LSP.

Now gpd shows

goto-preview: calling new handler

but still nothings happens.

@rmagatti
Copy link
Owner

rmagatti commented Dec 22, 2022

From these logs, I can only assume your LSP is not returning any data on the textDocument/definition call.
The code in goto-preview where you're likely stopping:

local handle = function(result, opts)
if not result then
return
end

@Bastien-mva
Copy link
Author

Thanks

I tried to debug it but did not found any clues. I re installed my lsp and it works vert fine now.

Thanks for this awesone plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants