- 右键 .vpj → Count Project LOC(viper.countLines):递归扫描项目的 source_dir, 统计文件数 / 总行 / 代码行 / 注释行 / 空行 / 注释率 / 平均行长 / 字符数 - 先打开 Viper LOC Webview 面板再扫描:确定性进度条(先收集文件,再按 N/M 处理 并显示当前文件),完成后渲染 KPI 卡片、按语言的堆叠条形图(代码/注释/空行, 以最大语言为基准缩放)、语言筛选(勾选后重算 KPI/图表/表格)与明细表(含合计行) - 同一份报表以纯文本写入 Viper LOC 输出通道,便于复制 - 计入本扩展注册的语言扩展名 .vp / .vpi / .vpnci / .vpj,并按需求支持 .def (; 与 // 行注释、/* */ 块注释,跨行块注释按注释计) - 跳过项目 build_dir、隐藏目录、node_modules、.git、__pycache__,不跟随符号链接
335 lines
12 KiB
JSON
335 lines
12 KiB
JSON
{
|
||
"name": "viper",
|
||
"displayName": "Viper",
|
||
"description": "Project management and toolchain for Viper language",
|
||
"version": "0.1.0",
|
||
"private": true,
|
||
"license": "MIT",
|
||
"publisher": "terminexus",
|
||
"engines": {
|
||
"vscode": "^1.101.0"
|
||
},
|
||
"categories": [
|
||
"Programming Languages"
|
||
],
|
||
"keywords": [
|
||
"viper"
|
||
],
|
||
"activationEvents": [
|
||
"onLanguage:viper",
|
||
"workspaceContains:**/*.vpj",
|
||
"workspaceContains:**/*.vp"
|
||
],
|
||
"icon": "images/viper-icon.png",
|
||
"main": "./dist/extension.js",
|
||
"contributes": {
|
||
"languages": [
|
||
{
|
||
"id": "viper-project",
|
||
"aliases": [
|
||
"Viper Project"
|
||
],
|
||
"extensions": [
|
||
".vpj"
|
||
],
|
||
"icon": {
|
||
"light": "images/vpj-icon.svg",
|
||
"dark": "images/vpj-icon.svg"
|
||
}
|
||
}
|
||
],
|
||
"grammars": [
|
||
{
|
||
"language": "viper-project",
|
||
"scopeName": "source.json.vpj",
|
||
"path": "./syntaxes/vpj.tmLanguage.json"
|
||
}
|
||
],
|
||
"customEditors": [
|
||
{
|
||
"viewType": "viper.vpjEditor",
|
||
"displayName": "Viper Project Editor",
|
||
"selector": [
|
||
{
|
||
"filenamePattern": "*.vpj"
|
||
}
|
||
],
|
||
"priority": "default"
|
||
}
|
||
],
|
||
"configurationDefaults": {
|
||
"files.associations": {
|
||
"*.vpj": "viper-project"
|
||
}
|
||
},
|
||
"viewsContainers": {
|
||
"activitybar": [
|
||
{
|
||
"id": "viper-explorer",
|
||
"title": "Viper",
|
||
"icon": "images/viper-icon.svg"
|
||
}
|
||
]
|
||
},
|
||
"views": {
|
||
"viper-explorer": [
|
||
{
|
||
"id": "viper.projectView",
|
||
"name": "Project"
|
||
},
|
||
{
|
||
"id": "viper.environmentView",
|
||
"name": "Environments"
|
||
},
|
||
{
|
||
"id": "viper.toolchainView",
|
||
"name": "Toolchain"
|
||
},
|
||
{
|
||
"id": "viper.settingsView",
|
||
"name": "Settings"
|
||
}
|
||
]
|
||
},
|
||
"viewsWelcome": [
|
||
{
|
||
"view": "viper.projectView",
|
||
"contents": "No Viper project found in this workspace.\n[Create Project](command:viper.createProject)\n[Open Folder](command:workbench.action.files.openFolder)"
|
||
},
|
||
{
|
||
"view": "viper.toolchainView",
|
||
"contents": "No Viper toolchain detected.\n[Configure Toolchain](command:viper.selectToolchain)"
|
||
}
|
||
],
|
||
"commands": [
|
||
{
|
||
"command": "viper.createProject",
|
||
"title": "Create Project",
|
||
"category": "Viper"
|
||
},
|
||
{
|
||
"command": "viper.selectToolchain",
|
||
"title": "Select Toolchain",
|
||
"category": "Viper"
|
||
},
|
||
{
|
||
"command": "viper.showProjectInfo",
|
||
"title": "Show Project Info",
|
||
"category": "Viper"
|
||
},
|
||
{
|
||
"command": "viper.openSettings",
|
||
"title": "Open Settings",
|
||
"category": "Viper"
|
||
},
|
||
{
|
||
"command": "viper.selectEnvironment",
|
||
"title": "Select Environment",
|
||
"category": "Viper",
|
||
"icon": "$(server-environment)"
|
||
},
|
||
{
|
||
"command": "viper.restartEnvironmentTool",
|
||
"title": "Restart VET",
|
||
"category": "Viper",
|
||
"icon": "$(debug-restart)"
|
||
},
|
||
{
|
||
"command": "viper.stopEnvironmentTool",
|
||
"title": "Stop VET",
|
||
"category": "Viper",
|
||
"icon": "$(debug-stop)"
|
||
},
|
||
{
|
||
"command": "viper.showEnvironmentLog",
|
||
"title": "Show VET Output",
|
||
"category": "Viper",
|
||
"icon": "$(output)"
|
||
},
|
||
{
|
||
"command": "viper.checkEnvironment",
|
||
"title": "Check Viper Executable...",
|
||
"category": "Viper",
|
||
"icon": "$(check)"
|
||
},
|
||
{
|
||
"command": "viper.refreshView",
|
||
"title": "Refresh",
|
||
"category": "Viper",
|
||
"icon": "$(refresh)"
|
||
},
|
||
{
|
||
"command": "viper.openVpjAsJson",
|
||
"title": "Open .vpj as JSON",
|
||
"category": "Viper"
|
||
},
|
||
{
|
||
"command": "viper.countLines",
|
||
"title": "Count Project LOC",
|
||
"category": "Viper"
|
||
}
|
||
],
|
||
"menus": {
|
||
"commandPalette": [
|
||
{
|
||
"command": "viper.selectEnvironment"
|
||
},
|
||
{
|
||
"command": "viper.restartEnvironmentTool"
|
||
},
|
||
{
|
||
"command": "viper.stopEnvironmentTool"
|
||
},
|
||
{
|
||
"command": "viper.showEnvironmentLog"
|
||
},
|
||
{
|
||
"command": "viper.checkEnvironment"
|
||
},
|
||
{
|
||
"command": "viper.openVpjAsJson",
|
||
"when": "resourceExtname == .vpj"
|
||
},
|
||
{
|
||
"command": "viper.countLines",
|
||
"when": "resourceExtname == .vpj"
|
||
}
|
||
],
|
||
"editor/title/context": [
|
||
{
|
||
"command": "viper.openVpjAsJson",
|
||
"when": "resourceExtname == .vpj",
|
||
"group": "1_open"
|
||
}
|
||
],
|
||
"explorer/context": [
|
||
{
|
||
"command": "viper.openVpjAsJson",
|
||
"when": "resourceExtname == .vpj",
|
||
"group": "1_open"
|
||
},
|
||
{
|
||
"command": "viper.countLines",
|
||
"when": "resourceExtname == .vpj",
|
||
"group": "1_open@2"
|
||
}
|
||
],
|
||
"view/title": [
|
||
{
|
||
"command": "viper.checkEnvironment",
|
||
"when": "view == viper.environmentView",
|
||
"group": "navigation"
|
||
},
|
||
{
|
||
"command": "viper.refreshView",
|
||
"when": "view == viper.projectView || view == viper.environmentView || view == viper.toolchainView || view == viper.settingsView",
|
||
"group": "navigation"
|
||
}
|
||
]
|
||
},
|
||
"configuration": {
|
||
"title": "Viper",
|
||
"properties": {
|
||
"viper.environmentTool.enabled": {
|
||
"type": "boolean",
|
||
"default": true,
|
||
"description": "启用 VET(Viper Environment Tool)常驻扫盘发现 Viper 编译器。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.path": {
|
||
"type": "string",
|
||
"default": "D:\\Users\\TermiNexus\\Desktop\\TransPyC\\VET\\.tpv_build\\output\\VET.exe",
|
||
"description": "VET 可执行文件路径(Viper 自身实现的环境发现工具)。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.scanPaths": {
|
||
"type": "array",
|
||
"items": {
|
||
"type": "string"
|
||
},
|
||
"default": [],
|
||
"description": "传给 VET 的 --path 扫描目录。留空则让 VET 自行建立常用目录表;一旦填写则完全替换它(不再自动建表)。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.confirmSeconds": {
|
||
"type": "number",
|
||
"default": 10,
|
||
"minimum": 0,
|
||
"description": "VET 心跳确认周期(秒,对应 --need-confirm);0 表示关闭确认(不建议:关闭后 VET 不会因超时自杀)。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.confirmTimeoutMs": {
|
||
"type": "number",
|
||
"default": 5000,
|
||
"minimum": 0,
|
||
"description": "VET 每轮确认窗口长度(毫秒,对应 --need-confirm-timeout);窗口内没收到 {\"ok\":1} 就会退出。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.scanIntervalMs": {
|
||
"type": "number",
|
||
"default": 10000,
|
||
"minimum": 0,
|
||
"maximum": 86400000,
|
||
"description": "VET 每轮扫盘间隔(毫秒,对应 --sleep)。",
|
||
"scope": "window"
|
||
},
|
||
"viper.environmentTool.maxRestarts": {
|
||
"type": "number",
|
||
"default": 5,
|
||
"minimum": 0,
|
||
"description": "VET 异常退出后的自动重启次数上限(指数退避,单次最多等 30 秒);超过后通知错误并停止重启。",
|
||
"scope": "window"
|
||
},
|
||
"viper.toolchain.path": {
|
||
"type": "string",
|
||
"default": "C:\\v.exe",
|
||
"description": "Path to Viper compiler executable.",
|
||
"scope": "resource"
|
||
},
|
||
"viper.toolchain.version": {
|
||
"type": "string",
|
||
"default": "1.0.0",
|
||
"description": "Viper compiler version string.",
|
||
"scope": "resource",
|
||
"readOnly": true
|
||
},
|
||
"viper.build.parallel": {
|
||
"type": "boolean",
|
||
"default": true,
|
||
"description": "Enable parallel compilation.",
|
||
"scope": "resource"
|
||
},
|
||
"viper.build.onSave": {
|
||
"type": "boolean",
|
||
"default": false,
|
||
"description": "Trigger build on file save.",
|
||
"scope": "resource"
|
||
},
|
||
"viper.analysis.dialect": {
|
||
"type": "string",
|
||
"enum": [
|
||
"python",
|
||
"viper"
|
||
],
|
||
"default": "viper",
|
||
"description": "Language dialect for analysis.",
|
||
"scope": "resource"
|
||
}
|
||
}
|
||
}
|
||
},
|
||
"scripts": {
|
||
"clean": "shx rm -rf ./dist ./out",
|
||
"compile": "tsc -p ./tsconfig.json",
|
||
"watch": "tsc -p ./tsconfig.json --watch",
|
||
"package": "vsce package"
|
||
},
|
||
"devDependencies": {
|
||
"@types/node": "^25.9.2",
|
||
"@types/vscode": "^1.101.0",
|
||
"@vscode/vsce": "^3.9.2",
|
||
"shx": "^0.4.0",
|
||
"typescript": "~6.0.3"
|
||
}
|
||
}
|