Skip to main content

build文件

python


nodejs

{
"cmd": ["node", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"encoding": "UTF8",
"file_patterns": ["*.js", "*.cjs", "*.mjs"],
"selector": "source.js",
"variants": [
{
"name":"node(外部调用)",
"encoding": "UTF8",
"shell_cmd": "start cmd /c \"node ${file} & pause \""
},
{
"name":"node --experimental-specifier-resolution=node",
"encoding": "UTF8",
"cmd": ["node", "--experimental-specifier-resolution=node","$file"]
},
{
"name": "v16.11.1(内部调用)",
"cmd": ["D:\\CPS\\nodejs\\v16.11.1\\node.exe", "${file}"],
"encoding": "UTF8"
},
{
"name": "v16.11.1(外部调用)",
"shell_cmd": "start cmd /c \"D:\\CPS\\nodejs\\v16.11.1\\node.exe ${file} & pause \"",
"encoding": "UTF8"
},
{
"name": "v16.11.1(内部调用 ES6)",
"cmd": ["D:\\CPS\\nodejs\\v16.11.1\\node.exe", "--experimental-modules", "${file}"],
"encoding": "UTF8"
},
{
"cmd": ["taskkill", "/IM", "node.exe", "/F"],
"encoding": "UTF8",
"name": "清除所有node进程"
},
]
}

WSL

使用默认发行版的 bash

  • WSL-shell.sublime-build
{
"cmd": ["bash", "-c", "bash ${file_name}"], // bash会调用默认wsl的bash
"shell": true,
"working_dir": "${file_path}"
}
  • WSL-{contaion}.sublime-build
{
"cmd": "wsl <发行版内的终端> \"$file_name\" ",
"cmd": "wsl python2 \"$file_name\" ",
"working_dir": "$file_path",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.py",
"variants": [
{
"name": "Syntax Check",
"shell_cmd": "python2 -m py_compile \"$file_name\""
}
]
}