Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 1, 2026

TypeScript .ts files were being skipped as binary because the extension was in BINARY_FILE_EXTENSIONS (intended for MPEG transport streams).

Changes

  • src/defaults.rs: Removed "ts" from binary extensions list. Added comment noting the exclusion prevents TypeScript conflicts while content inspection still catches actual binary .ts files.
  • tests/lib_test.rs: Added test verifying TypeScript files are treated as text.

Example

Before this change:

$ yek --debug example.ts
DEBUG Skipping ignored file: example.ts
DEBUG Processed 0 files

After:

$ yek example.ts
>>>> example.ts
interface User {
  name: string;
  age: number;
}

The workaround of using --unignore-patterns "*.ts" is no longer needed.

Original prompt

This section details on the original issue you should resolve

<issue_title>TypeScript .ts files incorrectly treated as binary (video transport stream)</issue_title>
<issue_description>## Bug Description

.ts files are being skipped as binary files because ts is included in the binary_extensions list. This is intended for video transport stream files, but it incorrectly catches TypeScript files.

Steps to Reproduce

yek --debug src/compiler/types.ts

Output shows:

DEBUG Skipping ignored file: types.ts
DEBUG Processed 0 files

Workaround

Use --unignore-patterns "*.ts" to force include TypeScript files:

yek --unignore-patterns "*.ts" src/

Suggested Fix

Remove ts from the binary_extensions list, or add logic to detect actual TypeScript files vs video transport streams (e.g., by checking file content or accompanying tsconfig.json).

Environment

  • yek version: (latest via homebrew)
  • OS: macOS</issue_description>

<agent_instructions>first make a failing test, then fix the code to make the test pass</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@mohsen1 Only for very very large .ts files like TypeScript's checker.ts

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI self-assigned this Jan 1, 2026

// Video
"mp4", "m4v", "mov", "avi", "wmv", "mkv", "flv", "f4v", "f4p", "f4a", "f4b", "3gp",
"3g2", "mpeg", "mpg", "mpe", "m1v", "m2v", "ts", "mts", "m2ts", "vob", "rm", "rmvb",
Copy link
Owner

Choose a reason for hiding this comment

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

@copilot ts can be a video if it's binary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct - the content inspection in is_text_file() (src/lib.rs:44-60) reads the first 8KB of each file and uses the content_inspector crate to detect binary content. So binary .ts video files will still be caught and skipped, while TypeScript text files will be processed.

Copilot AI changed the title [WIP] Fix TypeScript .ts files being treated as binary files Remove .ts from binary extensions to fix TypeScript file processing Jan 1, 2026
Copilot AI requested a review from mohsen1 January 1, 2026 10:20
@mohsen1 mohsen1 marked this pull request as ready for review January 1, 2026 13:02
Copilot AI review requested due to automatic review settings January 1, 2026 13:02
@mohsen1 mohsen1 merged commit 440bee5 into main Jan 1, 2026
26 of 27 checks passed
@mohsen1 mohsen1 deleted the copilot/fix-typescript-binary-issue branch January 1, 2026 13:02
Copy link
Contributor

Copilot AI left a comment

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 fixes a bug where TypeScript .ts files were incorrectly treated as binary files and skipped during processing. The issue occurred because "ts" (MPEG transport stream) was included in the binary extensions list, which caused conflicts with the more common TypeScript file extension.

Key Changes

  • Removed "ts" from the binary extensions list in src/defaults.rs to allow TypeScript files to be processed
  • Added explanatory comment noting that actual binary .ts files will still be detected via content inspection
  • Added comprehensive test to verify TypeScript files are treated as text files

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/defaults.rs Removed "ts" from BINARY_FILE_EXTENSIONS array and added a comment explaining the rationale for excluding it while noting that content inspection will still catch actual binary .ts files
tests/lib_test.rs Added test_typescript_files_not_treated_as_binary test that verifies both that "ts" is not in the binary extensions list and that TypeScript files with typical content are correctly detected as text files

Comment on lines 53 to +56
// Video
// Note: .ts (MPEG transport stream) extension is intentionally excluded
// to avoid conflicts with TypeScript files, which are more common in code repositories.
// Actual binary .ts files will still be detected via content inspection.
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

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

The multi-line comment should follow Rust's convention of using // for each line rather than placing it as a separate block before the array line. This would be more consistent with the single-line comments used elsewhere in this file (e.g., line 10, 11, 18, etc.).

Suggested change
// Video
// Note: .ts (MPEG transport stream) extension is intentionally excluded
// to avoid conflicts with TypeScript files, which are more common in code repositories.
// Actual binary .ts files will still be detected via content inspection.
// Video (.ts MPEG transport stream is intentionally excluded to avoid conflicts
// with TypeScript files; actual binary .ts files are detected via content inspection)

Copilot uses AI. Check for mistakes.
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.

TypeScript .ts files incorrectly treated as binary (video transport stream)

2 participants