williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

nimls install fails #444

Closed blakat360 closed 2 years ago

blakat360 commented 2 years ago

Problem description

I want to install nimls but the installation fails

Neovim version (>= 0.6)

NVIM v0.6.0 Build type: Release LuaJIT 2.0.5 Compiled by builduser

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system/version

Linux manjaro 5.4.169-1-MANJARO #1 SMP PREEMPT x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

nimls

Actual behavior

:lspinstallinfo

/nimls i


i get an install failure (documented below)

Expected behavior

I would expect successful installation

LspInstallInfo output

◍ nimls (failed)
        Cloning into '.'...
           Warning: Using project local deps mode
          Verifying dependencies for nimlsp@0.3.2
            Prompt: No local packages.json found, download it from internet? -> [forced yes]
        Downloading Official package list
            Success Package list downloaded.
         Installing jsonschema@>= 0.2.1
        Downloading https://github.com/PMunch/jsonschema using git
          Verifying dependencies for jsonschema@0.2.1
         Installing ast_pattern_matching@any version
        Downloading https://github.com/krux02/ast-pattern-matching using git
          Verifying dependencies for ast_pattern_matching@1.0.0
         Installing ast_pattern_matching@1.0.0
           Success: ast_pattern_matching installed successfully.
         Installing jsonschema@0.2.1
           Success: jsonschema installed successfully.
           Building nimlsp/nimlsp using c backend
        [1m/home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/src/nimlsppkg/suggestlib.nim(11, 8) [0mtemplate/generic instantiation of `mImport` from here[0m
        [1m/home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/src/nimlsppkg/suggestlib.nim(7, 14) [0m[31mError: [0mcannot open file: /usr/nimsuggest/nimsuggest.nim[36m[0m
               Tip: 17 messages have been suppressed, use --verbose to show them.
             Error: Build failed for package: nimlsp
                ... Execution failed with exit code 1
                ... Command: /usr/bin/nim c --colors:on --noNimblePath -d:NimblePkgVersion=0.3.2 --path:/home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/nimbledeps/pkgs/ast_pattern_matching-1.0.0 --path:/home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/nimbledeps/pkgs/jsonschema-0.2.1 --hints:off -o:/home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/nimlsp /home/someuser/.local/share/nvim/lsp_servers/nimls.tmp/src/nimlsp.nim

Installation log

[INFO  Mon 24 Jan 2022 06:19:11 GMT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:644: Starting install server_name="nimls", requested_version=""
[INFO  Mon 24 Jan 2022 06:19:16 GMT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:663: Installation completed server_name="nimls", success=false

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - OK: **tar**: `tar (GNU tar) 1.34`
  - OK: **gzip**: `gzip 1.11`
  - OK: **curl**: `curl 7.80.0 (x86_64-pc-linux-gnu) libcurl/7.80.0 OpenSSL/1.1.1m zlib/1.2.11 brotli/1.0.9 zstd/1.5.1 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.46.0`
  - OK: **wget**: `GNU Wget 1.21.2 built on linux-gnu.`
  - OK: **python3**: `Python 3.10.1`
  - OK: **node**: `v17.3.0`
  - OK: **PHP**: `PHP 8.0.14 (cli) (built: Dec 17 2021 14:16:47) ( NTS )`
  - OK: **Ruby**: `ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]`
  - OK: **Go**: `go version go1.17.5 linux/amd64`
  - OK: **bash**: `GNU bash, version 5.1.12(1)-release (x86_64-pc-linux-gnu)`
  - OK: **sh**: `Ok`
  - OK: **julia**: `julia version 1.7.1`
  - OK: **Composer**: `Composer version 2.2.1 2021-12-22 22:21:31`
  - OK: **RubyGem**: `3.2.29`
  - OK: **java**: `Ok`
  - OK: **npm**: `8.3.0`
  - OK: **javac**: `javac 11.0.13`
  - OK: **pip3**: `pip 20.3.4 from /usr/lib/python3.10/site-packages/pip (python 3.10)`

Screenshots

No response

williamboman commented 2 years ago

Hello! In order to build the nimlsp, you need to have nimsuggest installed. They go into more details in their README. I'm not familiar with Nim myself, but I remember reading that they recommended using choosenim to install nim, as it will include all useful nim sources.

blakat360 commented 2 years ago

I already have nimsuggest installed.

% nimsuggest --version
Nim Compiler Version 1.4.8 [Linux: amd64]
Compiled at 2021-06-07
Copyright (c) 2006-2021 by Andreas Rumpf

active boot switches: -d:release -d:danger --gc:markAndSweep
williamboman commented 2 years ago

Ah ok, hmm interesting. It seems like it assumes that nimsuggest exists at ../../nimsuggest/nimsuggest.nim, relative to the path of the nim executable. Not sure why, but I guess that's the structure in which choosenim installs things. What does the following produce:

% which nim
% which nimsuggest
blakat360 commented 2 years ago
% which nim                                                                                                                                                                                                                                                                   
/usr/bin/nim
% which nimsuggest                                                                                                                                                                                                                                                             
/usr/bin/nimsuggest
blakat360 commented 2 years ago

I uninstalled nim and re-installed with choosenim. I now get this and the server installs.

% which nim       
~/.nimble/bin/nim
% which nimsuggest 
~/.nimble/bin/nimsuggest

However... vim doesn't seem to detect the nim file type which means that the lsp doesn't attach and when I have the list of possible LSPs it doesn't suggest nimls :(

edit 1: :set filetype=nim makes the lsp autoattach - however there is no syntax highlighting :(

williamboman commented 2 years ago

:set filetype=nim makes the lsp autoattach - however there is no syntax highlighting :(

Yeah it'll only start when it finds buffers with the nim filetype. I would assume that neovim had builtin detection for nim files, but apparently not. You can always add the following to your config:

autocmd BufRead,BufReadPost,BufNewFile *.nim set filetype=nim

As for syntax, I assume you're using treesitter for syntax highlighting. I don't believe there's a treesitter grammar for Nim. Maybe you can find some luck with https://github.com/zah/nim.vim?