Dart-code: "Wrap with widget" does not move the text cursor to the new parent widget when the 'previewLsp' setting is enabled

Created on 15 Feb 2021  路  2Comments  路  Source: Dart-Code/Dart-Code

Describe the bug
Normally, when the context menu is used to "Wrap with widget...", the cursor automatically selects the new "widget" text so the user can immediately type the name of the new parent widget. However, when the "previewLsp" setting is enabled, the cursor does not move from where it was when the context menu was invoked.

To Reproduce
Steps to reproduce the behavior:

  1. Enable the "previewLsp" setting
  2. Move the text cursor to a widget name
  3. Open the context menu (Ctrl + .)
  4. Select "Wrap with widget..."

Expected behavior
The text cursor should immediately select the newly added "widget" text.

Versions (please complete the following information):

  • VS Code version: 1.53.2
  • Dart extension version: 3.19.2
  • Dart/Flutter SDK version: Dart 2.12.0, Flutter 1.26.0-17.5.pre
in editor in lsanalysis server is bug

Most helpful comment

This is fixed by #3215.

All 2 comments

I looked into this, and re-discovered that it's because LSP has no support for code snippets (required to set cursor positions) in code actions. This might be a result of VS Code not having a good API for this either (the way it works in non-LSP involves custom code to apply the edit that is not trivial for LSP).

The relevant LSP issues are at:

This is fixed by #3215.

Was this page helpful?
0 / 5 - 0 ratings