Comments (12)
Hey @jlesquembre, are you calling goto_preview_implementation
or goto_preview_definition
? The manual call to the LSP snippet you show calling the implementation one, does that also not work with goto-preview or is it just the definition call that doesn't?
from goto-preview.
I'm calling goto_preview_definition
. I tested goto_preview_implementation
, which doesn't show any error, but does nothing.
The LSP snippet I posted, I think it is what goto-preview is calling internally. That snippet works fine, it's only goto-preview not working. I'm confused by that, since the LSP seems to return a valid value.
from goto-preview.
@jlesquembre So from what I can tell there are a few odd things here
- I think the clojure LSP doesn't seem to support
textDocument/implementation
, at least according to https://github.com/clojure-lsp/clojure-lsp/blob/master/docs/capabilities.md, so it is odd to me how you seem to have called that manually and got results for it. (might just be out of date docs idk) - There is a thing called a legacy_handler I added a while back, this was to conform to the new way Neovim sends the data through from the LSP call to the registered handler - it might be that that logic is not working well enough when in conjunction with clojure-lsp. What I mean by that is the only real way
data
could benil
is if this linelocal data = result[1]
returned nil, which could happen depending on what came back from the lsp call.
I have created this PR which should help with identifying what is wrong through improved logging.
#40
Would you mind updating goto-preview
to the newest version, enabling debug, require'goto-preview'.setup{debug=true}
and then showing me what you get?
from goto-preview.
@rmagatti thanks for your help, with the latest version, that is the debug message I get:
goto-preview: calling new handler
goto-preview: nil
Error executing vim.schedule lua callback: ...ack/home-manager/start/goto-preview/lua/goto-preview.lua:15: attempt to index local 'data' (a nil value)
I'll try to do some debugging on my own
from goto-preview.
found something, the result
value is something like
{
range = {
end = {
character = 18,
line = 36
},
start = {
character = 6,
line = 36
}
},
uri = "file:///.../utils.cljc"
}
it is not an array, because of that, result[1]
is nil.
Not sure if what clojure lsp returns is valid according to the lsp spec
from goto-preview.
I was looking to the LSP specification, looks like returning a single Location
is a valid response:
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_definition
Maybe we could do something like local data = result[1] or result
?
from goto-preview.
Yeah that should work! I did not realize a single location was a thing. I'll see if I can get to this soon, if not happy to review a PR for it too.
from goto-preview.
here you go: #41
I took a deeper look, and I think that's the only required changed
from goto-preview.
Nice, thanks @jlesquembre!
from goto-preview.
I also see this error when trying to goto_preview_definition()
in a ts file. I see the error and the preview window is successful shown.
I'm new to vim and not quite sure how to help with a reproduction etc...
from goto-preview.
I also get the same error with the ember
language server if a definition does not exist.
from goto-preview.
@lougreenwood got a video or something showing what you mean? I can't reproduce this with tsserver.
from goto-preview.
Related Issues (20)
- Esc to close the floating window (similar functionality as telescope.nvim) HOT 1
- [FEATURE] add `post_close_hook` option which executes after `close_all_win()` HOT 2
- [BUG] Do not work with lazy? HOT 2
- [FEATURE] Better floating window focusing method HOT 1
- [BUG] Preview window won't show if "dismiss_on_move = true" and "focus_on_open = true" HOT 1
- [FEATURE] Close floating window when cursor leaves buffer HOT 3
- [Feature] Only show the first implementation HOT 3
- Provide an option for making preview window unchangeable. HOT 7
- [BUG] incorrect floating window closed in case multiple floating previews are opened HOT 5
- [FEATURE] Configurable starting zindex HOT 3
- [FEATURE] Close Currently focussed preview window with q HOT 2
- [FEATURE] Trigger goto-preview from any Telescope.nvim picker
- Change border color HOT 1
- How to close only one preview and how to open focused preview in current split but new buffer?
- Setting on `post_open_hook` will be shared if I split window? HOT 1
- [BUG] attempt to index field 'lsp_configs' (a nil value) HOT 9
- [FEATURE]: 'Enter' key in a preview window to close all preview windows and go to the definition,refs, etc HOT 6
- Filename in float window
- Getting "Invalid key" error when go to definition HOT 6
- [FEATURE]: Toggle single preview window and show definition automatically when cursor moving in source window. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goto-preview.