iamcco / coc-flutter

flutter support for (Neo)vim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Error: An error occurred while handling workspace/willRenameFiles request

lcdsmao opened this issue · comments

Describe the bug
Rename file error.
Only the file itself got the new name, but any reference doesn't get an update.

[coc.nvim]: UnhandledRejection: An error occurred while handling workspace/willRenameFiles request
Error: An error occurred while handling workspace/willRenameFiles request
    at Ol (/Users/mao/.config/nvim/plugged/coc.nvim/build/index.js:37:224)
    at Sp (/Users/mao/.config/nvim/plugged/coc.nvim/build/index.js:36:11261)
    at Immediate.<anonymous> (/Users/mao/.config/nvim/plugged/coc.nvim/build/index.js:36:11111)
    at processImmediate (node:internal/timers:464:21)

To Reproduce

  1. run :CocCommand workspace.renameCurrentFile
  2. enter a new filename
  3. the error occurs

Expected behavior

The file itself gets renamed and all references get the update.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: 11.6
  • Vim or Neovim: NeoVim
  • (Neo)vim version: 0.5.1

Output channel:

  1. Set "flutter.trace.server": "verbose"
  2. Restart coc using :CocRestart
  3. Reproduce the issue
  4. :CocCommand workspace.showOutput open output list and select flutter

Paste Log from above:

Config
If you have any config for this specific extenstion in you coc-settings please include them here.

Which version of dart are you using?

Hi @Kavantix
Versions I am using are:
coc-flutter: 1.9.6
flutter: 2.5.3

Can you share the flutter.lsp log when this happens

@Kavantix
Here is the log:

Log
[Error  - 10:25:20 AM] Failed to determine file type for file:///Users/mao/Desktop/dart/playground/lib/main.dart.
[Trace - 10:25:20 AM] Sending request 'workspace/willRenameFiles - (1)'.
Params: {
    "files": [
        {
            "oldUri": "file:///Users/mao/Desktop/dart/playground/lib/main.dart",
            "newUri": "file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"
        }
    ]
}


[Trace - 10:25:20 AM] Sending notification 'textDocument/didClose'.
Params: {
    "textDocument": {
        "uri": "file:///Users/mao/Desktop/dart/playground/lib/main.dart"
    }
}


[Trace - 10:25:20 AM] Received request 'window/workDoneProgress/create - (4)'.
Params: {
    "token": "ANALYZING"
}


[Trace - 10:25:20 AM] Sending response 'window/workDoneProgress/create - (4)'. Processing request took 0ms
No result returned.


[Trace - 10:25:20 AM] Received notification '$/progress'.
Params: {
    "token": "ANALYZING",
    "value": {
        "kind": "begin",
        "title": "Analyzing…"
    }
}


[Trace - 10:25:20 AM] Sending notification 'textDocument/didOpen'.
Params: {
    "textDocument": {
        "uri": "file:///Users/mao/Desktop/dart/playground/lib/main_0.dart",
        "languageId": "dart",
        "version": 1,
        "text": "import 'package:flutter/material.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n  // This widget is the root of your application.\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      title: 'Flutter Demo',\n      theme: ThemeData(\n        primarySwatch: Colors.blue,\n      ),\n      home: MyHomePage(),\n    );\n  }\n}\n\nclass MyHomePage extends StatefulWidget {\n  @override\n  _MyHomePageState createState() => _MyHomePageState();\n}\n\nclass _MyHomePageState extends State<MyHomePage> {\n\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(),\n      body: Container(),\n    );\n  }\n}\n"
    }
}


[Trace - 10:25:20 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/mao/Desktop/dart/playground/lib/main.dart",
    "diagnostics": []
}


[Trace - 10:25:20 AM] Received response 'workspace/willRenameFiles - (1)' in 338ms. Request failed: An error occurred while handling workspace/willRenameFiles request (-32001).
[Trace - 10:25:20 AM] Received notification 'window/logMessage'.
Params: {
    "type": 1,
    "message": "An error occurred while handling workspace/willRenameFiles request: InconsistentAnalysisException: Requested result might be inconsistent with previously returned results\n\n#0      AnalysisSessionImpl._checkConsistency (package:analyzer/src/dart/analysis/session.dart:197:7)\n#1      AnalysisSessionImpl.getResolvedUnit (package:analyzer/src/dart/analysis/session.dart:171:5)\n#2      ChangeBuilderImpl._createDartFileEditBuilder (package:analyzer_plugin/src/utilities/change_builder/change_builder_core.dart:249:33)\n#3      ChangeBuilderImpl.addDartFileEdit (package:analyzer_plugin/src/utilities/change_builder/change_builder_core.dart:111:23)\n#4      MoveFileRefactoringImpl.createChange (package:analysis_server/src/services/refactoring/move_file.dart:149:27)\n<asynchronous suspension>\n#5      WillRenameFilesHandler._renameFile (package:analysis_server/src/lsp/handlers/handler_will_rename_files.dart:56:20)\n<asynchronous suspension>\n#6      ServerStateMessageHandler.handleMessage (package:analysis_server/src/lsp/handlers/handlers.dart:189:22)\n<asynchronous suspension>\n#7      LspAnalysisServer.handleMessage.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:330:26)\n<asynchronous suspension>\n"
}


[Error  - 10:25:20 AM] An error occurred while handling workspace/willRenameFiles request: InconsistentAnalysisException: Requested result might be inconsistent with previously returned results

#0      AnalysisSessionImpl._checkConsistency (package:analyzer/src/dart/analysis/session.dart:197:7)
#1      AnalysisSessionImpl.getResolvedUnit (package:analyzer/src/dart/analysis/session.dart:171:5)
#2      ChangeBuilderImpl._createDartFileEditBuilder (package:analyzer_plugin/src/utilities/change_builder/change_builder_core.dart:249:33)
#3      ChangeBuilderImpl.addDartFileEdit (package:analyzer_plugin/src/utilities/change_builder/change_builder_core.dart:111:23)
#4      MoveFileRefactoringImpl.createChange (package:analysis_server/src/services/refactoring/move_file.dart:149:27)
<asynchronous suspension>
#5      WillRenameFilesHandler._renameFile (package:analysis_server/src/lsp/handlers/handler_will_rename_files.dart:56:20)
<asynchronous suspension>
#6      ServerStateMessageHandler.handleMessage (package:analysis_server/src/lsp/handlers/handlers.dart:189:22)
<asynchronous suspension>
#7      LspAnalysisServer.handleMessage.<anonymous closure> (package:analysis_server/src/lsp/lsp_analysis_server.dart:330:26)
<asynchronous suspension>

[Trace - 10:25:20 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/mao/Desktop/dart/playground/lib/main_0.dart",
    "diagnostics": []
}


[Trace - 10:25:20 AM] Received notification 'dart/textDocument/publishClosingLabels'.
Params: {
    "uri": "file:///Users/mao/Desktop/dart/playground/lib/main_0.dart",
    "labels": [
        {
            "range": {
                "start": {
                    "line": 10,
                    "character": 11
                },
                "end": {
                    "line": 16,
                    "character": 5
                }
            },
            "label": "MaterialApp"
        },
        {
            "range": {
                "start": {
                    "line": 12,
                    "character": 13
                },
                "end": {
                    "line": 14,
                    "character": 7
                }
            },
            "label": "ThemeData"
        },
        {
            "range": {
                "start": {
                    "line": 29,
                    "character": 11
                },
                "end": {
                    "line": 32,
                    "character": 5
                }
            },
            "label": "Scaffold"
        }
    ]
}


[Trace - 10:25:20 AM] Received notification 'textDocument/publishDiagnostics'.
Params: {
    "uri": "file:///Users/mao/Desktop/dart/playground/test/widget_test.dart",
    "diagnostics": [
        {
            "range": {
                "start": {
                    "line": 10,
                    "character": 7
                },
                "end": {
                    "line": 10,
                    "character": 37
                }
            },
            "severity": 1,
            "code": "uri_does_not_exist",
            "source": "dart",
            "message": "Target of URI doesn't exist: 'package:playground/main.dart'.\nTry creating the file referenced by the URI, or Try using a URI for a file that does exist."
        },
        {
            "range": {
                "start": {
                    "line": 15,
                    "character": 28
                },
                "end": {
                    "line": 15,
                    "character": 33
                }
            },
            "severity": 1,
            "code": "undefined_function",
            "source": "dart",
            "message": "The function 'MyApp' isn't defined.\nTry importing the library that defines 'MyApp', correcting the name to the name of an existing function, or defining a function named 'MyApp'."
        }
    ]
}


[Trace - 10:25:20 AM] Received notification '$/progress'.
Params: {
    "token": "ANALYZING",
    "value": {
        "kind": "end"
    }
}

Reproduce this with a sample project contains these files:

  • lib/main
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(),
      body: Container(),
    );
  }
}
  • test/widget_test.dart
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:playground/main.dart';

void main() {
  testWidgets('Counter increments smoke test', (WidgetTester tester) async {
    // Build our app and trigger a frame.
    await tester.pumpWidget(MyApp());

    // Verify that our counter starts at 0.
    expect(find.text('0'), findsOneWidget);
    expect(find.text('1'), findsNothing);

    // Tap the '+' icon and trigger a frame.
    await tester.tap(find.byIcon(Icons.add));
    await tester.pump();

    // Verify that our counter has incremented.
    expect(find.text('0'), findsNothing);
    expect(find.text('1'), findsOneWidget);
  });
}

From the log it seems to go wrong on the dart side.
Have you tried if it does work in vscode?

Yes, it works in vscode.
I have tried to capture some logs:

Log
!! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!

Dart Code extension: 3.28.0
Flutter extension: 3.28.0 (activated)

App: Visual Studio Code
Version: 1.62.3
Platform: mac

Workspace type: Flutter
Analyzer type: LSP
Multi-root?: false

Dart SDK:
    Loc: /Users/mao/flutter/bin/cache/dart-sdk
    Ver: 2.14.4
Flutter SDK:
    Loc: /Users/mao/flutter
    Ver: 2.5.3

HTTP_PROXY: undefined
NO_PROXY: undefined

Logging Categories:
    General, Analyzer, CommandProcesses

Wed Nov 24 2021 [16:52:13 GMT+0900 (Japan Standard Time)] Log file started
[4:52:22 PM] [Analyzer] [Info] ==> Content-Length: 221
[4:52:22 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":50,"method":"workspace/willRenameFiles","params":{"files":[{"oldUri":"file:///Users/mao/Desktop/dart/playground/lib/main.dart","newUri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"}]}}
[4:52:22 PM] [Analyzer] [Info] <== Content-Length: 291
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:22 PM] [Analyzer] [Info] <== {"id":50,"jsonrpc":"2.0","result":{"documentChanges":[{"textDocument":{"version":3,"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart"},"edits":[{"range":{"start":{"line":3,"character":7},"end":{"line":3,"character":37}},"newText":"'package:playground/main_0.dart'"}]}]}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 318
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","version":4},"contentChanges":[{"range":{"start":{"line":3,"character":7},"end":{"line":3,"character":37}},"rangeLength":30,"text":"'package:playground/main_0.dart'"}]}}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 97
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"id":8,"method":"window/workDoneProgress/create","params":{"token":"ANALYZING"},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 38
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":8,"result":null}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 118
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"begin","title":"Analyzing…"}},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 142
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"textDocument/didClose","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main.dart"}}}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 160
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 895
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart","languageId":"dart","version":1,"text":"import 'package:flutter/material.dart';\n\nvoid main() {\n  runApp(MyApp());\n}\n\nclass MyApp extends StatelessWidget {\n  // This widget is the root of your application.\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      title: 'Flutter Demo',\n      theme: ThemeData(\n        primarySwatch: Colors.blue,\n      ),\n      home: MyHomePage(),\n    );\n  }\n}\n\nclass MyHomePage extends StatefulWidget {\n  @override\n  _MyHomePageState createState() => _MyHomePageState();\n}\n\nclass _MyHomePageState extends State<MyHomePage> {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      appBar: AppBar(),\n      body: Container(),\n    );\n  }\n}\n"}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 257
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":51,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"},"range":{"start":{"line":0,"character":0},"end":{"line":0,"character":0}},"context":{"diagnostics":[]}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 158
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":52,"method":"textDocument/documentSymbol","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 199
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":53,"method":"textDocument/documentHighlight","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"},"position":{"line":22,"character":49}}}
[4:52:25 PM] [Analyzer] [Info] <== {"method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","diagnostics":[]},"jsonrpc":"2.0"}Content-Length: 162
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishClosingLabels","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","labels":[]},"jsonrpc":"2.0"}Content-Length: 1100
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"element":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"children":[{"element":{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"codeRange":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"children":[{"element":{"range":{"start":{"line":6,"character":2},"end":{"line":6,"character":13}},"name":"testWidgets(\"Counter increments smoke test\")","kind":"UNIT_TEST_TEST"},"range":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"codeRange":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}}}]}]}},"jsonrpc":"2.0"}Content-Length: 1428
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishFlutterOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"char…
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 163
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":54,"method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 239
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":55,"method":"textDocument/semanticTokens/range","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"},"range":{"start":{"line":0,"character":0},"end":{"line":34,"character":0}}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 156
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":56,"method":"textDocument/foldingRange","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 169
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":57,"method":"textDocument/semanticTokens/full","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart"}}}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 160
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","diagnostics":[]},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 162
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"dart/textDocument/publishClosingLabels","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","labels":[]},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 1100
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"element":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"children":[{"element":{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"codeRange":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"children":[{"element":{"range":{"start":{"line":6,"character":2},"end":{"line":6,"character":13}},"name":"testWidgets(\"Counter increments smoke test\")","kind":"UNIT_TEST_TEST"},"range":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"codeRange":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}}}]}]}},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 1428
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishFlutterOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"children":[{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"codeRange":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"children":[{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":6,"character":2},"end":{"line":6,"character":13}},"name":"testWidgets(\"Counter increments smoke test\")","kind":"UNIT_TEST_TEST"},"range":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"codeRange":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"children":[{"kind":"NEW_INSTANCE","className":"MyApp","attributes":[],"range":{"start":{"line":8,"character":28},"end":{"line":8,"character":35}},"codeRange":{"start":{"line":8,"character":28},"end":{"line":8,"character":35}},"children":[]}]}]}]}},"jsonrpc":"2.0"}Content-Length: 635
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":56,"jsonrpc":"2.0","result":[{"startLine":2,"startCharacter":13,"endLine":4,"endCharacter":0},{"startLine":6,"startCharacter":37,"endLine":18,"endCharacter":0},{"startLine":9,"startCharacter":38,"endLine":17,"endCharacter":2},{"startLine":10,"startCharacter":23,"endLine":16,"endCharacter":4},{"startLine":12,"startCharacter":23,"endLine":14,"endCharacter":6},{"startLine":20,"startCharacter":41,"endL…
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 261
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":58,"method":"textDocument/codeAction","params":{"textDocument":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart"},"range":{"start":{"line":22,"character":49},"end":{"line":22,"character":49}},"context":{"diagnostics":[]}}}
[4:52:25 PM] [Analyzer] [Info] ==> Content-Length: 63
[4:52:25 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","method":"$/cancelRequest","params":{"id":51}}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 154
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart","diagnostics":[]},"jsonrpc":"2.0"}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 453
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"dart/textDocument/publishClosingLabels","params":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart","labels":[{"range":{"start":{"line":10,"character":11},"end":{"line":16,"character":5}},"label":"MaterialApp"},{"range":{"start":{"line":12,"character":13},"end":{"line":14,"character":7}},"label":"ThemeData"},{"range":{"start":{"line":28,"character":11},"end":{"line":31,"character":5}},"label":"Scaffold"}]},"jsonrpc":"2.0"}Content-Length: 4511
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"dart/textDocument/publishOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/lib/main_0.dart","outline":{"element":{"range":{"start":{"line":0,"character":0},"end":{"line":34,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":34,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":34,"character":0}},"children":[{"element":{"range":{"start":{"line":2,"character":5},"end":{"line":2,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":2,"character":0},"end":{"line":4,"character":1}},"codeRange":{"start":{"line":2,"character":0},"end":{"line":4,"character":1}},"children":[{"element":{"range":{"start":{"line":3,"character":9},"end":{"line":3,"character":9}},"name":"MyApp","kind":"CONSTRUCTOR_INVOCATION"},"range":{"start":{"line":3,"character":9},"end":{"line":3,"character":16}},"codeRange":{"start":{"line":3,"character":9},"end":{"line":3,"character":16}}}]},{"element":{"range":{"start":{"line":6,"character":6},"end":{"line":6,"character":11}},"name":"MyApp","kind":"CLASS"},"range":{"start":{"line":6,"character":0},"end":{"line":18,"character":1}},"codeRange":{"start":{"line":6,"character":0},"end":{"line":18,"character":1}},"children":[{"element":{"range":{"start":{"line":9,"character":9},"end":{"line":9,"character":14}},"name":"build","kind":"METHOD","parameters":"(BuildContext context)","returnType":"Widget"},"range":{"start":{"line":8,"character":2},"end":{"line":17,"character":3}},"codeRange":{"start":{"line":9,"character":2},"end":{"line":17,"character":3}},"children":[{"element":{"range":{"start":{"line":10,"character":11},"end":{"line":10,"character":11}},"name":"MaterialApp","kind":"CONSTRUCTOR_INVOCATION"},"range":{"start":{"line":10,"character":11},"end":{"line":16,"character":5}},"codeRange":{"start":{"line":10,"character":11},"end":{"line":16,"character":5}},"children":[{"element":{"r…
[4:52:25 PM] [Analyzer] [Info] <== s":"(BuildContext context)","returnType":"Widget"},"range":{"start":{"line":26,"character":2},"end":{"line":32,"character":3}},"codeRange":{"start":{"line":27,"character":2},"end":{"line":32,"character":3}},"children":[{"kind":"NEW_INSTANCE","className":"Scaffold","attributes":[],"range":{"start":{"line":28,"character":11},"end":{"line":31,"character":5}},"codeRange":{"start":{"line":28,"character":11},"end":{"line":31,"character":5}},"children":[{"kind":"NEW_INSTANCE","className":"AppBar","attributes":[],"range":{"start":{"line":29,"character":14},"end":{"line":29,"character":22}},"codeRange":{"start":{"line":29,"character":14},"end":{"line":29,"character":22}},"children":[]},{"kind":"NEW_INSTANCE","className":"Container","attributes":[],"range":{"start":{"line":30,"character":12},"end":{"line":30,"character":23}},"codeRange":{"start":{"line":30,"character":12},"end":{"line":30,"character":23}},"children":[]}]}]}]}]}},"jsonrpc":"2.0"}Content-Length: 1633
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":52,"jsonrpc":"2.0","result":[{"name":"main","detail":"()","kind":12,"deprecated":false,"range":{"start":{"line":2,"character":0},"end":{"line":4,"character":1}},"selectionRange":{"start":{"line":2,"character":5},"end":{"line":2,"character":9}}},{"name":"MyApp","kind":5,"deprecated":false,"range":{"start":{"line":6,"character":0},"end":{"line":18,"character":1}},"selectionRange":{"start":{"line":6,"character":6},"end":{"line":6,"character":11}},"children":[{"name":"build","detail":"(BuildContext context)","kind":6,"deprecated":false,"range":{"start":{"line":9,"character":2},"end":{"line":17,"character":3}},"selectionRange":{"start":{"line":9,"character":9},"end":{"line":9,"character":14}}}]},{"name":"MyHomePage","kind":5,"deprecated":false,"range":{"start":{"line":20,"character":0},"end":{"line":23,"character":1}},"selectionRange":{"start":{"line":20,"character":6},"end":{"line":20,"character":16}},"children":[{"name":"createState","detail":"()","…
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 637
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":55,"jsonrpc":"2.0","result":{"data":[0,0,6,1,0,0,7,31,15,0,2,0,4,1,256,0,5,4,16,6,1,2,6,16,0,0,7,5,2,64,3,0,5,1,0,0,6,5,2,0,0,6,7,1,0,0,8,15,2,0,1,2,47,3,0,1,2,1,0,0,0,1,8,10,0,1,2,6,2,0,0,7,5,11,2,0,6,12,2,0,0,13,7,5,2,1,4,6,1,16,0,7,11,2,64,1,6,5,5,32,0,7,14,15,0,1,6,5,5,32,0,7,9,2,64,1,8,13,5,32,0,15,6,2,0,0,7,4,10,4,2,6,4,5,32,0,6,10,2,64,5,0,5,1,0,0,6,10,2,0,0,11,7,1,0,0,8,14,2,0,1,2,1,0,0,0,1,8,10,0,1,2,16,2,0,0,17,11,11,2,0,17,16,2,64,3,0,5,1,0,0,6,16,2,0,0,17,7,1,0,0,8,5,2,0,0,6,10,2,0,1,2,1,0,0,0,1,8,10,0,1,2,6,2,0,0,7,5,11,2,0,6,12,2,0,0,13,7,5,2,1,4,6,1,16,0,7,8,2,64,1,6,6,5,32,0,8,6,2,64,1,6,4,5,32,0,6,9,2,64]}}Content-Length: 274
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":53,"jsonrpc":"2.0","result":[{"range":{"start":{"line":22,"character":2},"end":{"line":22,"character":18}}},{"range":{"start":{"line":22,"character":36},"end":{"line":22,"character":52}}},{"range":{"start":{"line":25,"character":6},"end":{"line":25,"character":22}}}]}Content-Length: 83
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"id":51,"jsonrpc":"2.0","error":{"code":-32800,"message":"Request was cancelled"}}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 1040
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"id":58,"jsonrpc":"2.0","result":[{"title":"Sort Members","kind":"source.sortMembers","command":{"title":"Sort Members","command":"edit.sortMembers","arguments":["/Users/mao/Desktop/dart/playground/lib/main_0.dart"]}},{"title":"Organize Imports","kind":"source.organizeImports","command":{"title":"Organize Imports","command":"edit.organizeImports","arguments":["/Users/mao/Desktop/dart/playground/lib/main_0.dart"]}},{"title":"Fix All","kind":"source.fixAll","command":{"title":"Fix All","command":"edit.fixAll","arguments":["/Users/mao/Desktop/dart/playground/lib/main_0.dart"]}},{"title":"Extract Method","kind":"refactor.extract","command":{"title":"Extract Method","command":"refactor.perform","arguments":["EXTRACT_METHOD","/Users/mao/Desktop/dart/playground/lib/main_0.dart",1,481,0,null]}},{"title":"Extract Local Variable","kind":"refactor.extract","command":{"title":"Extract Local Variable","command":"refactor.perform","arguments":["EXTRACT_LOCAL_VARIABLE","/Users/mao/Desktop/dart/playground/lib/main_0.dart",1,481,0,null]}}]}
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 160
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"textDocument/publishDiagnostics","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","diagnostics":[]},"jsonrpc":"2.0"}Content-Length: 162
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishClosingLabels","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","labels":[]},"jsonrpc":"2.0"}Content-Length: 1100
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"method":"dart/textDocument/publishOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"element":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"children":[{"element":{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"codeRange":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"children":[{"element":{"range":{"start":{"line":6,"character":2},"end":{"line":6,"character":13}},"name":"testWidgets(\"Counter increments smoke test\")","kind":"UNIT_TEST_TEST"},"range":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"codeRange":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}}}]}]}},"jsonrpc":"2.0"}Content-Length: 1428
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"dart/textDocument/publishFlutterOutline","params":{"uri":"file:///Users/mao/Desktop/dart/playground/test/widget_test.dart","outline":{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"name":"<unit>","kind":"COMPILATION_UNIT"},"range":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"codeRange":{"start":{"line":0,"character":0},"end":{"line":23,"character":0}},"children":[{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":5,"character":5},"end":{"line":5,"character":9}},"name":"main","kind":"FUNCTION","parameters":"()","returnType":"void"},"range":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"codeRange":{"start":{"line":5,"character":0},"end":{"line":22,"character":1}},"children":[{"kind":"DART_ELEMENT","dartElement":{"range":{"start":{"line":6,"character":2},"end":{"line":6,"character":13}},"name":"testWidgets(\"Counter increments smoke test\")","kind":"UNIT_TEST_TEST"},"range":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"codeRange":{"start":{"line":6,"character":2},"end":{"line":21,"character":4}},"children":[{"kind":"NEW_INSTANCE","className":"MyApp","attributes":[],"range":{"start":{"line":8,"character":28},"end":{"line":8,"character":35}},"codeRange":{"start":{"line":8,"character":28},"end":{"line":8,"character":35}},"children":[]}]}]}]}},"jsonrpc":"2.0"}Content-Length: 613
Content-Type: application/vscode-jsonrpc; charset=utf-8

{"id":57,"jsonrpc":"2.0","result":{"data":[0,0,6,1,0,0,7,31,15,0,1,0,6,1,0,0,7,40,15,0,2,0,6,1,0,0,7,32,15,0,2,0,4,1,256,0,5,4,16,6,1,2,11,16,0,0,12,31,15,0,0,34,12,2,0,0,13,6,5,2,0,8,5,1,16,1,4,37,3,0,1,4,5,1,16,0,6,6,5,0,0,7,10,11,0,0,11,5,2,64,2,4,39,3,0,1,4,6,16,0,0,7,4,10,0,0,5,4,11,0,0,5,3,15,0,0,6,14,10,0,1,4,6,16,0,0,7,4,10,0,0,5,4,11,0,0,5,3,15,0,0,6,12,10,0,2,4,40,3,0,1,4,5,1,16,0,6,6,5,0,0,7,3,11,0,0,4,4,10,0,0,5,6,11,0,0,7,5,2,0,0,6,3,10,4,1,4,5,1,16,0,6,6,5,0,0,7,4,11,0,…
[4:52:25 PM] [Analyzer] [Info] <== Content-Length: 93
Content-Type: application/vscode-jsonrpc; charset=utf-8
[4:52:25 PM] [Analyzer] [Info] <== {"method":"$/progress","params":{"token":"ANALYZING","value":{"kind":"end"}},"jsonrpc":"2.0"}
Wed Nov 24 2021 [16:52:27 GMT+0900 (Japan Standard Time)] Log file ended

Looking at the log, is the editor closing/renaming the file before the willRenameFiles request completes? The rename operation should be blocked until it completes, as willRenameFiles is intended for servers that need to compute edits before the rename occurs (didRenameFiles is the equivalent notification where the server does not need to compute editors prior to the rename).

https://microsoft.github.io/language-server-protocol/specifications/specification-current/#workspace_willRenameFiles

The will rename files request is sent from the client to the server before files are actually renamed as long as the rename is triggered from within the client either by a user action or by applying a workspace edit. The request can return a WorkspaceEdit which will be applied to workspace before the files are renamed.

Hmm that sounds like a bug in coc then, right @iamcco?

@lcdsmao for me this feature now seems to work perfectly with the latest coc.nvim and latest dart 2.15
So I'm gonna close this, if you still experience this let me know and I'll reopen

@Kavantix
Thanks!
I will try again when our project is updated to flutter 2.8.