question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Entering opening brace causes code snippet suggestions to appear

See original GitHub issue

Describe the bug When typing out a {, instead of just auto-completing the other }, it also pops up the dart code snippets so if you just hit enter you’ll insert the first code snippet instead of simply entering a new line to start typing inside your new set of braces.

To Reproduce

  1. Open any dart file.
  2. Enter a {
  3. Hit enter

Expected behavior It should not show any snippet suggestions.

Screenshots Screen Shot 2021-11-15 at 3 08 24 PM

Versions (please complete the following information):

  • VS Code version:
Version: 1.63.0-insider
Commit: 035eaab2cb31798c6ae90a35928c62117cb52fcd
Date: 2021-11-15T05:26:27.466Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 21.1.0
  • Dart extension version: 3.28.0
  • Dart/Flutter SDK version: 2.5.3

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Nov 15, 2021

I don’t think there’s anything Dart-Code can do here. It seems like the triggerCharacters set up for Dart’s completion are causing VS Code to also show user snippets. Since triggerCharacters don’t have any context, they always fire unconditionally and any context must be handled by the server/completion provider. In this case, that is VS Code’s snippet handler.

There’s a similar issue at https://github.com/microsoft/vscode/issues/65200 and the suggestion is to set "editor.snippetSuggestions": "none". I suspect "editor.suggestOnTriggerCharacters": false, will also work, although both may disable functionality you might want.

0reactions
DanTupcommented, Nov 22, 2021

Looks like there was a VS Code change that caused this - see https://github.com/microsoft/vscode/issues/136611#issuecomment-975769359. It’s planned to be fixed in the next release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Surround code block with curly braces? - visual studio
You can use the "surround with" with a custom snippet. ... Go to the snippet manager (Tools > Code Snippets Manager) ... Alt...
Read more >
Braces inside snippet placeholders don't work correctly #90250
The cursor should start outside the closing brace, and backspace should delete the closing brace as well. Does this issue occur when all ......
Read more >
Creating Code Snippets in C# - Customize Visual Studio for ...
Code snippets in Visual Studio can make you much more efficient. In this video, we are going to look at how easy it...
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API. VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This...
Read more >
Adding PowerShell Snippets to Visual Studio Code
Hit Enter and the snippet is inserted. image. Let's add another snippet. After the closing curly brace for the Quote snippet, type a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found