question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improve recovery of items within blocks

See original GitHub issue
fn 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:closed
  • Created 7 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found