prettier.configPath is ignored when current file is virtual (?)
Summary
When editing a file from GitHub Gist using GistPad, the prettier.configPath is ignored.
Github Repository to Reproduce Issue
(No special file is required to repro) https://github.com/lostintangent/gistpad
Steps To Reproduce:
- Install Prettier extension and GistPad extension.
- Add
"prettier.configPath": "/some/valid/path/to/prettier/config"to settings.json. - Restart VSCode and ensure the configuration is active.
- Run "GistPad: Open Gist" command via e.g. Command + Shift + P, and choose a file that prettier can format.
- Run "Format Document" command.
Expected result
The file is formatted accordingly to the specified config.
Actual result
The file is formatted using VS Code configuration.
Additional information
Additionally, I observed that the same problem occurs when I open a Gist in the workspace window (not the first window that shows up when launching VSCode).
VS Code Version:
Version: 1.67.2 Commit: c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5 Date: 2022-05-17T18:20:57.384Z Electron: 17.4.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Darwin x64 20.5.0
Prettier Extension Version:
9.5.0
OS and version:
macOS Big Sur 11.4
Prettier Log Output
["INFO" - 9:10:03 PM] Extension Name: esbenp.prettier-vscode.
["INFO" - 9:10:03 PM] Extension Version: 9.5.0.
["INFO" - 9:10:15 PM] Formatting gist://xxxxxxxx/test.md
["INFO" - 9:10:15 PM] File Info:
{
"ignored": false,
"inferredParser": "markdown"
}
["INFO" - 9:10:15 PM] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 9:10:15 PM] Prettier Options:
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "/test.md",
"parser": "markdown"
}
["INFO" - 9:10:15 PM] Formatting completed in 0.105ms.
["INFO" - 9:11:05 PM] Formatting gist://xxxxxxxx/test.md
["INFO" - 9:11:05 PM] File Info:
{
"ignored": false,
"inferredParser": "markdown"
}
["INFO" - 9:11:05 PM] No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration
["INFO" - 9:11:05 PM] Prettier Options:
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"htmlWhitespaceSensitivity": "css",
"insertPragma": false,
"jsxBracketSameLine": false,
"jsxSingleQuote": false,
"printWidth": 120,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false,
"vueIndentScriptAndStyle": false,
"filepath": "/scratch-since-2022-03-13.md",
"parser": "markdown"
}
["INFO" - 9:11:05 PM] Formatting completed in 0.08ms.
May check the setting: Require config (as bellow)
No, that's not resolving the issue; as far as I can tell, when the file is open outside a workspace, no config is loaded at all.
https://github.com/prettier/prettier-vscode/blob/30c32808de8c159fa108e5521eb7b58fe0941724/src/ModuleResolver.ts#L285-L311
This issue has been labeled as stale due to inactivity. Reply to keep this issue open.
🥺
This issue has been labeled as stale due to inactivity. Reply to keep this issue open.
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.