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

Jump to code not working for absolute imports into same package #1225

Closed
schlichtanders opened this issue Jul 11, 2023 · 4 comments
Closed

Comments

@schlichtanders
Copy link

Hi,

understanding why jump to code does not work is really a hard problem. Now I came up with a good guess I want to share.

When using absolute imports to my own package, the code works (i.e. is valid julia) but jumping to code does not work and the linter reports that it cannot find the functions.

src/MyPackage.jl

module MyPackage
  module SubMod1
    a = 42
  end
  include("file2.jl")
end

src/file2.jl

module SubMod2
  using MyPackage.SubMod2: a
end

When I run re-index language server cache in VSCode, for a few seconds the code-jumping work, but then again everything is marked as unresolveable.

@schlichtanders
Copy link
Author

@pfitzseb can you look over the issue description?

Maybe you recognize it as a duplicate of another issue, or have a clue where the reason may be for this missing support for submodules.

@schlichtanders
Copy link
Author

@davidanthoff maybe you have an idea what this could be about?

@pfitzseb
Copy link
Member

Isn't this just a typo and it should be

module SubMod2
  using MyPackage.SubMod1: a
end

in file2.jl? That consistently works for me.

@schlichtanders
Copy link
Author

thank you for the pointer - so this is unfortunately no minimal reproducible example... but just a little typo ... a pity

I tried code jumping again and I am very surprised - it works now with almost everything which hasn't worked for a while.

Only macros don't work - I opened a new ticket for it #1244


I now made sure to always activate the parent environment, maybe this helped. Before I used julia 1.9 central project to have multiple projects at once. It might be because the environment was just activated that things worked, and things would fail when working longer, but maybe this was really everything which I've done wrong all the time.

It would be great to have autoswitching of environments (I like to open the complete .julia/dev folder within vscode).
I opened a ticket at julia-vscode/julia-vscode#3411 respectively

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants