I recently discovered that autocomplete (and more generally IntelliSense) works for some people, and that makes me very frustrated For me it only works with Base and Core, not even standard library stuff like LinearAlgebra. EDIT: see this reply for the real question.
I’m on macOS Ventura with the latest version of Julia and VSCode. I did wait until IntelliSense finished loading.
You’re right, I should put it in my project. For LinearAlgebra that does seem to fix it, but I recall more sophisticated setups where this still failed. Will try to cook up an MWE
Let’s say I’m developing a package called MyPackage and I have activated its Project.toml. It has one dependency called MyDependency, and one test depency called MyTestDependency.
After some exploration, it seems that IntelliSense…
works for MyDependency if either one of the following conditions is satisfied
there is a using MyDependency statement at the top of my file
my file is in src/ and included in the module MyPackage (which also contains the using MyDependency statement)
Also - I tried both methods for test (extras + targets and dedicated test project inside the test directory). IntelliSense doesn’t work for any of my test-specific dependencies - or for the package I am writing the tests for.
It’s pretty cumbersome to write tests for functions with multiple parameters (I always need to lookup repeatedly my source code).
P.S. I am somehow surprised that there are not many/more questions/complaints related to this issue. Or maybe not many devs are having the problem, and there are good ways to fix this.
I don’t think it’s fair to say that the extension is poorly maintained. I have had several interactions with @davidanthoff and @pfitzseb and they all resulted in my problems being fixed.
I think there is room for improvement, the current team is too small and due to a lack of developer documentation it is very hard to attract new developers…
this should work if you are editing source files of MyPackage (i.e. code that are within module MyPackage ... end). For editing test/* files, or any other file in the repo not included in the module, this is LanguageServer.jl#988.
And
I think would be much easier to solve once we have sub projects.
If I include("../src/MyPackage.jl") at the top of runtests.jl I get IntelliSense in my test files (I remove the include statement before a test run and undo it right after the test is finished).
This is still less work then constantly switching between test and src files.
The MyTestDependency intelliSense is not solved by this workaround.
It includes the code of MyPackage.jl when the language server is looking at this file and otherwise, during normal execution or testing it does not include anything.
The issue I think you’re running into is that intellisense is broken (well, intentionally disabled because it’s broken) for the /tests directory in particular.
You can probably work around that by having a complete Manifest inside of /tests that devs the package and explicitly contains test-only dependencies (but you might also need to then rename the dir). If you don’t have any test-only deps, then including the packages entrypoint should work fine, as pointed out earlier.