Skip to content

Improve JS/TS comment filtering#81

Merged
Vladyslav-Kuksiuk merged 9 commits into
masterfrom
improve-js-comment-filtering
Jul 6, 2026
Merged

Improve JS/TS comment filtering#81
Vladyslav-Kuksiuk merged 9 commits into
masterfrom
improve-js-comment-filtering

Conversation

@Vladyslav-Kuksiuk

@Vladyslav-Kuksiuk Vladyslav-Kuksiuk commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This PR:

  • improves JS/TS comment filtering;
  • splits the filtering tests into smaller, language-specific files.

Resolves this issue.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a dedicated JavaScript/TypeScript comment filter to avoid stripping comment-like text inside template literals and regex literals, addressing the regression described in issue #67.

Changes:

  • Added a new JavaScriptCommentFilter with JS/TS-aware scanning for template literals (including ${...}) and regex literals.
  • Switched .js/.jsx/.ts/.tsx filtering from the generic marker-based filter to the new JS/TS filter and removed the old JS marker config.
  • Expanded the JS/TS test suite with cases covering templates, nested templates, and regex literals.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
embedding/commentfilter/javascript_filter.go New JS/TS-specific lexical scanner to strip real comments while preserving template/regex literal content.
embedding/commentfilter/config.go Registers JavaScriptCommentFilter for JS/TS extensions and removes the old jsSyntax marker configuration.
embedding/commentfilter/filter_test.go Adds JS/TS regression tests for templates, nested templates, and regex literals.

Comment thread embedding/commentfilter/javascript_filter.go
Comment thread embedding/commentfilter/javascript_filter.go
Comment thread embedding/commentfilter/config.go
Base automatically changed from improve-java-comment-filtering to master July 6, 2026 08:24
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk marked this pull request as ready for review July 6, 2026 08:52
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk merged commit 72730c8 into master Jul 6, 2026
3 checks passed
@Vladyslav-Kuksiuk Vladyslav-Kuksiuk deleted the improve-js-comment-filtering branch July 6, 2026 14:32
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.

Improve TypeScript and JavaScript template/regex filtering

4 participants