PMunch / nimlsp

Language Server Protocol implementation for Nim
MIT License
418 stars 49 forks source link

nimlsp crashes on files that import both cligen and threadpool modules #86

Open xkqqkx opened 3 years ago

xkqqkx commented 3 years ago

nimlsp crashes when opening file that imports cligen and threadpool modules. Without threadpool import it works fine. On CentOS 7, nim 1.4.8 and neovim 0.5.0 builtin lsp client.

the message was

nimsuggest instance for project /home/user/tmp stopped with exitcode: 1

Small example to reproduce the issue:

import threadpool
import cligen

proc f1(s: string) =
  echo s

proc f2(s: string) =
  echo s

when isMainModule:
  dispatchMulti([f1], [f2])
xkqqkx commented 3 years ago

solved by adding project configuration file with --threads:on directive

PMunch commented 3 years ago

Ah yes, for NimLSP to work it needs to be able to build the project. This means that any switches that you pass on compile-time should be put in a configuration file so NimLSP can find them. This should have a better failure mode though, with a better error message, so that it's obvious to the user what they need to do. I'll keep this issue open as a reminder.