Dart-Code / Dart-Code

Dart and Flutter support for VS Code
https://dartcode.org/
MIT License
1.5k stars 307 forks source link

Yaml autocompletion does not work in VS Code #5320

Open incendial opened 3 weeks ago

incendial commented 3 weeks ago

Describe the bug Autocompletion for analysis_options.yaml (and other yaml files) and not work on typing (but works on a shortcut, option + esc in my case).

To Reproduce Steps to reproduce the behavior:

  1. Open any analysis_options file
  2. Start typing

Please complete the following information:

Dart Code extension: 3.98.1

App: Visual Studio Code App Host: desktop Version: mac 1.94.2

Workspace type: Dart (LSP) Workspace name: dart-code-metrics-teams

Dart (3.5.1): /Users/incendial/Desktop/flutter/bin/cache/dart-sdk Flutter (3.24.1): /Users/incendial/Desktop/flutter (No device)

incendial commented 3 weeks ago

cc @DanTup

Related: https://github.com/microsoft/vscode/issues/232363

RedCMD commented 3 weeks ago

Dup: https://github.com/microsoft/vscode/issues/231224

did you disable RedHat's YAML extension?

otherwise you can enable suggestions for strings

"[yaml]": {
    "editor.quickSuggestions": {
        "strings": "on"
    }
}
incendial commented 3 weeks ago
"[yaml]": {
  "editor.quickSuggestions": {
      "strings": "on"
  }
}

While this solves my particular issue, there needs to be a way for yaml autocompletion to work out of the box as asking millions of dart devs to update their vscode setting is unfeasible.

DanTup commented 3 weeks ago

Yes, I don't think changing the settings is a good fix (either for users to do, or for the Dart extension to override). Unless there is a deliberate reason for it to work like this in VS Code (and I'm not thinking of one... many users think code completion is completely broken if it doesn't pop up automatically where they would expect), I feel like something needs to change there.

Personally I feel like either these things are not "strings", or the setting above should be default for YAML in VS Code... for other languages, strings means things the user would never expected to get completion on (they're just literal strings) though and I don't think that really applies for YAML (because pretty much anything, key or value, could get reasonable completion).

RedCMD commented 3 weeks ago

Yes, I don't think changing the settings is a good fix

thats a workaround for https://github.com/microsoft/vscode/issues/231224 user settings don't seem to be affected

as you can see the setting is already enabled for YAML (via RedHat) image

DanTup commented 3 weeks ago

as you can see the setting is already enabled for YAML (via RedHat)

Users might not have the RedHat extension.

I don't think it makes sense to require any extension that wants to provide any YAML suggestions to also have to override this setting.. Either it should not be required, or VS Code should have a sensible default.

In this case, we also only supply completion for a small number of YAML files, so changing the users settings for all YAML files isn't appropriate anyway.