vscode-elixir icon indicating copy to clipboard operation
vscode-elixir copied to clipboard

Go To Definition does not work

Open mgwidmann opened this issue 6 years ago • 8 comments

No sure whats going on here, but jumping to definitions does not work, is this a feature?

You can see me here, hitting f12, trying to go to the definition of the function directly below but it says there is no definition. I ensured that mix compile succeeded before trying. Right click + Go To Definition or Peek Definition both do the same thing.

Elixir 1.5.1 clicking on preload_each here: https://github.com/elixir-ecto/ecto/blob/master/lib/ecto/repo/preloader.ex#L50

image

mgwidmann avatar Nov 04 '17 01:11 mgwidmann

Perhaps its because its a private function, is there no way to support this?

mgwidmann avatar Nov 04 '17 01:11 mgwidmann

Thanks for the reporting the issue. I can reproduce this in the ecto project.

Jumping to private functions seems to work fine in other projects. Mabye it is because there are multiple definitions of it. This seems to work in other projects though (will only go to the first found definition though..)

I will have to investigate this a bit more.

timmhirsens avatar Nov 04 '17 08:11 timmhirsens

Seems to be an upstream (elixir_sense) issue, as it doesnt work in the atom extension as well. Not sure if there is anything elixir_sense can do since it relies on information elixir provides.

It does work in the IntelliJ Plugin, but they have their own parser, which seems to be the most valueable/flexible way to go...

timmhirsens avatar Nov 04 '17 08:11 timmhirsens

I know this issue is really old, but I just started using the extension and I noticed "Go to Definition" does not work for me when the elixir project directory isn't the root directory opened in vscode (i.e. I have a directory my_app_name/ that contains multiple subdirectories, one of which is a phoenix "backend" API.

However, if I open just the phoenix backend API directory with vscode, this extension's "Go to Definition" feature works perfectly. Anyway, for an issue that's been open since 2017 does that mean this issue is never going to be addressed?

zcking avatar Apr 25 '19 23:04 zcking

Anyway, for an issue that's been open since 2017 does that mean this issue is never going to be addressed?

I personally forgot I even opened this issue and have just been using CMD+F to find private functions. Sucks, wish this would get fixed...

mgwidmann avatar May 01 '19 01:05 mgwidmann

I got the same problem

CellPhoneYeah avatar Jun 17 '19 11:06 CellPhoneYeah

If you install the ElixirLS package you can go to definition (cmd+shift+o) within the same file you are working on. What doesn't work is cmd+t that is going to a symbol within the project.

redeemefy avatar Aug 11 '19 02:08 redeemefy

@zcking I think your issue regarding the elixir project not being the root folder of the open workspace can be solved by setting the following setting on the project or user level for the plugin:

{
  "elixir.projectPath": "/relative/path/to/backend/from/root/folder"
}

An easy way to modify this setting is to:

  1. Navigate to the plugin tab
  2. Search for the plugin
  3. Click the gear icon on the plugin card
  4. Click on "Configure Extension Settings"
  5. Set the "Elixir: Project Path" value.

Same setting exists also for the elixirLS plugin.

oliroy avatar Sep 15 '19 03:09 oliroy