Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lisp family improvements: better grammar for Common Lisp; added Racket, Fennel, Hy #50

Merged
merged 4 commits into from
Apr 25, 2024

Conversation

kisaragi-hiu
Copy link
Contributor

I grouped these changes into one PR as they are somewhat related and otherwise I would be about to open a dozen PRs.

The generated / converted / fetched files are added in a separate commit to make it easier to review and/or merge.

Changes in this PR:

  • Add support for Racket, Fennel, and Hy.
  • Create a new category for Lisp family languages, similar to "Web".
  • Call Common Lisp "Common Lisp", not just "Lisp", as otherwise it's not clear if it's referring to a specific language (which would be Common Lisp) or the entire language family.
  • Use the Common Lisp grammar from qingpeng9802/vscode-common-lisp, as it highlights Common Lisp code in a much better way than mattn/vscode-lisp or TextMate.
Before After
20240424T185156+0900 20240424T185051+0900

The "lisp" grammar provided by mattn/vscode-lisp (which is a slightly
modified version of the one from TextMate) has some problems:

- It seemingly treats Common Lisp and Emacs Lisp as the same language.
  This is as usable (or not) as using the same grammar to highlight C
  and old JavaScript (ES5 was probably close enough to C syntax for that
  to work): they have different builtins and different syntaxes in some
  areas, despite large similarities.
- More concretely: it doesn't highlight &rest or &key; it highlights
  macros, functions and keywords (like `:hello`) the same; it has no
  support for highlighting format strings (which
  qingpeng9802/vscode-common-lisp does); it also doesn't highlight
  namespaces.

By using the grammar from qingpeng9802/vscode-common-lisp, the
highlighting for Common Lisp code becomes much better.

This commit allows calling the language "common-lisp". An alias for
"lisp" is still provided, as "lisp" as a specific language usually also
refers to Common Lisp.
Hy needs a display name as it doesn't get capitalized properly in the
playground (and presumbaly elsewhere) otherwise.
Copy link

netlify bot commented Apr 24, 2024

Deploy Preview for textmate-grammars-themes ready!

Name Link
🔨 Latest commit 240c5cc
🔍 Latest deploy log https://app.netlify.com/sites/textmate-grammars-themes/deploys/6628e4fe6510870007373689
😎 Deploy Preview https://deploy-preview-50--textmate-grammars-themes.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 site configuration.

@kisaragi-hiu kisaragi-hiu changed the title Lisp family language improvements: better grammar for Common Lisp; support for Racket, Fennel, Hy; category for them Lisp family improvements: better grammar for Common Lisp; support for Racket, Fennel, Hy; add category for them Apr 24, 2024
@antfu antfu changed the title Lisp family improvements: better grammar for Common Lisp; support for Racket, Fennel, Hy; add category for them feat: lisp family improvements: better grammar for Common Lisp; added Racket, Fennel, Hy Apr 25, 2024
@antfu antfu merged commit 13ef7c6 into shikijs:main Apr 25, 2024
6 checks passed
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.

None yet

2 participants