Skip to content

Problem Running in Neovim on Windows with Git BASH #19

@eignnx

Description

@eignnx

I can't get the plugin to run on in Neovim. I'm not sure if me using Window's Git BASH instead of WSL is fundamentally a terrible idea, but here we are.

My system:

$ nvim --version; swipl --version; sh --version
NVIM v0.11.0
Build type: Release
LuaJIT 2.1.1741730670

SWI-Prolog version 9.0.4 for x64-win64

GNU bash, version 5.2.15(1)-release (x86_64-pc-msys)

I followed the instructions under Native LSP (for Neovim >= 0.11) (as of writing this, there seems to be a typo at the end of this section: vim.ls.enable({'prolog'}) ought to be vim.lsp.enable({'prolog'}))

After restarting Neovim and opening a Prolog file I got this message:

Client prolog quit with exit code 2 and signal 0. Check log for errors: C:/Users/REDACTED/AppData/Local/nvim-data/lsp.log

The log file contents:

[START][2025-05-20 14:47:13] LSP logging initiated
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:\r\nWarning:    import/1: prolog_help:help_html/3 is not exported (still imported into lsp_utils)\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:\r\nWarning:    import/1: prolog_help:help_objects/3 is not exported (still imported into lsp_utils)\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:\r\nERROR:    source_sink `library(macros)' does not exist\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:\r\nWarning:    Goal (directive) failed: lsp_formatter:use_module(library(macros))\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:63:1: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:170:22: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:253:20: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"% Starting stdio client\r\n"
[ERROR][2025-05-20 14:47:13] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: -g lsp_server:main: Domain error: `waitable_stream' expected, found `user_input'\r\nERROR: In:\r\nERROR:   [15] wait_for_input([user_input],_182,infinite)\r\nERROR:   [14] lsp_server:client_handler(_234-_236,user_input,user_output) at c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_server.pl:101\r\nERROR:    [9] catch(lsp_server:main,error(domain_error(waitable_stream,user_input),context(...,_294)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:565\r\nERROR:    [8] catch_with_backtrace(lsp_server:main,error(domain_error(waitable_stream,user_input),context(...,_358)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:645\r\nERROR: \r\nERROR: Note: some frames are missing due to last-call optimization.\r\nERROR: Re-run your program in debug mode (:- debug.) to get more detail.\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:\r\nWarning:    import/1: prolog_help:help_html/3 is not exported (still imported into lsp_utils)\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:\r\nWarning:    import/1: prolog_help:help_objects/3 is not exported (still imported into lsp_utils)\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:\r\nERROR:    source_sink `library(macros)' does not exist\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:\r\nWarning:    Goal (directive) failed: lsp_formatter:use_module(library(macros))\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:63:1: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:170:22: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:253:20: Syntax error: Operator expected\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"% Starting stdio client\r\n"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"ERROR: -g lsp_server:main: Domain error: `waitable_stream' expected, found `user_input'\r\nERROR: In:\r\nERROR:   [15] wait_for_input([user_input],_182,infinite)\r\nERROR:   [14] lsp_server:client_handler(_234-_236,user_input,user_output) at c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_server.pl:101\r\nERROR:    [9] catch(lsp_server:main,error(domain_error(waitable_stream,user_input),context(...,_294)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:565\r\nERROR:    [8] catch_with_backt"
[ERROR][2025-05-20 14:55:20] ...p/_transport.lua:36	"rpc"	"swipl"	"stderr"	"race(lsp_server:main,error(domain_error(waitable_stream,user_input),context(...,_358)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:645\r\nERROR: \r\nERROR: Note: some frames are missing due to last-call optimization.\r\nERROR: Re-run your program in debug mode (:- debug.) to get more detail.\r\n"

If I try running the lsp start command from the shell directly I get this error:

$ swipl -g 'use_module(library(lsp_server))' -g lsp_server:main -t halt -- stdio
Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:
Warning:    import/1: prolog_help:help_html/3 is not exported (still imported into lsp_utils)
Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_utils.pl:23:
Warning:    import/1: prolog_help:help_objects/3 is not exported (still imported into lsp_utils)
ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:
ERROR:    source_sink `library(macros)' does not exist
Warning: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:13:
Warning:    Goal (directive) failed: lsp_formatter:use_module(library(macros))
ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:63:1: Syntax error: Operator expected
ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:170:22: Syntax error: Operator expected
ERROR: c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_formatter.pl:253:20: Syntax error: Operator expected
% Starting stdio client
ERROR: -g lsp_server:main: No permission to encoding stream `user_input'
ERROR: In:
ERROR:   [14] set_stream(user_input,encoding(octet))
ERROR:   [13] lsp_server:handle_requests_stream(<stream>(00007ff811b54560,00007ff811b54660)) at c:/users/REDACTED/appdata/local/swi-prolog/pack/lsp_server/prolog/lsp_server.pl:96
ERROR:    [9] catch(lsp_server:main,error(permission_error(encoding,stream,user_input),context(...,_286)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:565
ERROR:    [8] catch_with_backtrace(lsp_server:main,error(permission_error(encoding,stream,user_input),context(...,_352)),'$toplevel':true) at c:/program files/swipl/boot/init.pl:645
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.

That error mentions a permission error so I re-ran the command in a new terminal window opened as Administrator and got the same result unfortunately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions