Comments (7)
Ya, you are right. we would need to check the current scope at
Lines 45 to 53 in c6d3edc
from languageserver.
I'm using the version of languageserver
on CRAN. When I hold Ctrl and hover over print
in the below code, it works as expected (I get the hover definition, and if I click it opens a file with the definition):
xml_find_all(x, "base::print")
When I do the same for
xml_find_all(x, "descendant::expr")
I get basically the same error:
[Error - 18:02:34] Request textDocument/definition failed.
Message: {"message":"there is no package called ‘descendant’","call":{}}
Code: -32603
I don't have the package descendant
installed, so I think that's the problem. (I tried installing it, but it doesn't seem to be on CRAN.) @renkun-ken Do you have it installed?
Moving the mouse over expr
without Ctrl held down, I don't get any hover popup but I also don't get an error showing. The code for hover_reply
includes a tryCatch
that is probably catching an identical error. I think I removed the equivalent tryCatch
in the definition code, so I've introduced an inconsistency there. @randy3k If you want, I could do a PR to put it back in (also for the symbol reply functions).
from languageserver.
@andycraig, thanks for your testing. My point is that I'm not sure if it makes sense to provide definition of foo::bar
in string literals, since the code I provide here is really an XPath expression rather than R code, or it could be some C++ code, or anything.
from languageserver.
@renkun-ken Ah, beg your pardon. No wonder descendant
isn’t on CRAN! Re-reading the issue I now see what you mean.
from languageserver.
Thanks! I test it and it works well now.
from languageserver.
Actually it doesn’t work for multi line strings. But they are not common plus the search would be costly. This is good enough for now.
from languageserver.
Multi-line strings can be handled by parsed xml doc, i.e., xpath query if the cursor is in the range of a string literal, but it requires that the document is syntactically correct to be parseable. It think it's good enough too.
from languageserver.
Related Issues (20)
- callback error in Neovim: “attempt to compare string with number” HOT 1
- Completion dataframe variable/columns HOT 3
- Neovim lspinstall r-languageserver installation not using .Rprofile CRAN mirror address?
- languageserver crashes with regex in file
- VSCode outline fails in Rmarkdown document if there is pseudo chunk text inside the chunks
- VSCode Perl::LanguageServer causes a process that consumes CPU HOT 2
- Section collapsing issues HOT 1
- Error with renv: Header must provide a Content-Length property
- Hover and Outline do not appear to function
- languageserver and help page viewer not working in windows10 and miniforge environment
- Get warnings for no variable/function declaration in scope? HOT 1
- syntax highlight does not work in visual model HOT 1
- LSP diagnostics shows `lintr` error although `lintr::lint_package()` does not HOT 4
- Issue: Auto completion with quarto extension in VSCode
- Languageserver does not show words with accent properly
- add support for visual studio code for the web HOT 1
- Hex code '\a0' crashes language server
- R LSP crashes in VSCode - username HOME directory with an accent HOT 3
- Formatting parameters (tab size, naming convention) are passed to styler but not lintr
- custom style guide in README HOT 3
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 languageserver.