redhat-developer / redhat-developer/vscode-yaml

Default formatter not being set

Open
#1,041 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
829
Forks
260
Avg merge
5h 43m
Merged PRs (30d)
1

Description

Describe the bug

I have installed the Prettier for formatting my html, css, ... but I would like to use the Redhat YAML extension for formatting .yaml files however, when I attempt to select this extension as the default formatter I still get a warning that there is no default formatter for .yaml files.

It makes the change in the settings.json but it is not reflected in the editor window itself.

	"[yaml]": {
		"editor.defaultFormatter": "esbenp.prettier-vscode"
	},

-->

Expected Behavior

It should display in the editor window that there is a configured default formatter for .yaml files

Current Behavior

I receive the warning in the status bar that: "There are multiple formatters for 'YAML' file. One of them should be configured as the default formatter
Screenshot 2024-07-13 at 12 22 05

Steps to Reproduce

  1. Install both the Prettier and YAML extension
  2. Create a new .yaml file in an empty directory, containing the following schema
name: John Doe
age: 30
is_student: false
courses:
- Mathematics
  - Physics
  - Computer Science
address:
  street: 123 Main St
  city: Anytown
  state: CA
  postal_code: 12345
  1. Attempt to set the default formatter to YAML and observe the change the settings.json

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the warning in a new .yaml file with the Prettier and Red Hat YAML extensions installed, then inspect how the [yaml] editor.defaultFormatter setting is read and reflected in the editor. Done means selecting a formatter updates settings.json and the editor no longer reports that YAML has no configured default formatter.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.