LanguageServer.jl
LanguageServer.jl copied to clipboard
How to make code-jump working within the developing package ?
Example:
A package named as 'testjl' was initialized by PkgTemplates with part of contents:
file testjl/src/testjl.jl:
module testjl
export ff
# Write your package code here.
function ff()
return 1
end
end
file testjl/test/runtests.jl:
using testjl
using Test
ff()
Question: How can I get code-jump working for the function ff within the file testjl/test/runtests.jl ?
+1. This is really needed! @davidanthoff @ZacLN do you know why this is not currently possible, even though https://github.com/julia-vscode/LanguageServer.jl/pull/871 was merged?
Related: https://github.com/julia-vscode/julia-vscode/issues/1740, https://github.com/julia-vscode/julia-vscode/issues/2904.
For example, if you look at the codebase of SymbolicRegression.jl, every single file defines its own module - e.g., the file src/AdaptiveParsimony.jl defines the AdaptiveParsimonyModule which can be imported by other files. This is to make the codebase easier to navigate for potential contributors, since all dependencies are explicit[1]. However, the downside is that Julia VSCode doesn't seem to know where the functions are actually defined.
[1] Aside: I think this should be done by every Julia package, rather than the overpowered namespace mixing include("...") which requires me to search manually for where a function is defined, or to rely on an IDE.
That's a completely unrelated issue.
Wait, do you mean the PR is unrelated, or the other GH issues julia-vscode/julia-vscode#1740 julia-vscode/julia-vscode#2904?
Your case is unrelated to this issue, which is about missing functionality in the test dir. Unless I misunderstood you and symbol resolution works fine in package files even with the one-module-per-file structure and only breaks in the test dir.
Oh, I see what you mean, thanks. Let me open a new issue then.
Hi, @touchft . I don't think it is a bug, since it is unrepeatable in my machine. Maybe you miss the Project.toml file? Can you provide more detail of the repo? Feel free to correct me if I miss something.
- generate package by
PkgTemplatesas mentioned in your comment.
File-tree of the repo:# using Pkg; Pkg.add("PkgTemplates") using PkgTemplates Template(dir=".")("testjl")# tree ├── LICENSE ├── Manifest.toml ├── Project.toml ├── README.md ├── src │ └── testjl.jl └── test └── runtests.jl - rewrite
runtests.jlandtestjl.jlas above, then