Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Nothing is converted when the file path contains a space

未关闭 适合新手
#3 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
84/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
python
领域
tooling

调研方向

阅读 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 shows Running 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,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

luwes/SublimeJsModules 的其他 Issue

查看 luwes/SublimeJsModules 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。