Skip to content

Conversation

@lmmx
Copy link
Owner

@lmmx lmmx commented Nov 1, 2025

Implements per-file offset tracking as described in #6.

Changes:

  • Added file_offsets: HashMap<String, HashMap<i64, usize>> to AppState to track cumulative line additions per file
  • rebuild_file_offsets() builds the map on each save, handling external module docstrings at line 0
  • cumulative_offset() now queries the map filtered by file and line instead of summing globally
  • External module docstrings correctly offset subsequent diagnostics in their target files

Example:

  • src/foo.rs with 10-line module docstring from mod foo; declaration
  • Adding docstring at line 20 uses offset +10
  • Adding docstring at line 25 uses offset +11 (module + previous docstring)

Fixes #6

@lmmx lmmx merged commit 40c3fcb into master Nov 1, 2025
1 check passed
@lmmx lmmx deleted the per-file-offset branch November 1, 2025 11:13
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.

Editing external module files to have a module docstring should increment that module's offset

2 participants