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.

Outline and folding not displaying when provided via analyzer plugin

See original GitHub issue

In a Dart project, I have this file, test.moor:

CREATE TABLE playground (
  id INT NOT NULL PRIMARY KEY AUTOINCREMENT
)

I have added “moor” to the list of additional file endings to analyze and I also have the option to use the analysis server folding turned on. The server does send back outline and folding information (relevant excerpts from the instrumentation log):

1567872912626:Req:{"id"::"2","method"::"analysis.updateContent","params"::{"files"::{"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor"::{"content"::"CREATE TABLE playground (\n  id INT NOT NULL PRIMARY KEY AUTOINCREMENT\n)","type"::"add"}}},"clientRequestTime"::1567872911985}
1567872912643:Res:{"id"::"2","result"::{}}

1567872913157:Req:{"id"::"6","method"::"analysis.setSubscriptions","params"::{"subscriptions"::{"CLOSING_LABELS"::["/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor"],"FOLDING"::["/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor"],"OCCURRENCES"::["/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor"],"OUTLINE"::["/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor"]}},"clientRequestTime"::1567872912560}
1567872913167:Res:{"id"::"6"}

1567872835759:Noti:{"event"::"analysis.outline","params"::{"file"::"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor","kind"::"LIBRARY","outline"::{"element"::{"kind"::"FILE","name"::"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor","flags"::0},"offset"::0,"length"::71,"codeOffset"::0,"codeLength"::71,"children"::[{"element"::{"kind"::"CLASS","name"::"playground","flags"::0},"offset"::0,"length"::71,"codeOffset"::0,"codeLength"::71,"children"::[{"element"::{"kind"::"FIELD","name"::"id","flags"::0},"offset"::28,"length"::41,"codeOffset"::28,"codeLength"::41}]}]}}}

1567872930618:Noti:{"event"::"analysis.folding","params"::{"file"::"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor","regions"::[{"kind"::"CLASS_BODY","offset"::26,"length"::43}]}}
Formatted representation of the last two events for readability
{
   "event":"analysis.outline",
   "params":{
      "file":"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor",
      "kind":"LIBRARY",
      "outline":{
         "element":{
            "kind":"FILE",
            "name":"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor",
            "flags":0
         },
         "offset":0,
         "length":71,
         "codeOffset":0,
         "codeLength":71,
         "children":[
            {
               "element":{
                  "kind":"CLASS",
                  "name":"playground",
                  "flags":0
               },
               "offset":0,
               "length":71,
               "codeOffset":0,
               "codeLength":71,
               "children":[
                  {
                     "element":{
                        "kind":"FIELD",
                        "name":"id",
                        "flags":0
                     },
                     "offset":28,
                     "length":41,
                     "codeOffset":28,
                     "codeLength":41
                  }
               ]
            }
         ]
      }
   }
}

{
   "event":"analysis.folding",
   "params":{
      "file":"/home/simon/IdeaProjects/moor/extras/plugin_example/lib/test.moor",
      "regions":[
         {
            "kind":"CLASS_BODY",
            "offset":26,
            "length":43
         }
      ]
   }
}

However, the outline view from VS Code says “The active editor cannot provide outline information.” and folding is not available inside the file.

Is there anything wrong with that’s reported in the last two events that might cause DartCode to ignore them? If there is file-ending check for these kinds of reports, this might be related to #1944

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Sep 17, 2019

Apologies - I’ve been out of the office last week and I’m still working through things I missed. I put this in the v3.5 milestone because I’d like to have a look at it for the next release, but I haven’t gotten to it yet.

I’ve got a busy week and will be out next week too, so if you want to have a go, it could certainly help things along. Running the extension from source should be easy - just clone this repo, run npm install, open the project in VS Code and hit F5. It’ll spawn a new copy of VS Code that’s running the extension from source. You could try modifying the lines mentioned above to include your file extension, and see if it works (you can use the analysis server log file, or Capture Logs commands to capture traffic to the server if required).

0reactions
DanTupcommented, Sep 19, 2019

https://github.com/Dart-Code/Dart-Code/blob/f3509d0dfe74520cdd0128794b47730a72b8c6f1/src/extension.ts#L190

As far as I can tell, this has never worked properly 😦 Suggests not many are using this, but I’ll fix it all the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code folding not working properly in certain circumstances
All code blocks should be folded after issuing a Fold All command. Interestingly, copying the contents of the file into a new editor...
Read more >
Code Folding | IntelliJ IDEA Documentation - JetBrains
Show code folding outline. Select this checkbox if you want the code folding toggles to be shown in the editor. Clear the checkbox...
Read more >
October 2022 - Visual Studio Code
In addition, not all folding providers can be combined with others providers. The new editor.defaultFoldingProvider setting allows you to select the folding ......
Read more >
User Manual - rust-analyzer
At its core, rust-analyzer is a library for semantic analysis of Rust code as it changes over time. This manual focuses on a...
Read more >
ICU Folding Token Filter - Analysis Plugins - Elastic
It registers itself as the icu_folding token filter and is available to all indices: ... The ICU folding token filter already does Unicode...
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