Skip to content

Commit 0e9c0ae

Browse files
Copilotntotten
andcommitted
Fix executeCommand and add localization for custom executable
Co-authored-by: ntotten <282782+ntotten@users.noreply.github.com>
1 parent 90e037d commit 0e9c0ae

3 files changed

Lines changed: 4 additions & 6 deletions

File tree

package.nls.zh-cn.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"ext.config.parser": "覆盖解析器。通常不需要更改此设置。",
2222
"ext.config.parserDeprecationMessage": "此设置已不再支持。请改用 Prettier 配置文件。",
2323
"ext.config.prettierPath": "`prettier` 包路径,如 `./node_modules/prettier`。",
24+
"ext.config.customExecutable": "使用自定义可执行文件运行 Prettier。指定完整命令及其参数,命令将附加 Prettier 参数执行。例如:`docker compose exec -T app node_modules/.bin/prettier`。当指定时,优先于 `prettier.prettierPath`。",
2425
"ext.config.printWidth": "每行代码的长度限制。",
2526
"ext.config.proseWrap": "( Markdown ) 文本换行。",
2627
"ext.config.quoteProps": "指定对象字面量中的属性名引号添加方式。\n可选项: \n- `as-needed` - 只在需要的情况下加引号。\n- `consistent` - 有一个需要引号就给其他都统一加上。\n - `preserve` - 保留用户输入的引号。",

package.nls.zh-tw.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"ext.config.parser": "覆寫解析器。你不應變更這個設定。",
2222
"ext.config.parserDeprecationMessage": "這個設定已不再支援。請改用 prettier 組態檔。",
2323
"ext.config.prettierPath": "`prettier` 模組的路徑,如 `./node_modules/prettier`。",
24+
"ext.config.customExecutable": "使用自訂可執行檔來執行 Prettier。指定完整命令及其參數,命令將附加 Prettier 參數執行。例如:`docker compose exec -T app node_modules/.bin/prettier`。當指定時,優先於 `prettier.prettierPath`。",
2425
"ext.config.printWidth": "讓程式碼的每一列符合這個寬度限制。",
2526
"ext.config.proseWrap": "( Markdown ) 把文句換行成多列。",
2627
"ext.config.quoteProps": "變更物件屬性何時加上引號。\n可用的選項:\n- `\"as-needed\"` - 只在需要時加上引號。\n- `\"consistent\"` - 如果至少有一個屬性需要引號,則對所有屬性加上引號。\n- `\"preserve\"` - 保留輸入中屬性引號的使用方式。",

src/PrettierExecutableInstance.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,8 @@ export class PrettierExecutableInstance implements PrettierInstance {
190190
stdin?: string,
191191
): Promise<string> {
192192
return new Promise((resolve, reject) => {
193-
// Parse the command and arguments
194-
const parts = command.split(" ");
195-
const cmd = parts[0];
196-
const args = parts.slice(1);
197-
198-
const child = spawn(cmd, args, {
193+
// Execute the full command through shell
194+
const child = spawn(command, {
199195
shell: true,
200196
});
201197

0 commit comments

Comments
 (0)