Suppress line numbers in edit/read tools: 1→Line 1 to Line 1#326
Conversation
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughAdds a new misc setting Changes
sequenceDiagram
autonumber
participant Config as UserConfig
participant Patcher as applyCustomization()
participant Suppress as suppressLineNumbers
participant FS as FileSystem
rect rgb(237,247,237)
note right of Config: Feature flag check
end
Config->>Patcher: call applyCustomization(config, oldFile)
alt suppressLineNumbers enabled
Patcher->>Suppress: call writeSuppressLineNumbers(oldFile)
Suppress->>FS: inspect content (regex locate formatter)
Suppress-->>Patcher: return modifiedContent or null
alt modifiedContent returned
Patcher->>FS: write modifiedContent
else null
Patcher-->>FS: leave content unchanged
end
else disabled
Patcher-->>FS: skip suppression
end
Patcher-->>Config: finish
🎯 3 (Moderate) | ⏱️ ~22 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/defaultSettings.tssrc/patches/index.tssrc/patches/suppressLineNumbers.tssrc/types.tssrc/ui/components/MiscView.tsx
🧰 Additional context used
🧬 Code graph analysis (2)
src/patches/suppressLineNumbers.ts (1)
src/patches/index.ts (2)
LocationResult(70-74)showDiff(88-126)
src/patches/index.ts (1)
src/patches/suppressLineNumbers.ts (1)
writeSuppressLineNumbers(51-72)
🔇 Additional comments (7)
src/defaultSettings.ts (1)
756-756: LGTM!The new
suppressLineNumberssetting is correctly added with a default value oftrue, aligning with the PR objectives to suppress line number prefixes by default.src/ui/components/MiscView.tsx (1)
34-34: LGTM!The default value of
truecorrectly matches the default insrc/defaultSettings.ts.src/types.ts (1)
116-116: LGTM!The type definition correctly adds the new
suppressLineNumbersboolean field toMiscConfig, consistent with other miscellaneous settings.src/patches/index.ts (2)
63-63: LGTM!The import follows the established pattern for patch writers in this file.
661-664: LGTM!The patch application logic correctly applies the
suppressLineNumberspatch conditionally based on the configuration setting. The placement afterincreaseFileReadLimitand the pattern match other conditional patches in the file.src/patches/suppressLineNumbers.ts (2)
51-72: LGTM!The function correctly implements the suppression logic:
- Locates the line number formatter using the regex pattern
- Extracts the content variable name from the second capture group
- Replaces the entire formatter block with a simple
return ${contentVar}statement- Provides appropriate error handling and debugging output
This effectively removes line number prefixes (e.g.,
1→content) and returns only the content, achieving the PR's objective to reduce token usage.
14-49: Regex pattern is syntactically correct and matches the intended minified format.The regex on line 33 successfully captures both the line number variable and content variable. The pattern correctly uses
([$\w]+)to handle identifiers with dollar signs per the patch guidelines in index.ts.Optional: Consider adding a word boundary
\bat the start of the pattern (/\bif\() for performance optimization, as noted in the patch infrastructure guidelines (lines 28-32 of index.ts).
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Closes #310
Summary by CodeRabbit
New Features
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.