If one creates a Julia file and writes some code into it, one would expect all declared variables to be shown in the symbols list on the left. However, this is not the case, for instance in this code here: ``` a::Int8 = 3
function f(x) return 2x end ``` the variable `a` is not shown in the symbols list, but the function `f` is shown. Is this the normal behavior or is it a bug?
The Julia docs say "Currently, type declarations cannot be used in global scope" [here](https://docs.julialang.org/en/v1/manual/types/#Type-Declarations)
So the ctags parser used by Geany is technically correct in not considering it a declaration.
More generally languages with "assignment is declaration" semantics give a simple static parser a problem, how to distinguish an assignment from a "declaration" so as to know when to add a name to the symbols. The writers of the ctags Julia parser seem to have taken the "assignments are not declarations" approach, the writers of the ctags Python parser have taken the other extreme, "every assignment is a declaration", so they all show in the symbols:
``` aaa = 2 aaa = 3 ```
In Python shows two variables in the symbols, in Julia shows none.
OK thanks for the clarification. I just seem to recall the Atom editor listing all variables defined.
Atom probably didn't use the ctags parser, it used [this](https://github.com/julia-vscode/LanguageServer.jl) which is written in Julia, so probably has access to the actual compiler smarts.
Closed #3341 as completed.
A bit late, but only variables defined with the `const` keyword are shown in the list:
```julia const a::Int8 = 3
function f(x) return 2x end ```
Both `a` and `f` would appear.
Currently, global (and local) variable assignment are not identified by ctags (the library that is listing the symbols by type on the left), but it could be improved if there is a need for it (or if somebody wants to do it :D). See the TODO list [here](https://github.com/universal-ctags/ctags/issues/2723)
github-comments@lists.geany.org