Commit 422d88b
committed
fix: harden isTestoFile against stale stubs and out-of-content files
The original report showed an "Outdated stub in index" exception
triggered by isTestoFile() called on a stale PsiFile from vendor/ -
where the physical file was already deleted but the VFS hadn't
refreshed yet, so virtualFile.isValid still returned true.
A bare isValid check is therefore not enough. To make isTestoFile()
robust:
- Skip files outside project content (ProjectFileIndex.isInContent),
excluded folders and IDE-ignored paths - this filters out vendor/
and similar locations before any PSI traversal happens, removing
the root cause for the reported case.
- Wrap the AST-loading traversal in a try/catch that rethrows
ProcessCanceledException and downgrades any other Throwable
(including StubTreeAndIndexUnmatchCoarseException) to a logged
warning + false, so a transient index inconsistency can no longer
propagate as an unhandled exception through callers (live
templates, inspection suppressor, run config producer, etc.).1 parent d2419b7 commit 422d88b
1 file changed
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
4 | 7 | | |
5 | 8 | | |
6 | 9 | | |
| |||
12 | 15 | | |
13 | 16 | | |
14 | 17 | | |
| 18 | + | |
| 19 | + | |
15 | 20 | | |
16 | 21 | | |
17 | 22 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
66 | 84 | | |
67 | 85 | | |
68 | 86 | | |
| |||
0 commit comments