Skip to content

gopls doesn't work on Windows with shellslash #3722

Open
@joaodasilva

Description

@joaodasilva

What did you do?

I installed vim-go on Windows 10, using the vim packages install method.

Saving a .go file triggers autoformatting, and that always failed with errors like this:

C:/Users/Joao/go-web-playground/hello/hello.go:JSON RPC parse error: DocumentURI scheme is not 'file': C%3A%2FUsers%2FJoao%2Fgo-web-playground%2Fhello%2Fhello.go

I believe this happens because the code in go#path#ToURI has special logic for Windows that is looking for backslashes, but my vim is using forward slashes on Windows instead.

This turns out to be caused by set shellslash on my .vimrc. Removing that fixes this problem.

However, I really prefer to use forward slashes by default, as I work mostly on WSL (Windows Subsystem for Linux).

I don't know enough vim script to upload a fix, but maybe go#path#ToURI could handle both backward and forward slashes on Windows? :-)

(FWIW, the OS supports both)

vim-go version:

Checkout from HEAD, commit is e6788d1 from June 21st

Vim version (first three lines from :version):

9.1, using GVim on Windows

Go version (go version):

go version go1.24.3 windows/amd64

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