Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add vscode config for prettier #442

Merged
merged 2 commits into from
Feb 18, 2024
Merged

feat: add vscode config for prettier #442

merged 2 commits into from
Feb 18, 2024

Conversation

Yordan-Ramchev
Copy link
Contributor

@Yordan-Ramchev Yordan-Ramchev commented Feb 5, 2024

Description

If the user picks prettier, then suggest the prettier .vscode extension, and add the settings.

settings.json

{
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true
}

extensions.json

{
  "recommendations": ["esbenp.prettier-vscode"]
}

Related Issue

re #302

Notes for Reviewers

  1. Create template/config/prettier/.vscode:
    1.1. extensions.json
    1.2. settings.json
  2. render('config/prettier') in index.ts
  3. Remove logic from renderEslint.ts for esbenp.prettier-vscode, as it is now moved to a dedicated file (template/config/prettier/.vscode/extensions.json)

Screenshots

Generated project without prettier

Screenshot 2024-02-05 at 20 52 54 Screenshot 2024-02-05 at 20 55 51

Generated project with prettier

Screenshot 2024-02-05 at 20 53 20 Screenshot 2024-02-05 at 20 54 48 Screenshot 2024-02-05 at 20 54 41

Copy link
Member

@cexbrayat cexbrayat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

I'm wondering something: what happens in vscode if the extension is not installed with this settings.json?

@Yordan-Ramchev
Copy link
Contributor Author

When the user is missing vscode extension (this case is covered in extensions.json to prompt the user to install it), but even in the case that they refuse to install it — they will get this message if they are missing the formatter.

Screenshot 2024-02-06 at 12 59 00

@cexbrayat
Copy link
Member

That sounds acceptable I guess. Let's ping @sodatea to see what he thinks about it

Copy link
Member

@haoqunjiang haoqunjiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks!

@haoqunjiang haoqunjiang merged commit e6321cf into vuejs:main Feb 18, 2024
101 checks passed
@Yordan-Ramchev Yordan-Ramchev deleted the feat-prettier-vscode-settings branch February 18, 2024 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants