index rss mastodon twitter github linkedin email
Álvaro Ramírez
sponsor

Álvaro Ramírez

07 December 2015 Playing with Dart's analysis server

Dart SDK ships with an analysis server. Very handy if you'd like to write a completion plugin for your favorite editor. The API is well documented. Of interest, there's LocalDartServer.java, part of dartedit.

$ dart path/to/bin/snapshots/analysis_server.dart.snapshot  --sdk=path/to/dart-sdk

NOTE: The server reads requests from standard input. Either escape or execute the following as one-liner json requests.

{
  "id": "1\n",
  "method": "analysis.setAnalysisRoots\n",
  "params": {
    "included": [
      "path/to/your/dart/project"
    ],
    "excluded": []
  }
}
{
  "id": "3\n",
  "method": "completion.getSuggestions\n",
  "params": {
    "file": "path/to/some/file.dart\n",
    "offset": 673
  }
}