saem / vscode-nim

Other
180 stars 23 forks source link

Nim 2.0: default values for object fields #129

Closed anderflash closed 10 months ago

anderflash commented 10 months ago
type
  Circle = object
    radius: float = 1.0 # Nim 2.0 adds default values for object fields at construction

when isMainModule:
  var circle = Circle()
  echo circle.radius

The extension is complaining, although it's a correct code for 2.0: "Error: initialization not allowed here"

RSDuck commented 10 months ago

probably either a nim check issue or one in your setup. Try running nim check yourfile.nim to see whether the name error appears.

anderflash commented 10 months ago

I have nimble (v2.0) and Archlinux nim package (v1.6). It seems that /usr/bin/nim was being used. So I removed the Archlinux package and kept only local nimble installation. The syntax highlighting doesn't complain anymore, but I don't get no hover interaction, no goto definition. It seems that it's related to #97 and #102. If I show the developer console on vs code, I get: nimex_error

If I run on bash:

$ nimsuggest --epc --v2 animation.nim
44233

However, the error persists.

anderflash commented 10 months ago

In that case, I'll close this issue, and perhaps re-post my last comment into the proper issue. Thanks!