Skip to content

fix: expand hljs language coverage via alias resolution#378

Merged
tomasz-tomczyk merged 1 commit intomainfrom
fix/hljs-language-coverage
Apr 28, 2026
Merged

fix: expand hljs language coverage via alias resolution#378
tomasz-tomczyk merged 1 commit intomainfrom
fix/hljs-language-coverage

Conversation

@tomasz-tomczyk
Copy link
Copy Markdown
Owner

Summary

  • Replace hand-curated extension→language map in langFromPath with hljs.getLanguage() alias resolution plus a small override map for extensions hljs doesn't alias (tf, htm, svg, cs, sh, zig, md).
  • Adds basename detection for extensionless files: Dockerfile, Makefile, Gemfile, Rakefile.
  • Picks up Gherkin (.feature) and many other languages that were already bundled in highlight.min.js via copy-deps.js but unreachable through the dispatcher.
  • Note: keeps the intentional lang !== 'markdown' guard at app.js:880 (avoids messy nested ```markdown rendering when reviewing a top-level .md file). Hence md → markdown stays in the override map so downstream lang === 'markdown' comparisons keep working.

Related to #375.

Review

Test plan

  • New E2E test in e2e/tests/syntax-highlighting.spec.ts asserts hljs spans render on a .feature file
  • Sample Gherkin file added to e2e/setup-fixtures.sh
  • Updated dependent file-count assertions in file-tree.spec.ts and scope-toggle.spec.ts
  • Full git-mode E2E suite: 457 passing locally

🤖 Generated with Claude Code

Replace hand-curated extension map with hljs.getLanguage() alias
lookup plus a small overrides map for cases where the file extension
is not a registered hljs alias. Adds Gherkin (.feature) and many
others previously missing.

Adds an E2E test for Gherkin highlighting and a sample .feature
file in the fixture.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.59%. Comparing base (8fba769) to head (f4b9fb7).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #378      +/-   ##
==========================================
+ Coverage   66.56%   66.59%   +0.03%     
==========================================
  Files          19       19              
  Lines        8176     8176              
==========================================
+ Hits         5442     5445       +3     
+ Misses       2311     2309       -2     
+ Partials      423      422       -1     
Flag Coverage Δ
e2e 33.81% <ø> (ø)
unit 62.61% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomasz-tomczyk tomasz-tomczyk merged commit f79d9f9 into main Apr 28, 2026
6 checks passed
@tomasz-tomczyk tomasz-tomczyk deleted the fix/hljs-language-coverage branch April 28, 2026 21:06
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