Skip to content

[lsp] - rename symbol keeping the same name #42573

Closed
@ericdallo

Description

@ericdallo

It seems that dart_analysis_server crashes when receive a textDocument/rename with the same symbol name on the newName field.

I could not reproduce it on VSCode because vscode seems to not send the textDocument/rename when the symbol name is the name, but on Emacs using lsp-dart, we send the textDocument/rename and after the server returns null on the response(Which is ok following the LSP spec), the dart_analysis_server process crash.

Some log from the lsp-dart client:

[Trace - 04:36:07 PM] Sending request 'textDocument/prepareRename - (183)'.
Params: {
  "textDocument": {
    "uri": "file:///home/greg/dev/flutter_sample/lib/screens/dashboard/components/rightscreen.dart"
  },
  "position": {
    "line": 52,
    "character": 21
  }
}

[Trace - 04:36:07 PM] Received response 'textDocument/prepareRename - (183)' in 8ms.
Result: {
  "placeholder": "_goToNextPage",
  "range": {
    "end": {
      "character": 28,
      "line": 52
    },
    "start": {
      "character": 15,
      "line": 52
    }
  }
}

[Trace - 04:36:12 PM] Sending request 'textDocument/rename - (184)'.
Params: {
  "textDocument": {
    "uri": "file:///home/greg/dev/flutter_sample/lib/screens/dashboard/components/rightscreen.dart"
  },
  "position": {
    "line": 52,
    "character": 21
  },
  "newName": "_goToNextPage"
}

[Trace - 04:36:12 PM] Received response 'textDocument/rename - (184)' in 7ms.
Result: null

Tested on flutter channel stable, dart 2.8.1 and flutter dev channel, Dart 2.9.0 (build 2.9.0-19.0.dev 7e72c9ae7e)

Metadata

Metadata

Assignees

No one assigned

    Labels

    devexp-lspIssues with analysis server's support of Language Server Protocoldevexp-serverIssues related to some aspect of the analysis serverlegacy-area-analyzerUse area-devexp instead.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions