# Julia Vscode new version issue with JuMP

**URL:** <https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump, suggestions, vscode\
**Created:** [July 15, 2020, 3:47pm UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134 "2020-07-15T15:47:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![afazevedo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/afazevedo/32/16394_2.png) [@afazevedo](https://discourse.julialang.org/u/afazevedo)\
**Post date:** [July 15, 2020, 3:47pm UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134/1 "2020-07-15T15:47:33Z")

</div>

I’m having a problem with SparsesAxisArray JuMP on Julia for Vscode.  
When I use `@variable` with this condition below, it reproduces an error

```julia
using Gurobi, JuMP

model = Model(Gurobi.Optimizer) 

n = 5
V = 1:n
V0= 1:n+1

@variable(model, x[i in V0, j in V; i != j], Bin) #this not work

```

Defines: JuMP.Containers.SparseAxisArray{VariableRef,2,Tuple{Int64,Int64}} with 25 entries:  
but in the end, reproduces:

```julia
Internal Error: ERROR: MethodError: no method matching size(::JuMP.Containers.SparseAxisArray{VariableRef,2,Tuple{Int64,Int64}})
Closest candidates are:
  size(::AbstractArray{T,N}, ::Any) where {T, N} at abstractarray.jl:38
  size(::BitArray{1}) at bitarray.jl:99
  size(::BitArray{1}, ::Integer) at bitarray.jl:103

```

I figured out that if i return to previous version 0.15.40 of Julia package on Vscode, this code works perfectly. Any suggestions?

Thanks in advance!

---

<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 15, 2020, 4:10pm UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134/2 "2020-07-15T16:10:24Z")

</div>

I’d argue this is a bug in JuMP, because

```julia
julia> @variable(model, x[i in V0, j in V; i != j], Bin) isa AbstractArray
true

```

and `size` is part of the [`AbstractArray` interface](https://docs.julialang.org/en/v1/manual/interfaces/#man-interface-array-1).

That said, showing those internal errors makes the REPL kinda unusable, so we’ll stop doing that in the extension.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [July 15, 2020, 4:34pm UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134/3 "2020-07-15T16:34:13Z")

</div>

There is an open issue for `size`: [https://github.com/jump-dev/JuMP.jl/issues/2117](https://github.com/jump-dev/JuMP.jl/issues/2117)

We need to spend some time re-thinking the functionality of the `SparseAxisArray`, because it is partially an array, and partially a dictionary.

---

<div class="post-metadata">

**Author:** ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)\
**Post date:** [July 17, 2020, 10:07am UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134/4 "2020-07-17T10:07:00Z")

</div>

I don’t understand where the error comes from. Why do you need to call `size` in your example ?

@pfitzseb We could implement `size` and `axis` for `SparseAxisArray` but that would require a little bit of bookkeeping and we have no convincing use case yet. Accessing it with the `axis` would not be a good idea anyway since it is sparse hence one should not go through the cartesian product of the axis.

---

<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 17, 2020, 10:35am UTC](https://discourse.julialang.org/t/julia-vscode-new-version-issue-with-jump/43134/5 "2020-07-17T10:35:05Z")

</div>

The error comes from VSCode trying to display that object as an `AbstractArray` by showing its contents in a tree view like this:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/9/f95649fe3744dd2c6653b022c6d80c063e52cbbe.png)

Also see [Stop showing user errors for workspace in REPL · Issue #1491 · julia-vscode/julia-vscode · GitHub](https://github.com/julia-vscode/julia-vscode/issues/1491).
