Prettier-vscode: Cannot format files in VS Code remote environments (WSL, Docker)

Created on 2 Dec 2019  路  5Comments  路  Source: prettier/prettier-vscode

Summary

Prettier for VS Code is not formatting the php code.

Github Repository to Reproduce Issue

Any setup with Prettier and PHP plugin and any PHP file.
image

Steps To Reproduce:

  1. Install prettier and PHP plugin
  2. Create PHP file wrongly formatted such as indentation.
  3. Try format.

Expected result

File should be formatted as if were using CLI.

Actual result

VS Code shows message Extension 'Prettier - Code formatter' cannot format '_ide_helper.php'

Additional information

image

It works just perfect if using CLI. Image above displays CLI charming yet VS Code failing.

That clearly suggests that the PHP plugin and the Prettier itself are fine.

Also to note, I have used for good while setup where plugin-php would be installed inside the extension's folder. That also doesn't work anymore. :(

VS Code Version: 1.40.2 [latest]

Version: 1.40.2 (user setup)
Commit: f359dd69833dd8800b54d458f6d37ab7c78df520
Date: 2019-11-25T14:54:45.096Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18362

Prettier Extension Version: 3.11.0 [latest]

OS and version: Windows 10 1903 but working with WSL 1 Ubuntu 18

Prettier Log Output

image


["INFO" - 2:36:48 PM] Extension Name: "prettier-vscode".
["INFO" - 2:36:48 PM] Extension Version: "3.11.0".
["INFO" - 2:36:48 PM] Loaded module '[email protected]' from '/home/lukas/dev/malgodt/node_modules/prettier/index.js'
["INFO" - 2:36:48 PM] Enabling prettier in workspace 'malgodt' for languages:
[
  "javascript",
  "mongo",
  "javascriptreact",
  "typescript",
  "typescriptreact",
  "json",
  "jsonc",
  "json5",
  "css",
  "postcss",
  "less",
  "scss",
  "graphql",
  "markdown",
  "mdx",
  "html",
  "vue",
  "yaml",
  "php"
]
["INFO" - 2:36:48 PM] Enabling prettier for range supported languages
[
  "javascript",
  "javascriptreact",
  "typescript",
  "typescriptreact",
  "json",
  "graphql"
]
["INFO" - 2:36:50 PM] Loaded module '[email protected]' from '/home/lukas/dev/malgodt/node_modules/prettier/index.js'
locked

Most helpful comment

This should be fixed in 3.13+. Please reopen if you continue to see the issue.

All 5 comments

Update: the extention works fine when using locally. It seems the issue arises when using any kind of VS-Code remote such as WSL or Docker container. The log output doesn't show anything useful. I have no idea how to debug. Only the failure message Extension 'Prettier - Code formatter' cannot format... appears at the bottom :)

https://github.com/prettier/prettier-vscode/issues/1111#issuecomment-561278069

Install extension v3.9.0 can solve this problem temporarily

reverting to v3.9.0 worked for my remote workspace (extn has issue with formatting html files)

This should be fixed in 3.13+. Please reopen if you continue to see the issue.

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings