Skip to content

Outline and folding not displaying when provided via analyzer plugin #1981

@simolus3

Description

@simolus3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions