nim-lang/langserver

Language Server on VSC does not refresh autocompletions correctly between files when opening and working on multiple at the same time

Yu-Vitaqua-fer-Chronos opened this issue · 2 comments

Information

I'm using Nim with the commit hash 684a862526847c39597e345d00b8323353012c07 from the develop branch and i've compiled the language server so i could use it with the Nimsaem extension. My exact Nim compiler info is here:

Nim Compiler Version 1.7.3 [Linux: amd64]
Compiled at 2022-10-24
Copyright (c) 2006-2022 by Andreas Rumpf

git hash: 684a862526847c39597e345d00b8323353012c07
active boot switches: -d:release

I compiled nimble install --legacy:laxEffects --define:release the lang server with this command. nimble install --legacy:laxEffects --define:release

This is my .vscode/settings.json file for the project:

{
    "nim.projectMapping": {
        "projectPath": "main.nim",
        "fileRegex": ".*\\.nim"
    }
}

To Reproduce My Bug

To reproduce my error, use the develop branch of Nim, the latest commit of this repo, and run that command. Then in visual studio code, create two files, with one using a type/method from another. For the imported file, add

# b.nim
type HelloWorld* = object
  msh*: string

then import it in the other file and use it as such:

# a.nim
import b

var helloWorld = HelloWorld()
helloWorld.msh = "Wow"

At this stage, you should get no errors. To reproduce my issue, rename msh in the HelloWorld type definition to msg, and in a.nim, change helloWorld.msh to helloWorld.msg. You will then get an error complaining about how it doesn't exist. A 'fix' for this is to edit b.nim by adding a character and deleting it, which refreshes the project, but editing a.nim will cause the error to reappear.

I will take a look. Meanwhile using Source actions -> Clean rebuild should fix that issue.

Ah thank you for the quick response!