Support find references #104
Comments
Crazy 😛 I think this would need a special tool from the compiler, similar to |
So def foo # here you use go to references
end
foo # here you use go to implementation @crystal-lang-tools/scry @bcardiff @RX14 @asterite @ysbaddaden @straight-shoota WDYT? |
Why can't scry implement this internally? Does scry actually shell out to |
Yep 😅 We used to use implementations direct from compiler but scry was too slow and too big, please see: #53 |
I don't understand that... the compiler has to do the same amount of work as scry, and use the same memory, so where's the benefit to shelling out?? |
But you reach the same peak memory consumption either way. It's just you've moved the memory usage into |
The memory was not being released, so scry got very heavy using even a couple of GBs Also scry was compiling too slow since we needed the entire compiler (just like compiling crystal itself) Now scry compiles very very fast:
Previously scry compilation used a huge amout of RAM (above 1GB) and took several minutes to compile in my pc (even Travis) 😅 |
Actually, Scry packages were around 20MB in the past, see #3 (comment) (even bigger uncompressed) Now, release packages are very small: Even statically typed (linux) |
So, I think |
So scry doesn't do anything fancy and breaks as soon as there's a syntax error in your code. Oh well, not a very useful tool after all. |
No,no, @RX14 scry is super useful, this tool will allow us to support almost every editor, even Visual Studio when Windows port for crystal is ready 😉 |
It's not useful for your find references or your go to implementation or for all of your "smart features" to break as soon as your code stops compiling. You need scry the most when you're in the middle of a refactor: when your code doesn't compile and you need to navigate it to find out why. And that is why scry isn't useful. Real IDEs don't break in that situation. This is why you can't build IDE features on top of a compiler: compilers exist to be strict about code, IDEs cannot be strict about code. |
@RX14 not at all! 😅
Wrong 😅 , this tool does autocompletion, symbol listing, and a bunch of other nice features, (I'm working on rename feature right now 😉 ) we still use
Wrong again 😅 We catch compiler bugs and return a
Wrong, again, again 😉 as I said before, this tool is the implementation of Language Server Protocol, the idea behind one server to rule them all 💪 . Right now I have diagnostics, completion, symbols and a bunch of first-class IDE features almost out-the-box on Intellij-Idea thanks to scry and the Language server protocol 😄
And finally wrong 😅 "your code stops compiling. You need scry the most when you're in the middle of a refactor". Scry never stops, this tool is resilient to compiler failures on crystal code 💪 "You need scry the most when you're in the middle of a refactor: when your code doesn't compile and you need to navigate it to find out why. And that is why scry isn't useful." We're already trying to execute scry request concurrently, also scry does support |
So, finally I still think |
@faustinoaq I don't think you understood my point. Scry keeps running when your code doesn't compile, but does it return results? If not, it's fairly pointless. |
Yep, if the code doesn't compile then you get a diagnostic with problems to fix :-) By example, if you want to format your code and you have syntax errors, you will get an error diagnostic first, then you fix the error in that file, and the format feature is working again. |
Same with implementations, symbols, hover and rename, except completion, code completion is resilient to errors. |
References feature would behave same way |
@faustinoaq you're missing my point again. I don't want to get the compile error back. I want to get the same result as if the code compiled. If you go use a java IDE, and you have 200+ compile errors in your file, it will STILL give you completions (it won't tell you to fix your code), it will STILL give you all the refactorings and goto definition/goto usages. It won't tell you to gix fix your compile errors, it'll work anyway. What I mean by scry breaks is that it doesn't give you the same results when your code doesn't compile as when it does compile. And that makes it useless. If i'm editing code, it's either because it's broken or incomplete: either way it'll generate a compile error. I don't need jump to definition/usages unless i'm editing code. So the only time I actually need the damn thing to work it's broken. |
Yep, scry can do that 😉 |
The way you described it working implied that that can't work. |
Yep, because it depends on the feature, completion and workspace symbols are resilent to errors, although, document symbols, formatting, implementations and hover, are based on However, scry already uses dir scopes based on Right now I know scry have some limitations (because is based on Perhaps in the future we can make So, again, I still think at least some support for |
@RX14 see my comment: (above your comment)
Thanks to @laginha87 🎉 |
Oh, BTW using full I think a flag like Something like Java: "give me all, doesn't matter errors..." 😎 |
Well that's certainly better than nothing I guess. I hope you can expand the other tools to be resilient to compile errors too. |
Yep, I think scry is a nice start and I guess Like this: if build_failure?
try_to_fix_code # Maybe, even commenting out the error lines
else
return_response
end WDYT? |
@asterite @RX14 Do you know when/where the compiler does that? 😅 Ref: #104 (comment) |
Hi community!
Find references is a feature I have no idea or clue on how to implement,
This is the only missing feature to complete basic LSP support see: https://langserver.org/
So, WDYT about this scry capability?
The text was updated successfully, but these errors were encountered: