Code jumping in julia vscode most often does not work - what is it I am doing wrong?

Hi there,

I would like to gather some experiences about how good vscode completion is working for you. Almost all the time I have problems jumping to source code in some nested subpackges, etc…

If I do a Julia: Re-index language server cache a couple of things work fine, but soon also this gets reset somehow, and many things don’t work anyway.

My personal feeling is that this missing IDE support is the most important drawback I am currently facing with Julia. Maybe I am just doing something wrong (maybe some OS settings, anything might be the reason), hence I am reaching out to your experience.

2 Likes

I feel like it mostly works for me, though I certainly also run in to cases where suddenly it seems to have no clue about definitions that to me seems like it should be possible to know.

E.g. for this small script

using Plots
x = randn(10)
plot(x)

I can Ctrl-click Plots and jump to the main Plots.jl file, randn and jump to that function, though it does not seem to have a clue about the definition of plot.

Doing @which plot(x) in the REPL and then clicking that path works fine, and I get to the place I want.

I haven’t tried Julia: Re-index language server cache before, but it didn’t help in this case for me at least.

2 Likes

Same experience here; sometimes it doesn’t even find functions defined in the same (devved) package.

4 Likes

I never seem to have problems except for

which sounds like LanguageServer.jl#988 which isn’t just a bug but simply missing functionality.

However, I tried

just now and that one actually doesn’t work. Perhaps something quirky with the name plot not being owned by Plots, or something related to Requires.jl (if Plots still uses that?).

2 Likes

I have given up on the “go to definition” command in vscode since it’s almost never working, and instead mapped “go to symbol in workspace” to a keyboard shortcut. It’s much more robust in case you want to find symbols defined in your workspace

5 Likes

Thank you all for sharing your experiences.

something related to Requires.jl (if Plots still uses that)

I am not really using Requires.jl, but in case, is there an alternative with better support for code-jumping?

If you have concrete examples, please post as issues. I almost never have any problems, but perhaps I am not using any problematic packages. I looked briefly at Plots, and the failure there I think is related to their setup of backend machinery, which, among other things, evaluates code in Main. Since this is a very non-standard package setup it would be great with concrete examples of failure modes for more standard packages.

I don’t know, I never experience the problem, but perhaps I never try to jump to definition on problematic names :man_shrugging:

1 Like

Two recent example of mine:

  • I cannot jump to names in the packages Git (e.g. git) or BetterFileWatching (e.g. watch_folder). The whole packages don’t get recognized. They use _jll packages inside, maybe that is corrupting something.

  • It seems that a custom Registry (e.g. via LocalRegistry) is also not working (I have custom fork, maybe this is also because of clashes in name, and there is a bug that the uuid is somehow ignored)

Am I correct that all this code-jumping is almost never an issue with julia-for-vscode, but should be opened at LanguageServer.jl ?

Both of those work perfectly fine for me :man_shrugging: Perhaps you don’t have the packages in your Project.toml?

I don’t really know why this would be problematic either, but if you can post an MWE that would be great.

Yea, you can post issues to LanguageServer.jl.

1 Like

It’s almost always related to the problem with locally deved packages. 9 out of 10 times I want to find a function it’s in my locally deved packages so in practice it’s never working for me. The “go to symbol in workspace" does however work very well in this context.

4 Likes

Unbelievable: I found the difference :slightly_smiling_face:

I am often working on multiple julia projects in one workspace - it seems that the default vscode julia environment somehow got fixed to one of these julia projects, and all autocompletions thought they would be in that environment, hence the missing dependencies and links.

Now, I switched to my global default julia environment as a workaround, code jumping for Git and BetterFileWatching work again!!! :slightly_smiling_face:

Ideally it would be great to automatically switch to the parent env of the currently active file. I opened a new respective discourse thread

1 Like