question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot format files in VS Code remote environments (WSL, Docker)

See original GitHub issue

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 'prettier@1.19.1' 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 'prettier@1.19.1' from '/home/lukas/dev/malgodt/node_modules/prettier/index.js'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
ntottencommented, Dec 14, 2019

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

3reactions
ding-jscommented, Dec 6, 2019

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

Install extension v3.9.0 can solve this problem temporarily

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Dev Containers in WSL 2 - Visual Studio Code
We need to select the folder we want to open in a container. First, make sure you've installed the Dev Containers extension. We...
Read more >
Remote Development Tips and Tricks - Visual Studio Code
This article covers troubleshooting tips and tricks for each of the Visual Studio Code Remote Development extensions. See the SSH, Containers, and WSL...
Read more >
Docker Tools Tips and Tricks - Visual Studio Code
Make sure Docker engine is installed on the remote machine and that Docker CLI works (run docker ps from the terminal and ensure...
Read more >
Attach to a running container - Visual Studio Code
To attach to a Docker container, either select Dev Containers: Attach to Running Container... from the Command Palette (F1) or use the Remote...
Read more >
Remote Development with VS Code
Use Windows to develop in a Linux-based environment, using platform-specific toolchains and utilities. Edit files located in WSL or the mounted ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found