# For which packages does VSCode autocomplete work?

**URL:** <https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360>\
**Category:** VS Code\
**Tags:** intellisense, autocomplete\
**Created:** [July 8, 2023, 7:17pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360 "2023-07-08T19:17:45Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 7:17pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/1 "2023-07-08T19:17:45Z")

</div>

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](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/4) for the real question.

I’m on macOS Ventura with the latest version of Julia and VSCode. I did wait until IntelliSense finished loading.

Related GitHub issues:

- [Autocomplete for non-built-in packages? · Issue #1885 · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/issues/1885) (was closed but probably shouldn’t have been?)
- [Go to definition not working for packages · Issue #2339 · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/issues/2339)

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 8, 2023, 7:47pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/2 "2023-07-08T19:47:59Z")

</div>

Is LinearAlgebra in your project?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 8:00pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/3 "2023-07-08T20:00:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 8, 2023, 8:27pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/4 "2023-07-08T20:27:24Z")

</div>

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
  1. there is a `using MyDependency` statement at the top of my file
  2. my file is in `src/` and `include`d in the module `MyPackage` (which also contains the `using MyDependency` statement)

- never works for `MyTestDependency`
- never works for `MyPackage`

Did I get that right?

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 9, 2023, 2:59am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/5 "2023-07-09T02:59:21Z")

</div>

You are describing my exact experience.

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.

---

<div class="post-metadata">

**Author:** ![xgdgsc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xgdgsc/32/608_2.png) [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Post date:** [July 9, 2023, 3:37am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/6 "2023-07-09T03:37:49Z")

</div>

The vscode extension definitely needs some more dedicated dev work as the [Is it maintained?](https://isitmaintained.com/project/julia-vscode/julia-vscode) shows.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 9, 2023, 4:46am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/7 "2023-07-09T04:46:14Z")

</div>

The question is, how could better maintenance of the extension be achieved? Is see three options:

- make it more accessible for new developers
- get commercial funding
- perhaps a crowd funding campaign?

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 9, 2023, 6:10am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/8 "2023-07-09T06:10:52Z")

</div>

> [@xgdgsc](#):
>
> The vscode extension definitely needs some more dedicated dev work as the [Is it maintained?](https://isitmaintained.com/project/julia-vscode/julia-vscode) shows.

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.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 9, 2023, 6:24am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/9 "2023-07-09T06:24:27Z")

</div>

Well, there are 834 open issues, and a key issue (from my point of view) [https://github.com/julia-vscode/julia-vscode/issues/307](https://github.com/julia-vscode/julia-vscode/issues/307) is now open since 2017 …

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…

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 9, 2023, 7:15am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/10 "2023-07-09T07:15:16Z")

</div>

Additional finding: If you use `includet <file.jl>` because you are using Revise autocomplete fails, but the following workaround works for me:

```julia
if isdefined(@ __MODULE__ ,:LanguageServer)
    include("tests.jl")
else
    includet("tests.jl")
end

```

---

<div class="post-metadata">

**Author:** ![fredrikekre](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fredrikekre/32/1688_2.png) [@fredrikekre](https://discourse.julialang.org/u/fredrikekre)\
**Post date:** [July 9, 2023, 7:42am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/11 "2023-07-09T07:42:11Z")

</div>

> [@gdalle](#):
>
> Did I get that right?

Yea, that is how things are at the moment.

Regarding

> [@gdalle](#):
>
> never works for `MyPackage`

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](https://github.com/julia-vscode/LanguageServer.jl/issues/988).

And

> [@gdalle](#):
>
> never works for `MyTestDependency`

I think would be much easier to solve once we have [sub projects](https://github.com/JuliaLang/Pkg.jl/issues/1233).

---

<div class="post-metadata">

**Author:** ![xgdgsc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xgdgsc/32/608_2.png) [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Post date:** [July 9, 2023, 8:42am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/12 "2023-07-09T08:42:54Z")

</div>

From list of my PRs [Pull requests · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/pulls/xgdgsc) . It’ s understandable some are design choices. But I don’ t get it why simple [translation](https://github.com/julia-vscode/julia-vscode/pull/3074) and [bugfix](https://github.com/julia-vscode/julia-vscode/pull/3139) are not yet merged.

I think 1.9 is a great release. While the vscode extension experience kind of makes new comers suspicious of the maturity of the language.

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 9, 2023, 10:27am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/13 "2023-07-09T10:27:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 9, 2023, 11:57am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/14 "2023-07-09T11:57:30Z")

</div>

Did you try:

```julia
if isdefined(@ __MODULE__ ,:LanguageServer)
    include(../src/MyPackage.jl)
end

```

---

<div class="post-metadata">

**Author:** ![algunion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/algunion/32/51630_2.png) [@algunion](https://discourse.julialang.org/u/algunion)\
**Post date:** [July 9, 2023, 3:53pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/15 "2023-07-09T15:53:03Z")

</div>

Thanks - this solves the autocompletion for the tested package.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 10, 2023, 9:40am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/16 "2023-07-10T09:40:24Z")

</div>

> [@ufechner7](#):
>
> ```julia
> if isdefined(@ __MODULE__ ,:LanguageServer)
> include(../src/MyPackage.jl)
> end
> 
> ```

Can you explain what this does?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [July 10, 2023, 10:04am UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/17 "2023-07-10T10:04:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 11, 2023, 2:53pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/18 "2023-07-11T14:53:35Z")

</div>

I’m reasonably sure you can just write this as

```julia
false && include("tests.jl")
includet("tests.jl")

```

Of course that won’t work in package code, but you shouldn’t be using Revise there anyways.

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [July 11, 2023, 3:03pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/19 "2023-07-11T15:03:18Z")

</div>

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 `dev`s 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.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 11, 2023, 7:08pm UTC](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360/20 "2023-07-11T19:08:22Z")

</div>

Wait so should I include `runtests.jl` in `MyPackage.jl` or the other way around?

[Next page](https://discourse.julialang.org/t/for-which-packages-does-vscode-autocomplete-work/101360.md?page=2)
