You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've opened an issue on NeoVim repository, and I was directed to open an issue here.
The same issue also exists on Vim. Vim ./runtime/syntax/go.vim is (allegedly) up-to-date with vim-go, but I don't know how to verify that since injecting the go.vim file from vim-go into vim repository causes errors. I assume Vim does some kind of transformations on it?
Anyways, here's the details of the issue:
The following Go snippet breaks syntax highlighting in Vim:
package main
var (
hoststringusagestring=""+"\"\""
)
funcmain() {}
This can be reproduced in a Docker container by downloading the latest nightly Vim AppImage:
FROM ubuntu:24.04
RUN apt-get -y update && apt-get -y install curl
WORKDIR /app
RUN curl -LO https://github.com/vim/vim-appimage/releases/download/v9.1.1106/Vim-v9.1.1106.glibc2.29-x86_64.AppImage
RUN chmod u+x Vim-v9.1.1106.glibc2.29-x86_64.AppImage
RUN ./Vim-v9.1.1106.glibc2.29-x86_64.AppImage --appimage-extract
RUN echo 'package main' >> main.go
RUN echo '' >> main.go
RUN echo 'var (' >> main.go
RUN echo ' host string' >> main.go
RUN echo ' usage string = "" +' >> main.go
RUN echo ' "\"\""' >> main.go
RUN echo ')' >> main.go
RUN echo '' >> main.go
RUN echo 'func main() {}' >> main.go
CMD ["/app/squashfs-root/AppRun", "main.go"]
Running docker build . -t test && docker run --rm -it test shows the following screen:
The statement func main() {} and everything after it is completely devoid of syntax highlighting.
The text was updated successfully, but these errors were encountered:
That's interesting. Strangely, there are no syntax highlighting problems if this is done without using a var or const block.
bhcleek
changed the title
Vim: Adding strings in multiple lines in var statement breaks Go syntax highlighting
Vim: Adding strings in multiple lines in var or const block statement breaks Go syntax highlighting
Mar 10, 2025
bhcleek
changed the title
Vim: Adding strings in multiple lines in var or const block statement breaks Go syntax highlighting
adding strings in multiple lines in var or const block statement breaks Go syntax highlighting
Mar 10, 2025
I've opened an issue on NeoVim repository, and I was directed to open an issue here.
The same issue also exists on Vim. Vim
./runtime/syntax/go.vim
is (allegedly) up-to-date withvim-go
, but I don't know how to verify that since injecting thego.vim
file fromvim-go
intovim
repository causes errors. I assume Vim does some kind of transformations on it?Anyways, here's the details of the issue:
The following Go snippet breaks syntax highlighting in Vim:
This can be reproduced in a Docker container by downloading the latest nightly Vim AppImage:
Running
docker build . -t test && docker run --rm -it test
shows the following screen:The statement
func main() {}
and everything after it is completely devoid of syntax highlighting.The text was updated successfully, but these errors were encountered: