Skip to content

Display error for Go files that include backticks #389

Open

Description

@wlbr

Hi ,

your very nice extension unfortunately has a problem in the display of Go files. More detailed: in case of backticks ("`") in the code, that may for example occur in JSON tags or in simple prints, the parser seems to get in a hickup.

Below you'll find a valid example of Go code, that is not correctly display. See the screenshot attached.

package main

import (
	"encoding/json"
	"fmt"
	"log"
)

type User struct {
	Firstname string `json:"firstname"`
	Lastname  string `json:"lastname"`
	Email     string `json:"email"`
}

func (g *User) String() string {
	return fmt.Sprintf(`"%s","%s","%s"`, g.Firstname, g.Lastname, g.Email)
}

func main() {
	log.SetFlags(log.Flags() | log.Lshortfile)

	u := User{"Frodo", "Baggins", "frodo@hobbiton.me"}

	if j, err := json.Marshal(u); err != nil {
		log.Print("Error in marshalling: %s", err)
	} else {
		fmt.Println(string(j))
	}
}

Display by SyntaxHighlight:

image




Additionally: I tried to use gopls as language server instead. Unfortunalety I did not make it work.
Error is

Syntax Highlight: colorize.sh failed with exit code 101. Command was ('/Applications/Syntax Highlight.app/Contents/Resources/highlight/colorize.sh' '/Applications/Syntax Highlight.app/Contents/Resources/examples/example.go'). command: '/Applications/Syntax Highlight.app/Contents/Resources/highlight/colorize.sh' '/Applications/Syntax Highlight.app/Contents/Resources/examples/example.go' exitCode: 101

Maybe it would be best to always use gopls by default, if installed. Every go developer will have it installed. And the syntax of Go might be changing still, at least to a small degree.

Same error occurs when running the cli tool.

Activity

  1. sbarex commented on Nov 19, 2026

    @sbarex
    Owner

    Please report the display error in the rendering engine's repository: Highlight.

    As soon as I can, I’ll look into the issue with gopls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions