Skip to content

Ignore TypeScript comments in syntax scan#580

Closed
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/ts-syntax-scan-ignore-comments
Closed

Ignore TypeScript comments in syntax scan#580
tristanmanchester wants to merge 1 commit into
peteromallet:mainfrom
tristanmanchester:fix/ts-syntax-scan-ignore-comments

Conversation

@tristanmanchester
Copy link
Copy Markdown
Contributor

@tristanmanchester tristanmanchester commented Apr 17, 2026

Summary

  • make the TypeScript syntax scanner ignore // and /* */ comment delimiters when balancing brackets
  • strip comments before brace-body extraction so comment braces do not truncate empty-body detection
  • add regressions for helper behavior and multiline debug-log removal with comment delimiters on the opening line

Testing

  • uv run --with pytest python -m pytest desloppify/languages/typescript/tests/test_ts_fixers.py -k "CommonFindBalancedEnd or CommonExtractBody or remove_multiline_log or removes_orphaned_debug_comment"

@peteromallet
Copy link
Copy Markdown
Owner

Thanks for the fix. I accepted the underlying issue, but implemented it with changes on this branch in cfaf256 rather than merging this PR directly.

Decision: IMPLEMENT_WITH_CHANGES. The TypeScript syntax scanner now skips comments only when outside strings/template literals, preserves offsets for brace-body extraction, and maps multiline scans back to the original line numbers. I also added regressions for foo('/', bar), multiline console.log arguments containing /, and comment braces/parens.

Validation: PYENV_VERSION=3.11.11 python -m pytest desloppify/languages/csharp/tests/test_csharp_parse_helpers.py desloppify/languages/cxx/tests/test_extractors.py desloppify/languages/dart/tests/test_extractors.py desloppify/languages/rust/tests/test_extractors.py desloppify/languages/typescript/tests/test_ts_fixers.py -q

@peteromallet
Copy link
Copy Markdown
Owner

Closing as superseded by cfaf256 on the review branch.

@peteromallet peteromallet added the release:v1.0 Included in v1.0 label May 13, 2026
@peteromallet
Copy link
Copy Markdown
Owner

Thanks for the contribution. This is included in v1.0: https://github.com/peteromallet/desloppify/releases/tag/v1.0

peteromallet added a commit that referenced this pull request May 13, 2026
Record co-author trailers for PR authors included in the v1.0 release cycle so GitHub can associate release-cycle contribution credit with the tag.

Refs: #189, #484, #485, #486, #489, #493, #495, #529, #539, #573, #580, #581, #584, #585, #589, #602, #603

Co-authored-by: R. Desmond <134018026+0-CYBERDYNE-SYSTEMS-0@users.noreply.github.com>
Co-authored-by: AreboursTLS <77301936+AreboursTLS@users.noreply.github.com>
Co-authored-by: AugusteBalas <128148269+AugusteBalas@users.noreply.github.com>
Co-authored-by: Alex Price <2804025+awprice@users.noreply.github.com>
Co-authored-by: Klaus Agnoletti <24544601+klausagnoletti@users.noreply.github.com>
Co-authored-by: Koshi <18751916+koshimazaki@users.noreply.github.com>
Co-authored-by: Pietro <6080662+pietrondo@users.noreply.github.com>
Co-authored-by: raveinid <7130195+raveinid@users.noreply.github.com>
Co-authored-by: Ryan Gerstenkorn <4079939+RyanJarv@users.noreply.github.com>
Co-authored-by: ryexLLC <217349586+ryexLLC@users.noreply.github.com>
Co-authored-by: Maximilian Scholz <6530123+sims1253@users.noreply.github.com>
Co-authored-by: Tristan Manchester <108270628+tristanmanchester@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release:v1.0 Included in v1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants