bradyt / bradyt/dart-server

Flycheck does not Fly

Open
#4 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Emacs Lisp
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Flycheck does not update the file after newline or after the buffer is changed and idle:

![image](https://user-images.githubusercontent.com/29614760/49771357-9657a400-fce0-11e8-80e8-9bc306808249.png)

after correcting an error the, error persists on screen until the save:
![image](https://user-images.githubusercontent.com/29614760/49771496-4af1c580-fce1-11e8-960d-5e6b421c097d.png)

after correcting:
```
2018-12-11T01:05:18+0000
Sent: {"id":"64","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"add","content":"import 'package:flutter/material.dart';\n\nvoid main() => runApp(MyApp());\n\nclass MyApp extends StatelessWidget {\n // This widget is the root of your application.\n\n @override\n iWdget build(BuildContext context) {\n return MaterialApp(\n title: 'Flutter Demo',\n theme: ThemeData(\n // This is the theme of your application.\n //\n // Try running your application with \"flutter run\". You'll see the\n // application has a blue toolbar. Then, without quitting the app, try\n // changing the primarySwatch below to Colors.green and then invoke\n // \"hot reload\" (press \"r\" in the console where you ran \"flutter run\",\n // or simply save your changes to \"hot reload\" in a Flutter IDE).\n // Notice that the counter didn't reset back to zero; the application\n // is not restarted.\n primarySwatch: Colors.blue,\n ),\n home: MyHomePage(title: 'Flutter Demo Home Page'),\n );\n }\n}\n\nclass MyHomePage extends StatefulWidget {\n MyHomePage({Key key, this.title}) : super(key: key);\n\n // This widget is the home page of your application. It is stateful, meaning\n // that it has a State object (defined below) that contains fields that affect\n // how it looks.\n\n // This class is the configuration for the state. It holds the values (in this\n // case the title) provided by the parent (in this case the App widget) and\n // used by the build method of the State. Fields in a Widget subclass are\n // always marked \"final\".\n\n final String title;\n\n @override\n _MyHomePageState createState() => _MyHomePageState();\n}\n\nclass _MyHomePageState extends State {\n int _counter = 0;\n\n void _incrementCounter() {\n setState(() {\n // This call to setState tells the Flutter framework that something has\n // changed in this State, which causes it to rerun the build method below\n // so that the display can reflect the updated values. If we changed\n // _counter without calling setState(), then the build method would not be\n // called again, and so nothing would appear to happen.\n _counter++;\n });\n }\n\n @override\n Widget build(BuildContext context) {\n // This method is rerun every time setState is called, for instance as done\n // by the _incrementCounter method above.\n //\n // The Flutter framework has been optimized to make rerunning build methods\n // fast, so that you can just rebuild anything that needs updating rather\n // than having to individually change instances of widgets.\n return Scaffold(\n appBar: AppBar(\n // Here we take the value from the MyHomePage object that was created by\n // the App.build method, and use it to set our appbar title.\n title: Text(widget.title),\n ),\n body: Center(\n // Center is a layout widget. It takes a single child and positions it\n // in the middle of the parent.\n child: Column(\n // Column is also layout widget. It takes a list of children and\n // arranges them vertically. By default, it sizes itself to fit its\n // children horizontally, and tries to be as tall as its parent.\n //\n // Invoke \"debug painting\" (press \"p\" in the console, choose the\n // \"Toggle Debug Paint\" action from the Flutter Inspector in Android\n // Studio, or the \"Toggle Debug Paint\" command in Visual Studio Code)\n // to see the wireframe for each widget.\n //\n // Column has various properties to control how it sizes itself and\n // how it positions its children. Here we use mainAxisAlignment to\n // center the children vertically; the main axis here is the vertical\n // axis because Columns are vertical (the cross axis would be\n // horizontal).\n mainAxisAlignment: MainAxisAlignment.center,\n children: [\n Text(\n 'You have pushed the button this many times:',\n ),\n Text(\n '$_counter',\n style: Theme.of(context).textTheme.display1,\n ),\n ],\n ),\n ),\n floatingActionButton: FloatingActionButton(\n onPressed: _incrementCounter,\n tooltip: 'Increment',\n child: Icon(Icons.add),\n ), // This trailing comma makes auto-formatting nicer for build methods.\n );\n }\n}\n"}}}}

2018-12-11T01:05:18+0000
Sent: {"id":"65","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"change","edits":[{"offset":179,"length":0,"replacement":"i"}]}}}}

2018-12-11T01:05:18+0000
Sent: {"id":"66","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"change","edits":[{"offset":178,"length":1,"replacement":""}]}}}}

2018-12-11T01:05:18+0000
Sent: {"id":"67","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"change","edits":[{"offset":177,"length":0,"replacement":"W"}]}}}}

2018-12-11T01:05:18+0000
Sent: {"id":"68","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"change","edits":[{"offset":178,"length":1,"replacement":""}]}}}}

2018-12-11T01:05:18+0000
Received: {"id":"64","result":{}}

2018-12-11T01:05:18+0000
Received: {"id":"65","result":{}}

2018-12-11T01:05:18+0000
Received: {"id":"66","result":{}}

2018-12-11T01:05:18+0000
Received: {"id":"67","result":{}}

2018-12-11T01:05:18+0000
Received: {"id":"68","result":{}}

2018-12-11T01:05:19+0000
Checking syntax for main.dart

2018-12-11T01:05:19+0000
Sent: {"id":"69","method":"analysis.getErrors","params":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart"}}

2018-12-11T01:05:19+0000
Received: {"id":"69","result":{"errors":[{"severity":"ERROR","type":"STATIC_WARNING","location":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","offset":185,"length":6,"startLine":9,"startColumn":3},"message":"Undefined class 'iWdget'.","correction":"Try changing the name to the name of an existing class, or creating a class with the name 'iWdget'.","code":"undefined_class","hasFix":true},{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","offset":172,"length":807,"startLine":8,"startColumn":3},"message":"'MyApp.build' ('(BuildContext) → dynamic') isn't a valid override of 'StatelessWidget.build' ('(BuildContext) → Widget').","code":"invalid_override","hasFix":false}]}}

2018-12-11T01:05:19+0000
Reporting to flycheck: ((id . 69) (result (errors ((severity . ERROR) (type . STATIC_WARNING) (location (file . e:\Projects\Flutter\my_chat_app\lib\main.dart) (offset . 185) (length . 6) (startLine . 9) (startColumn . 3)) (message . Undefined class 'iWdget'.) (correction . Try changing the name to the name of an existing class, or creating a class with the name 'iWdget'.) (code . undefined_class) (hasFix . t)) ((severity . ERROR) (type . COMPILE_TIME_ERROR) (location (file . e:\Projects\Flutter\my_chat_app\lib\main.dart) (offset . 172) (length . 807) (startLine . 8) (startColumn . 3)) (message . 'MyApp.build' ('(BuildContext) → dynamic') isn't a valid override of 'StatelessWidget.build' ('(BuildContext) → Widget').) (code . invalid_override) (hasFix . :json-false)))))

2018-12-11T01:05:19+0000
Parsed errors: (#s(flycheck-error main.dart dart-analysis-server e:\Projects\Flutter\my_chat_app\lib\main.dart 9 3 Undefined class 'iWdget'. error nil nil) #s(flycheck-error main.dart dart-analysis-server e:\Projects\Flutter\my_chat_app\lib\main.dart 8 3 'MyApp.build' ('(BuildContext) → dynamic') isn't a valid override of 'StatelessWidget.build' ('(BuildContext) → Widget'). error nil nil))

2018-12-11T01:05:19+0000
Received: {"event":"analysis.errors","params":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","errors":[{"severity":"ERROR","type":"STATIC_WARNING","location":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","offset":185,"length":6,"startLine":9,"startColumn":3},"message":"Undefined class 'iWdget'.","correction":"Try changing the name to the name of an existing class, or creating a class with the name 'iWdget'.","code":"undefined_class","hasFix":true},{"severity":"ERROR","type":"COMPILE_TIME_ERROR","location":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","offset":172,"length":807,"startLine":8,"startColumn":3},"message":"'MyApp.build' ('(BuildContext) → dynamic') isn't a valid override of 'StatelessWidget.build' ('(BuildContext) → Widget').","code":"invalid_override","hasFix":false}]}}
```

and after the save:

```

2018-12-11T01:05:57+0000
C:/Program Files/Dart/dart-sdk/bin/dartfmt (--line-length 80 --overwrite c:/Users/USER/AppData/Local/Temp/formatzrKP1C.dart)

2018-12-11T01:05:58+0000
Checking syntax for main.dart

2018-12-11T01:05:58+0000
Sent: {"id":"70","method":"analysis.getErrors","params":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart"}}

2018-12-11T01:05:58+0000
Sent: {"id":"71","method":"analysis.updateContent","params":{"files":{"e:/Projects/Flutter/my_chat_app/lib/main.dart":{"type":"remove"}}}}

2018-12-11T01:05:58+0000
Received: {"event":"analysis.errors","params":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","errors":[]}}

2018-12-11T01:05:58+0000
Received: {"id":"70","result":{"errors":[]}}

2018-12-11T01:05:58+0000
Reporting to flycheck: ((id . 70) (result (errors)))

2018-12-11T01:05:58+0000
Parsed errors: nil

2018-12-11T01:05:58+0000
Received: {"event":"analysis.errors","params":{"file":"e:\\Projects\\Flutter\\my_chat_app\\lib\\main.dart","errors":[]}}

2018-12-11T01:05:58+0000
Received: {"id":"71","result":{}}

2018-12-11T01:05:58+0000
Received: {"event":"analysis.flushResults","params":{"files":["e:\\Projects\\Flutter\\my_chat_app\\lib\\.#main.dart"]}}
```

This only happens with dart-mode. Flycheck works fine otherwise.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the dart-mode/Flycheck integration and the Dart analysis-server updateContent and analysis.errors flow shown in the report. Reproduce the idle buffer-change behavior and compare it with save; done means corrected errors disappear without saving while existing non-Dart Flycheck behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, emacs-lisp
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.