Improve recovery of items within blocks
See original GitHub issuefn main() {
trait Foo {
intellijidearulezz
}
}
Has pretty poor recovery, PSI:
FILE(0,62)
RustFnItemElementImpl(FN_ITEM)(0,60)
PsiElement(fn)('fn')(0,2)
PsiWhiteSpace(' ')(2,3)
PsiElement(<IDENTIFIER>)('main')(3,7)
RustParametersElementImpl(PARAMETERS)(7,9)
PsiElement(()('(')(7,8)
PsiElement())(')')(8,9)
PsiWhiteSpace(' ')(9,10)
RustBlockElementImpl(BLOCK)(10,60)
PsiElement({)('{')(10,11)
PsiWhiteSpace('\n ')(11,16)
RustTraitItemElementImpl(TRAIT_ITEM)(16,27)
PsiElement(trait)('trait')(16,21)
PsiWhiteSpace(' ')(21,22)
PsiElement(<IDENTIFIER>)('Foo')(22,25)
PsiWhiteSpace(' ')(25,26)
RustTraitBodyElementImpl(TRAIT_BODY)(26,27)
PsiElement({)('{')(26,27)
PsiErrorElement:fn or '}' expected, got 'intellijidearulezz'(27,27)
<empty list>
PsiWhiteSpace('\n ')(27,36)
RustPathExprElementImpl(PATH_EXPR)(36,54)
RustPathElementImpl(PATH)(36,54)
PsiElement(<IDENTIFIER>)('intellijidearulezz')(36,54)
PsiWhiteSpace('\n ')(54,59)
PsiElement(})('}')(59,60)
PsiWhiteSpace('\n')(60,61)
PsiErrorElement:const, enum, extern, fn, impl, mod, static, struct, trait, type or use expected, got '}'(61,62)
PsiElement(})('}')(61,62)
I think even dumb seeking for closing brace should yield nicer AST.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to Recover All Broken Blocks In One Command in ...
The way to recover all broken blocks at once involves pasting some code into your browser's developer console. If you find it intimidating,...
Read more >19 Performing Block Media Recovery - Oracle Help Center
Use block media recovery to recover one or more corrupt data blocks within a data file. Block media recovery provides the following advantages...
Read more >Baseball Catcher Tips: How to Block and Recover with ...
The pitch should be in the dirt, forcing you to make the block, locate the ball, recover it quickly with your bare hand...
Read more >11 Tips for Better Blocks - Outpatient Surgery Magazine - AORN
Blocks can shorten recovery times, decrease post-op pain and nausea, and let patients regain awareness and mobility sooner than with general anesthesia.
Read more >Improve Your Cycling Performance with Block Training
By combining consecutively hard works with recovery, you can improve your cycling ... with block training and incorporate it into your workout planning....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Here’s how you do recovering in GK: https://github.com/intellij-rust/intellij-rust/commit/6d652f7c5852d02fe807c5176b42e78d8f498211
One thing to note is that
recover_while
fires even if the parse was successful (it should match zero tokens then)Should be mostly covered by these commits:
https://github.com/intellij-rust/intellij-rust/commit/135e1a303908dc2534939b01dddbda3d7224336f https://github.com/intellij-rust/intellij-rust/commit/8b695976a1bad8cc0ea130a7c56f59ea7da0299e https://github.com/intellij-rust/intellij-rust/commit/e1c148ad0a67c05cfd59319692513d22d543032c
Hint at https://github.com/JetBrains/Grammar-Kit/issues/128#issuecomment-236204070 was instrumental.