# VS Code IntelliSense issues

**URL:** <https://discourse.julialang.org/t/vs-code-intellisense-issues/8437>\
**Category:** General Usage\
**Tags:** question, vscode\
**Created:** [January 17, 2018, 5:39pm UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437 "2018-01-17T17:39:26Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![julbinb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julbinb/32/3079_2.png) [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Post date:** [January 17, 2018, 5:39pm UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/1 "2018-01-17T17:39:26Z")

</div>

[VS Code extension for Julia](https://github.com/JuliaEditorSupport/julia-vscode) provides some nice static checks, e.g. it hints “possibly undeclared variable”, and also allows going to definition. But it seems to work only within one file. Even if I have `include`, definitions from the included file are not visible. So I got hundreds of “possibly undeclared” variables, which is very annoying.

Is there any workaround for this? Can I make VS Code search definitions in included files, or even better in the whole workspace? If follow the standard package structure, you end up with multiple files that are to be included in one “main” file, and, therefore, these files are not valid on their own.

P.S. There is a “go to symbol in workspace” function, but it doesn’t solve the problem with undeclared variables.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 17, 2018, 6:03pm UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/2 "2018-01-17T18:03:18Z")

</div>

`include`’s usually work fine for me. It is important that the includes are “simple” in the sense that they are just `"include("folder/file.jl")`. More “dynamic” includes like `include(joinpath("folder", "file.jl"))` will, right now, not work.

---

<div class="post-metadata">

**Author:** ![julbinb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julbinb/32/3079_2.png) [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Post date:** [January 18, 2018, 10:13am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/3 "2018-01-18T10:13:23Z")

</div>

Ah, I see: `include`s are processed fine if they contain plain code, without modules. Definitions inside modules, however, cannot be found.

---

<div class="post-metadata">

**Author:** ![julbinb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julbinb/32/3079_2.png) [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Post date:** [January 18, 2018, 10:17am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/4 "2018-01-18T10:17:06Z")

</div>

I think it would be nice to have something like project file for Julia. Or maybe even consider some julia file as a project file. As packages usually have one main file, which has a bunch of `include`s, it could be used to deduce the order in which files’ contents should be analyzed.

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 18, 2018, 10:21am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/5 "2018-01-18T10:21:17Z")

</div>

> [@julbinb](#):
>
> Ah, I see: includes are processed fine if they contain plain code, without modules. Definitions inside modules, however, cannot be found

If you define a new module inside a file and include that file, you need to explicitly import the variables in that module to get access to them. So perhaps this is not a vscode error?

> [@julbinb](#):
>
> I think it would be nice to have something like project file for Julia. Or maybe even consider some julia file as a project file. As packages usually have one main file, which has a bunch of includes, it could be used to deduce the order in which files’ contents should be analyzed.

That is in fact how it (should) work. For a package, Package.jl, the src/Package.jl file is considered the “top file” and from there, includes are processed.

---

<div class="post-metadata">

**Author:** ![julbinb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julbinb/32/3079_2.png) [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Post date:** [January 18, 2018, 10:32am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/6 "2018-01-18T10:32:08Z")

</div>

> [@kristoffer.carlsson](#):
>
> If you define a new module inside a file and include that file, you need to explicitly import the variables in that module to get access to them. So perhaps this is not a vscode error?

I have `export`s in the included module and `using` in the file that includes. Here is an example.

`file1.jl`

```julia
module GraphAux

export Vertex

struct Vertex{T}
    data :: T
end

end

```

`file2.jl`

```julia
include("file1.jl")

using GraphAux

struct Graph{T}
    vertices :: Vector{Vertex{T}}
    
end

```

VS Code cannot find the definition of `Vertex` in `file2.jl`.

Do I need to specify some workspace settings maybe?

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [January 18, 2018, 11:04am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/7 "2018-01-18T11:04:57Z")

</div>

Interesting, if I do `import GraphAux: Vertex` it can find it. This seems like a bug in LanguageServer.jl.

---

<div class="post-metadata">

**Author:** ![ZacLN](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zacln/32/2748_2.png) [@ZacLN](https://discourse.julialang.org/u/ZacLN)\
**Post date:** [January 18, 2018, 11:21am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/8 "2018-01-18T11:21:56Z")

</div>

Hi all,  
There are issues w/ scoping and variables exported from user defined modules, they’ve not worked for a while but will be fixed when `StaticLint` gets integrated (next `vscode` release)

---

<div class="post-metadata">

**Author:** ![julbinb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/julbinb/32/3079_2.png) [@julbinb](https://discourse.julialang.org/u/julbinb)\
**Post date:** [January 18, 2018, 3:10pm UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/9 "2018-01-18T15:10:42Z")

</div>

Ah, sounds promising, thank you!

And as for the package structure: when I edit a source file `file3.jl` that is included into a “top file” of a package but does not include anything itself, would the VS Code look for definitions from files `file1.jl` and `file2.jl` included into the top file before `file3.jl`?

---

<div class="post-metadata">

**Author:** ![SamBrand](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SamBrand](https://discourse.julialang.org/u/SamBrand)\
**Post date:** [July 22, 2020, 9:54am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/10 "2020-07-22T09:54:42Z")

</div>

Hi all,

I have a (possibly related) issue with VS code intellisense. I’m only just transitioning from Juno/Atom into Julia\_extension/VSCode, and still getting used to it.

When I create some kind of data structure in Julia, e.g. load a CSV file as a dataframe or create a NamedTuple, I don’t get a list of fields upon using “.”.

Example:

df = DataFrame!(CSV.File(“data/mydatafile.csv”))

In Juno “df.” automatically gives a list of column headings to choose from, but Julia\_extension to VScode isn’t doing this. Is this a configuration problem?

I’m using Julia 1.3 on a Mac OSX 10.15.

---

<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 22, 2020, 11:10am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/11 "2020-07-22T11:10:56Z")

</div>

> [@SamBrand](#):
>
> Is this a configuration problem?

No, simply not implemented yet. [#1507](https://github.com/julia-vscode/julia-vscode/pull/1507) will fix it though.

---

<div class="post-metadata">

**Author:** ![SamBrand](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@SamBrand](https://discourse.julialang.org/u/SamBrand)\
**Post date:** [July 22, 2020, 11:17am UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/12 "2020-07-22T11:17:59Z")

</div>

Thanks for the very swift reply.

Wish I was more skilled and could pitch in! But I’m a scientist who is loving Julia as a tool rather than a skilled code craftsman.

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [September 23, 2021, 7:23pm UTC](https://discourse.julialang.org/t/vs-code-intellisense-issues/8437/13 "2021-09-23T19:23:05Z")

</div>

FWIW, I noticed issues like this (undeclared and missing type definitions) after doing some code reorganization by moving type declarations into separate file. I was using Revise and tests kept working fine in my active session (🎉), but vscode-julia intellisense added many squigglies. Restarting VSCode fixed these, so I suppose there was some language server cache which did not clear until the restart.
