From 9cf8d029b95cfe5d113bf8675f6c15be4f29f5d6 Mon Sep 17 00:00:00 2001 From: Warren Bickley Date: Tue, 13 Jun 2023 16:37:35 +0100 Subject: [PATCH] vscode documentation update --- README.md | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8ff4d8cd1..5f59c37cc 100644 --- a/README.md +++ b/README.md @@ -217,9 +217,28 @@ matrix( The official [prettier plugin for atom](https://github.com/prettier/prettier-atom) supports plugins. -### VScode +### Visual Studio Code -The official [prettier plugin for vscode](https://github.com/prettier/prettier-vscode) supports plugins since Version 1.10.0. To enable it, install the extension and make sure the plugin is installed _locally_ (in your project folder). After restarting VScode the plugin should work as expected. +The official [prettier plugin for vscode](https://github.com/prettier/prettier-vscode) supports plugins since Version 1.10.0. To enable it, install the extension and make sure the plugin is installed _locally_ (in your project folder). + +Visual Studio Code may not recognise the document selectors provided by this plugin, and so you can add php to your document selectors by adding the following line to `.vscode/settings.json`: + +```json + "prettier.documentSelectors": [ + "**/*.{js,jsx,ts,tsx,vue,html,css,scss,less,json,md,mdx,graphql,yaml,yml,php}" + ] +``` + +You may also need to declare php as the parser in your prettier config file: + +```json +{ + "parser": "php", + "plugins": ["@prettier/plugin-php"], +} +``` + +See (this issue)[https://github.com/prettier/plugin-php/issues/1730] for more discussion around potential VS Code solutions. ### PhpStorm / IntelliJ / Jetbrains IDE