Repository navigation
Conversation
TextFileDocumentProvider.validateState() ran the validation as a workspace operation whose scheduling rule falls back to the file when IResourceRuleFactory.validateEditRule() returns null (Bug 546828). That rule conflicts with the workspace root rule held by a build, so the first keystroke in a non-dirty editor blocked the UI thread until the build ended, with only a "User Operation is Waiting" dialog. validateEditRule() returns null when the file is not read-only, and for such a file ResourceFileBuffer.validateState() does not call IWorkspace.validateEdit(): there is nothing to protect with a rule. The file buffer is now validated directly in that case. Read-only files keep the workspace operation, its rule and the cancellable dialog. The existing test now uses a read-only file, so it still covers the operation path, and a new test checks that a writable file is validated while another job holds the workspace lock. Fixes eclipse-platform#4581 Signed-off-by: Hélios GILLES <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GviovNL1A9qQNNC72f312S
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change to avoid workspace-lock waits during writable-file validation.
No open issues 🎉
What changed in this PR
Addresses #4581 by avoiding workspace-lock waits when validating writable files in text editors, allowing the first keystroke to proceed during a build.
Changes:
- Validates the file buffer directly when no scheduling rule is required, while preserving workspace-operation handling for read-only files.
- Adds a writable-file regression test and updates the existing lock-wait test to use a read-only file.
| File | Description |
|---|---|
| tests/org.eclipse.ui.editors.tests/src/org/eclipse/ui/editors/tests/TextFileDocumentProviderTest.java | Tests nonblocking writable-file validation and preserves read-only lock-wait coverage. |
| bundles/org.eclipse.ui.editors/src/org/eclipse/ui/editors/text/TextFileDocumentProvider.java | Bypasses the workspace operation when file-buffer validation requires no rule. |
Review effort: Balanced
|
Just as a note, if a file is writable can be change during a build (e.g. it is opens and windows does not allows concurrent access, a build step deletes the file, ...) - the PR description reads a bit lengthy and it might help to make it more focused on what and why is changed. |
|
Thanks, I shortened the description. The writable state can indeed change at any time, but the change does not rely on it staying stable:
|
Fixes #4581
What:
TextFileDocumentProvider.validateState()validates the file buffer directly, without a workspace operation, whencomputeValidateStateRule()isnull, that is, when the file is not read-only. Read-only files keep the workspace operation, its rule and the cancellable dialog from Bug 546828.Why: For a writable file,
ResourceFileBuffer.validateState()does not callIWorkspace.validateEdit(), so nothing needs a rule. The file rule used until now only made the first keystroke in a non-dirty editor wait for a running build.Tests: A new test checks that a writable file is validated while another job holds the workspace rule and lock. It fails without the fix. The existing test now uses a read-only file, so it still covers the operation path.
🤖 Generated with Claude Code
https://claude.ai/code/session_01GviovNL1A9qQNNC72f312S