gleam-lang / vscode-gleam

📟 Gleam support for VS Code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent syntax highlighting for GitHub and VSCode

joeykilpatrick opened this issue · comments

My understanding is that this repo also powers the syntax highlighting for GitHub since github-linguist/linguist points here.

Lots of files in gleam-lang/stdlib do not highlight properly on GitHub (example, example, example). Here's a small demo:

import gleam/result
import gleam/int
import gleam/list
import gleam/map.{type Map}
import gleam/option.{type Option, None, Some}
import gleam/order

// Internal private representation of an Iterator
type Action(element) {
  // Dedicated to Electric Six
  // https://youtu.be/_30t2dzEgiw?t=162
  Stop
  Continue(element, fn() -> Action(element))
}

/// Traverse an iterator, calling a function on each element.
///
/// ```gleam
/// > from_list(["Tom", "Malory", "Louis"]) |> each(io.println)
/// // -> Tom
/// // -> Malory
/// // -> Louis
/// Nil
/// ```
///

pub fn yield(element: a, next: fn() -> Iterator(a)) -> Iterator(a) {
  Iterator(fn() { Continue(element, next().continuation) })
}

In every example, the issue seems to be related to the import a/b.{type c} syntax.

A similar (though less severe) issue for the Dart language seems related. It's unclear if this is a bug in this repo, in GitHub's highlighting, or in VSCode's highlighting.

Hello! This repo is not used by GitHub for their syntax highlighting, instead they use the Gleam tree sitter grammar. You will need to ask GitHub support to upgrade to the latest version of the tree sitter grammar as this part of the GitHub config is not open source.

Thanks, I'll make an issue on that repo instead. I see now that the tree-sitter grammar is listed in the linguist repo.

Out of curiosity, why is this repo listed as a submodule of that repo if it's not used?

Nevermind, answered my own question here.