# Is there an IDE that can statically determine undefined variables in function, and auto-complete structs?

**URL:** <https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941>\
**Category:** General Usage\
**Created:** [August 24, 2021, 8:04pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941 "2021-08-24T20:04:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Post date:** [August 24, 2021, 8:04pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/1 "2021-08-24T20:04:17Z")

</div>

For example, suppose I have following code:

```julia
struct Param # used to hold global variables
    n_days::Int
    n_segments::Int
end

function f(a, b, c) 
    d + 1
end

```

I wonder if there is an IDE that can do following:

1. when I create a `Param` object `p = Param(1,2)`, and type `p.`, it should auto-complete its fields (`n_days` and `n_segments`)
2. it should detect that function `f` has an undefined variable `d` inside its body.

I tested Juno and intelliJ plugin for Julia, but both do not seem to have such functionality. I am wondering I did anything wrong, and whether there are other IDEs that can do these things?

Thank you!

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [August 24, 2021, 8:07pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/2 "2021-08-24T20:07:19Z")

</div>

In the REPL you can write `p.` and then press tab, it will autocomplete.

---

<div class="post-metadata">

**Author:** ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Post date:** [August 24, 2021, 8:14pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/4 "2021-08-24T20:14:09Z")

</div>

Thanks for the comment! Right it would auto-complete in REPL, but is it possible to auto-complete it without running it (statically)? Something similar to what PyCharm does to Python…

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [August 24, 2021, 8:16pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/5 "2021-08-24T20:16:29Z")

</div>

Oh, I have no idea, sorry!

---

<div class="post-metadata">

**Author:** ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Post date:** [August 24, 2021, 8:16pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/6 "2021-08-24T20:16:53Z")

</div>

no worries, thanks for your reply!

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [August 24, 2021, 8:19pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/7 "2021-08-24T20:19:33Z")

</div>

Try VS Code with the Julia extension. It can do both of those things.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/3/0338cb894f2909d52b32e81f8d8209344052f78d.png)

---

<div class="post-metadata">

**Author:** ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Post date:** [August 24, 2021, 8:31pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/8 "2021-08-24T20:31:55Z")

</div>

Thanks! I found that my VS code with Julia extension is able to do 1, but not able to do 2 (detect undefined variables):

![Screen Shot 2021-08-24 at 3.30.15 PM](https://global.discourse-cdn.com/julialang/original/3X/1/7/17184bddedb8fa5570e738edb48383abda8647d6.png)

My extension is: Julia (v1.3.32), just wonder if I need to set up something?

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [August 24, 2021, 8:37pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/9 "2021-08-24T20:37:47Z")

</div>

Yeah, there are some settings for the Julia linter that you can play with:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/1/0/10ef819eaeeba1de657be73ffce788ddb4edfb37.png)

![image](https://global.discourse-cdn.com/julialang/original/3X/f/7/f70348808b5292e4c0c2ae9861c40b4917c2df6a.png)

…among others.

---

<div class="post-metadata">

**Author:** ![DiracFermion1](https://avatars.discourse-cdn.com/v4/letter/d/2acd7d/32.png) [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Post date:** [August 24, 2021, 9:15pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/10 "2021-08-24T21:15:47Z")

</div>

Thanks for the information! Looks like Missingrefs does not work for me, did you install any Julia linter to make it work?

---

<div class="post-metadata">

**Author:** ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Post date:** [August 24, 2021, 9:36pm UTC](https://discourse.julialang.org/t/is-there-an-ide-that-can-statically-determine-undefined-variables-in-function-and-auto-complete-structs/66941/11 "2021-08-24T21:36:07Z")

</div>

The linter comes with the Julia extension. Sometimes it takes a few moments for the language server and the linter to kick in. Though I think I have had occasions where the linter doesn’t seem to want to run… Saving the file or restarting VS Code might encourage the linter to run… 😅
