1 Star 0 Fork 0

旧梦残颜QAQ / raw

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
import_vscode_config.py 920 Bytes
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env python3
import argparse
import json
import sys
import re
p = argparse.ArgumentParser()
p.add_argument( "launch_name" )
args = p.parse_args()
TYPE_TO_ADAPTER = {
'cppdbg': 'vscode-cpptools'
}
configurations = {}
with open( args.launch_name ) as launch_file:
vsconfigurations = json.loads( re.sub( r"(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)", "", launch_file.read(), flags=re.MULTILINE ) ).get( "configurations", [] )
if not vsconfigurations:
exit( f"No launch.json configurations found in {args.launch_name}" )
for vsconfig in vsconfigurations:
name = vsconfig.pop( "name" )
configurations[ name ] = {
"adapter": TYPE_TO_ADAPTER[ vsconfig.pop( "type" ) ],
"configuration": vsconfig,
}
vimspector = {
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
"configurations": configurations
}
json.dump( vimspector, sys.stdout, indent=2 )
1
https://gitee.com/canyan233/raw.git
git@gitee.com:canyan233/raw.git
canyan233
raw
raw
master

搜索帮助