Skip to content

Add Gleam language support#4069

Open
nikhilkalburgi45 wants to merge 1 commit intoPrismJS:v2from
nikhilkalburgi45:feat/gleam-language
Open

Add Gleam language support#4069
nikhilkalburgi45 wants to merge 1 commit intoPrismJS:v2from
nikhilkalburgi45:feat/gleam-language

Conversation

@nikhilkalburgi45
Copy link
Copy Markdown

This PR adds basic syntax highlighting for Gleam.

Gleam isn’t currently supported in Prism, and the Rust grammar people often fall back on doesn’t map well especially around pipes, pattern matching, and type usage. This adds a dedicated language definition.

What’s covered

  • Comments: line (//), doc (///), and module doc (////)
  • Strings with standard escape sequences
  • Attributes (@external, @internal, etc.)
  • Keywords: fn, let, use, case, type, import, pub, opaque, const, as, panic, todo, if, else
  • Numbers: decimal (with _), hex (0x), binary (0b), scientific notation
  • Built-in types: Int, Float, String, Bool, List, Result, Option, Nil
  • Boolean literals: True, False
  • Operators: |>, <>, ->, .., plus standard arithmetic and comparison operators
  • Function calls (best-effort detection)

Test cases are included under tests/languages/gleam/, covering typical usage (functions, pipelines, numbers, etc.).

Limitations

  • Type names fall back to an uppercase heuristic when not explicitly listed.
  • Function detection is best-effort and may match some non-function identifiers.
  • case pattern matching isn’t deeply tokenized to avoid overly complex regex.

Files

  • src/languages/gleam.js
  • src/components.json
  • tests/languages/gleam/

Note

I ran into an ESM path issue on Windows (ERR_UNSUPPORTED_ESM_URL_SCHEME) when running the full test suite. This appears to be environment-related rather than specific to the Gleam implementation. Happy to run tests via WSL if needed.

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 25, 2026

Deploy Preview for dev-prismjs-com ready!

Name Link
🔨 Latest commit 4bb5aef
🔍 Latest deploy log https://app.netlify.com/projects/dev-prismjs-com/deploys/69c3ef081dca620008b24cd6
😎 Deploy Preview https://deploy-preview-4069--dev-prismjs-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant