codex icon indicating copy to clipboard operation
codex copied to clipboard

read_file: inline block comments misclassified

Open Tlinov opened this issue 10 months ago • 1 comments

Summary

read_file comment header detection mishandles inline block comments:

  • let x = 1; /* start does not enter block-comment state, so following * ... lines are not treated as header comments.
  • /* comment */ let x = 1; is treated as a header comment even though it has trailing code.

Repro

  1. Create a file with:
let x = 1; /* start
 * header line
 */
fn main() {}
  1. Call read_file in indentation mode with include_header=true anchored under fn main().

Expected

  • Inline /* starts block-comment state for subsequent lines, but the line itself is not a header.
  • Single-line /* ... */ with trailing code is not a header comment.

Actual

  • Inline /* does not start block-comment state, so header lines are missed.
  • /* ... */ code is treated as header.

Tlinov avatar Jan 24 '26 20:01 Tlinov

Have you actually hit this issue in practice, or is this just based on a TODO comment that you found in the code? We don't want to spend time on theoretical issues when there are many real issues that users are hitting.

etraut-openai avatar Jan 26 '26 23:01 etraut-openai