-
Notifications
You must be signed in to change notification settings - Fork 27
Fix offset issue #466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
richardm90
wants to merge
11
commits into
codefori:main
Choose a base branch
from
richardm90:fix-offset-issue
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Fix offset issue #466
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prevents multiple concurrent parse operations during live editing that were causing duplicate definitions with incorrect offsets, resulting in false linter errors about variable name casing.
Improves the offset issue fix by adding parse ID tracking to invalidate stale parse operations, a parsing flag to prevent concurrent parses, error handling, and reduces debounce time from 500ms to 300ms for better responsiveness. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Removes the `parsing` state flag that was preventing concurrent parses. The new approach allows up to 2 concurrent parses per document, with automatic invalidation of stale results via the parseId mechanism. This fixes the issue where document changes during an active parse would not trigger a new parse, leaving the latest changes unparsed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Adds comprehensive timestamped logging for debugging parse operations: - Parse lifecycle tracking (start, completion, duration, parseId) - Include file fetch operations with timing and cache status - URI validation with timing - File fetch operations with cache hits/misses - Clean filename extraction (strips query parameters) Fixes include fetch deduplication bug where fetchingInProgress flag was cleared too early, before async getFileRequest() completed. This caused duplicate server requests for the same include file during a single parse operation. Now the flag is only cleared after all async work completes, properly preventing duplicate fetches. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The Problem
I've experienced odd behaviour when changing RPG source in that the linter would suddenly display a "Variable name casing does not match definition" warning at various points within the source I was editing. Although this appears to be a linter issue it goes further, the tokens appear to lose their offset within the source so when you use something like F2 to rename a symbol it loses track of where those symbols are and renames the wrong text in the source.
/includefiles - I do use a lot of/includefiles.I was able to pull together a very simple example that replicates the problem, which I've also created a video that demonstrates the problem as it's not easy to understand from the description.
rm82test-2025-10-30_20.45.00.mp4
Full disclosure I leaned on Claude Code to help fix the problem and produce the documentation of the changes.
The extension was experiencing race condition offset issues that manifested as false linter errors during live editing:
The Solution
The fix implements a comprehensive debouncing and synchronization mechanism with multiple layers of protection:
Debouncing (server.ts:342-404)
Parse State Tracking (lines 334-340)
Parse ID Validation (lines 362-363, 386-397)
Concurrent Parse Handling (lines 369-371)
Include File Fetch Deduplication (server.ts:141-313)
Fixed critical bug where fetchingInProgress flag was cleared too early:
This prevents duplicate server requests for the same include file during a single parse operation.
Added comprehensive timestamped logging for debugging:
.catch()block to gracefully handle parse errorsTechnical Flow
parseId→ Invalidate any in-flight parsesparseId→ Only update diagnostics if this is still the latest versionKey Improvements
Files Changed
extension/server/src/server.ts- Debouncing, parse state tracking, include fetch deduplication, loggingextension/server/src/connection.ts- Enhanced logging for URI validation and file fetchesTODO
/includefiles are loaded a lot, the extension seems to reload the same file many, many times. I connect over VPN for a lot of my clients and loading source can take a while./includefiles, if they've changed/includestooChecklist
console.logs I added