nim.nvim icon indicating copy to clipboard operation
nim.nvim copied to clipboard

nimsuggest instance for project ... stopped with exitcode: 1

Open aabbtree77 opened this issue 5 years ago • 5 comments

I have installed this plugin on my Ubuntu 20.04 machine by adding Plug 'alaviss/nim.nvim' into ./config/nvim/init.vim file, followed by running nvim and :PlugInstall.

The Nim language code becomes now nicely highlighted, but gd, gD do not jump into function definitions.

When I open the file such as nvim gltf.nim inside the cloned repo guzba/gltfviewer, this shows up at the bottom of neovim: nimsuggest instance for project /home/tokyo/gltfviewer/src stopped with exitcode: 1 and when pressing gd/gD: nim.nvim: instance is not running

This is a similar issue reported before and closed (#16), yet it occurs with newer nim/nimsuggest versions, i.e. nimsuggest --version Nim Compiler Version 1.4.0 [Linux: amd64] Compiled at 2020-10-18 Copyright (c) 2006-2020 by Andreas Rumpf

It seems that nimsuggest itself runs fine, i.e. running in the terminal nimsuggest gltf.nim produces the green-colored lines: nimsuggest gltf.nim Hint: used config file '/home/tokyo/.choosenim/toolchains/nim-1.4.0/config/nim.cfg' [Conf] Hint: used config file '/home/tokyo/.choosenim/toolchains/nim-1.4.0/config/config.nims' [Conf] Hint: used config file '/home/tokyo/gltfviewer/config.nims' [Conf] ... So nimsuggest is installed and is visible, yet nim.nvim stops it upon loading somehow.

aabbtree77 avatar Nov 16 '20 12:11 aabbtree77

The message is emitted whenever nimsuggest crashes, which unfortunately happens a lot. A quick way to check is to run the highlighter by typing into nimsuggest:

highlight /path/to/file.nim

alaviss avatar Nov 30 '20 03:11 alaviss

I'm having the same issue and I'm unsure what the problem is. Nimsuggest (including highlight) runs fine from the command line, but crashes repeatedly in nvim. The thing is, it's really inconsistent. Some days it doesn't work at all, other days it works fine (although there haven't been any updates, etc).

Is there a way to get nvim to instruct nimsuggest to emit more information?

nnsee avatar Dec 09 '22 11:12 nnsee

You can add '--log' to extraArgs here: https://github.com/alaviss/nim.nvim/blob/87afde2ae995723e0338e1851c3b3c1cbd81d955/autoload/nim/suggest.vim#L12

Then nimsuggest will write a nimsuggest.log in your home directory.

I'll add a logging function to nim.nvim once I have the time to do so, so you'll have to use this for now.

The thing is, it's really inconsistent. Some days it doesn't work at all, other days it works fine (although there haven't been any updates, etc).

One thing to note is that nimsuggest (or rather, the compiler) state changes as more queries are made against it, so I'm not surprised that there is a weird combination where it would only crash after a set number/combination of queries were made...

And also, the compiler is not very tolerant of broken (ie. incomplete) files and that might cause nimsuggest to crash too.

alaviss avatar Dec 09 '22 18:12 alaviss

I am also facing the same error whenever I open any .nim file:

nimsuggest instance for project stopped with exitcode: 1

firasuke avatar Mar 25 '23 19:03 firasuke

Had the same issue and solved it through choosenim. Many package managers seem to scramble the nim installation and nim can't find its files anymore. So nim tries to find nimsuggest in the wrong directory and you can see that by calling nimble install nimlsp which should error in Error: cannot open file: /usr/nimsuggest/nimsuggest.nim or similar.

In order to solve this issue just install nim like this:

curl https://nim-lang.org/choosenim/init.sh -sSf | sh
choosenim stable

Then run

nimble install nimlsp

(could take a while) And after that this plugin should work perfectly.

Sources: https://github.com/PMunch/nimlsp/issues/67

MrKleeblatt avatar Dec 31 '23 01:12 MrKleeblatt