Nothing is converted when the file path contains a space
还没有人认领这个 Issue。
评估
调研方向
阅读 JsModules.py,重点查看 JsModulesFileCommand 和 JsModulesDirCommand,其中 shell_cmd 是根据当前活动文件的路径构建的。将 Sublime 文档中说明的 cmd 参数数组与 shell_cmd 进行比较,然后验证这两个命令都能处理报告中带空格的路径。完成的标准是:转换器能在带空格的路径中找到并转换文件,同时普通路径仍能正常工作。
由索引模型根据 Issue 内容生成。
描述
Claude reports: on Windows the commands convert nothing when the file path contains a space, and the exec panel says "Found 0 files".
Tested with JsModules 0.0.2 on Sublime Text 4215 (Windows), cjs-to-es6 installed globally with npm. The same two-line file a.js (const x = require('y'); module.exports = x;) in two folders:
...\jsmok\a.js: "JsModules: Convert file to ES module" prints "Found 1 files ... 1 ok"....\jsm space dir\a.js: the console showsRunning cjs-to-es6 C:\...\jsm space dir\a.js, and the exec panel shows "Found 0 files." followed by "Error: You have to provide at least one file/directory to transform."
JsModules.py builds the command with "cjs-to-es6 {0}".format(active_file) and passes it as shell_cmd, so the path is split at the spaces. Both commands do this (JsModulesFileCommand and JsModulesDirCommand).
Running the same command through the exec command with the path as its own list item works for the folder with spaces:
exec {"cmd": ["cjs-to-es6", "C:\\...\\jsm space dir\\a.js"], "shell": true}
That printed "Found 1 files ... 1 ok" for the same file. Sublime's build system docs describe cmd as an array of arguments and shell_cmd as a string passed to the shell (https://www.sublimetext.com/docs/build_systems.html). Changing both commands to the cmd form (or quoting the path) should fix it.
- 主要语言
- Python
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
luwes/SublimeJsModules 的其他 Issue
-
难度 1/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 4/5 3-5 天 新手友好度 25/100
查看 luwes/SublimeJsModules 的全部 Issue
相似的 Issue
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
fossasia/visdom-dev#77 ·
维护者通常 4 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
aws-cloudformation/cfn-lint#4890 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
volcengine/OpenViking#6521 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 77/100
AstrBotDevs/AstrBot#10720 ·
维护者通常 1 天内回复
-
cause/upstream comp/cli P2 provider/other tool/file type/bug
难度 2/5 1-3 小时 新手友好度 78/100
NousResearch/hermes-agent#143900 ·
维护者通常 1 天内回复