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

Add support for Jump to Definition #42

Closed
paulcsmith opened this issue Dec 13, 2017 · 9 comments
Closed

Add support for Jump to Definition #42

paulcsmith opened this issue Dec 13, 2017 · 9 comments

Comments

@paulcsmith
Copy link

I'm loving the plugin so far. It would be wonderful if it could also support Jump to Definition so I could jump to a class or method definition in the project.

Thanks for the project, and thanks for considering this feature.

@faustinoaq
Copy link
Member

@paulcsmith Thank for your comment!

Go to Definition already work just methods. Modules or clases doesn't work due crystal doesn't support it yet. See crystal-lang/crystal#4941

Still a bit unstable, sometimes doesn't work ⚠️

You can enable go to method definition using:

{
  "crystal-lang.implementations": true
}

https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Settings#implementations

If you are in a custom project where you specify all requires inside a main file then you need to use:

https://github.com/crystal-lang-tools/vscode-crystal-lang/wiki/Settings#mainfile

{
  "crystal-lang.mainFile": "${workspaceRoot}/src/mymainfile.cr"
}

go to

(Older version Peek implementation command has been removed on latest versions)

kemal go to

@faustinoaq faustinoaq added this to To do in Crystal Tools via automation Apr 6, 2018
@minkir014
Copy link

But as I see now that issue is fixed by a PR. Can you support that now??

@iambudi
Copy link

iambudi commented Nov 16, 2019

When jump to definition throws the following error:

[Info  - 9:53:45 PM] Scry is looking into your code...
[Error - 9:53:54 PM] A error was found while searching implementations
Unexpected char 'U' at 1:1
Usage: crystal tool implementations [options] [programfile] [--] [arguments]

@faustinoaq
Copy link
Member

Hi, @minkir014 @iambudi This extension uses the output provided by crystal tool CLI, so if the feature finds an error it's because crystal was designed that way, there is some workaround using a dynamic code analyzer based on javascript or something similar

Scry has some nice features but is in a very experimental state yet. It also uses crystal CLI, so it is an issue and it requires the full updated implementation of Language Server Protocol.

Right now I'm fixing some issues on Node.js backend of this extension, I'll figure out a way to solve this issue.

Cheers!

@paulcsmith
Copy link
Author

Thanks @faustinoaq!!

@Narven
Copy link

Narven commented May 29, 2023

What is the current status of this?

On my side I don't see this work in any way currently. With peek, mouse click or anything.

I would say this is a pretty standard way to navigate code in the last 10 years, it pretty much renders useless any kind of editor/ide if it does not have it.

I'm currently running:

$ crystal -v
Crystal 1.8.2 (2023-05-09)

LLVM: 15.0.7
Default target: x86_64-apple-macosx 

What do we need to do to make this a top priority? and/or help?

@iambudi
Copy link

iambudi commented May 30, 2023

@Narven you might try this alternative

@Narven
Copy link

Narven commented May 30, 2023

Thanks @iambudi, will try that.

@nobodywasishere
Copy link
Member

This should work with v0.9.0-alpha.1, though it's reliant on the crystal tool implementations CLI tool. This can be unreliable when working on a libraries internals and I'm not sure why - when working on an executable/app where everything gets compiled it works well.

Crystal Tools automation moved this from To do to Done Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Crystal Tools
  
Done
Development

No branches or pull requests

6 participants