I’m using lsp-dart, and when using the Create missing override refactor, I’m getting weird completion. I’m wondering if I have something wrong going on in my config.

Here’s an example of the output I’m getting after doing the refactor:

 class MyWidget extends StatelessWidget {
}

After:

class MyWidget extends StatelessWidget {
  @override
  Widget build(1|BuildContext,Object| context) {
    throw UnimplementedError();
  }

There is some inbteresting part in logs:

"edit": {
      "documentChanges": [
        {
          "edits": [
            {
              "insertTextFormat": 2,
              "newText": "$0\n\n  @override\n  Widget build(${1|BuildContext,Object|} ${2:context}) {\n    // TODO: implement build\n    throw UnimplementedError();\n  }",
              "range": {
                "end": {
                  "character": 30,
                  "line": 74
                },

Reference:

  1. Language Server Protocol Specification - 3.17

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee