nim-lang/langserver

How to start ?

AmjadHD opened this issue · 17 comments

After building with Nim 81b7f9108f139bbf237f3e121fdbe9ff32a7193f, I ran the generated exe and got this:

D:\Amjad\langserver>nimlangserver.exe
D:\Amjad\langserver\nimlangserver.nim(858) nimlangserver
C:\Users\User\.nimble\pkgs\asynctools-#non-blocking\asynctools\asyncpipe.nim(191) createPipe
C:\Users\User\.choosenim\toolchains\nim-#devel\lib\std\oserrors.nim(92) raiseOSError
Error: unhandled exception: The system cannot find the path specified.
 [OSError]

D:\Amjad\langserver>

Note: I'm on Windows.

@yyoncho sorry for the ping, ^.

same error. latest nim devel.
nimlsp has related issue PMunch/nimlsp#131

nimlsp at least works (without async on windows)

I've got the same error. Does anyone know which version of Nim this works with? I'm on neovim as well, and have tried using Nim version 1.6, 2.0, and devel. I had the following config working in neovim at some point but I can't remember which versions of langserver and nim I was using:

  config.nim_langserver.setup {
    on_new_config = function(new_config, new_root_dir)
      new_config.rootUri = ([[file://%s]]):format(new_root_dir)
    end,
    root_dir = function(filename)
      return config.util.root_pattern[[*.nimble]](filename) or
        config.util.root_pattern[[config.nims]](filename) or
        config.util.root_pattern[[*.cfg]](filename) or
        config.util.root_pattern[[*.nimcfg]](filename) or
        config.util.root_pattern[[*.nims]](filename) or
        config.util.root_pattern[[.nvim]](filename) or
        config.util.root_pattern[[.git]](filename) or
        config.util.root_pattern[[main.nim]](filename) or
        config.util.root_pattern[[*.nim]](filename)
    end,
    settings = {
      -- We are using null-ls for checking.
      checkOnSave = false,
      autoCheckFile = false,
      autoCheckProject = false,
    },
  }

Should be fixed in 6f25160

veksha commented

still same error for me

Shutting down due to an error: The system cannot find the path specified.

D:\Programm\Nim\langserver\nimlangserver.nim(1024) nimlangserver
D:\Programm\Nim\langserver\nimlangserver.nim(1007) main
C:\Users\yura\.nimble\pkgs\asynctools-#non-blocking\asynctools\asyncpipe.nim(191) createPipe
D:\Programm\Nim\Nim-devel\lib\std\oserrors.nim(92) raiseOSError

C:\Users\yura\.nimble\pkgs\asynctools-#non-blocking\asynctools\asyncpipe.nim(191) createPipe <-- this looks like the old and broken version of asynctools. How are you building the project? You should build it against this version of asynctools: https://github.com/nickysn/asynctools/tree/fixes_for_nimlangserver

veksha commented

i clone repo and do nimble build.
i see the following lines:

...
      Info: Dependency on https://github.com/nickysn/asynctools@#fixes_for_nimlangserver already satisfied
...
      Info: Dependency on unittest2@any version already satisfied
  Verifying dependencies for unittest2@0.0.6
 Installing https://github.com/yyoncho/asynctools@#non-blocking
Downloading https://github.com/yyoncho/asynctools using git
  Verifying dependencies for asynctools@#non-blocking
 Installing asynctools@#non-blocking
   Success: asynctools installed successfully.
...

maybe it's installing both versions and using the last one?

nimble --version
nimble v0.13.1 compiled at 2023-05-06 22:52:57
git hash: 8cf5643621600aaa869935721227fc3b7ee5f881
veksha commented

i think nimble build first gets asynctools#fixes_for_nimlangserver.
then it downloads nim-json-rpc#notif-changes (which downloads wrong version of asynctools) and sets paths for imports.

i swapped lines in .nimble file like this and now it works:

requires "nim >= 1.0.0",
         "https://github.com/yyoncho/nim-json-rpc#notif-changes",
         "https://github.com/nickysn/asynctools#fixes_for_nimlangserver",
         "with",
         "chronicles"

package order matters.
similar issue: #14

now it starts but it doesn't respond to any requests.

veksha commented

@AmjadHD any logs?

nvm, it was fixed by #79

same error

╰─❯ nimlangserver
Shutting down due to an error: The system cannot find the path specified.

oserrors.nim(92)         raiseOSError

error when using mingw:

could not load: pcre64.dll

msvc

Shutting down due to an error: The system cannot find the path specified.

oserrors.nim(92)         raiseOSError
veksha commented

@lost22git @sixwaaaay
make sure your nimble is not outdated like v0.13.1, but newer, something like 0.14.2.

i was having "Shutting down due to an error: The system cannot find the path specified" because nimble was old and it was using old and broken asynctools branch when building nimlangserver.

@lost22git @sixwaaaay make sure your nimble is not outdated like v0.13.1, but newer, something like 0.14.2.

i was having "Shutting down due to an error: The system cannot find the path specified" because nimble was old and it was using old and broken asynctools branch when building nimlangserver.

it still error

 nimlangserver
Shutting down due to an error: The system cannot find the path specified.

oserrors.nim(92)         raiseOSError

╭╴🪟 $psh _config on  main [✘!?]
╰─❯ nimble --version
nimble v0.14.2 compiled at 2023-12-15 01:21:03
git hash: couldn't determine git hash

This has been fixed in the latest release. We also provide binaries, in case you have trouble building from source.