diff --git a/detect-plugin/.eslintrc.json b/detect-plugin/.eslintrc.json new file mode 100644 index 00000000..f9b22b79 --- /dev/null +++ b/detect-plugin/.eslintrc.json @@ -0,0 +1,24 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": 6, + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint" + ], + "rules": { + "@typescript-eslint/naming-convention": "warn", + "@typescript-eslint/semi": "warn", + "curly": "warn", + "eqeqeq": "warn", + "no-throw-literal": "warn", + "semi": "off" + }, + "ignorePatterns": [ + "out", + "dist", + "**/*.d.ts" + ] +} diff --git a/.vscode/extensions.json b/detect-plugin/.vscode/extensions.json similarity index 100% rename from .vscode/extensions.json rename to detect-plugin/.vscode/extensions.json diff --git a/.vscode/launch.json b/detect-plugin/.vscode/launch.json similarity index 100% rename from .vscode/launch.json rename to detect-plugin/.vscode/launch.json diff --git a/.vscode/settings.json b/detect-plugin/.vscode/settings.json similarity index 100% rename from .vscode/settings.json rename to detect-plugin/.vscode/settings.json diff --git a/.vscode/tasks.json b/detect-plugin/.vscode/tasks.json similarity index 100% rename from .vscode/tasks.json rename to detect-plugin/.vscode/tasks.json diff --git a/detect-plugin/.vscodeignore b/detect-plugin/.vscodeignore new file mode 100644 index 00000000..e301b4e4 --- /dev/null +++ b/detect-plugin/.vscodeignore @@ -0,0 +1,12 @@ +.vscode/** +.vscode-test/** +node_modules/** +src/** +.gitignore +.yarnrc +webpack.config.js +vsc-extension-quickstart.md +**/tsconfig.json +**/.eslintrc.json +**/*.map +**/*.ts diff --git a/detect-plugin/.yarnrc b/detect-plugin/.yarnrc new file mode 100644 index 00000000..f757a6ac --- /dev/null +++ b/detect-plugin/.yarnrc @@ -0,0 +1 @@ +--ignore-engines true \ No newline at end of file diff --git a/detect-plugin/LICENSE.txt b/detect-plugin/LICENSE.txt new file mode 100644 index 00000000..a22a2da2 --- /dev/null +++ b/detect-plugin/LICENSE.txt @@ -0,0 +1 @@ +MIT diff --git a/detect-plugin/package.json b/detect-plugin/package.json index 53d590a6..aacedf1c 100644 --- a/detect-plugin/package.json +++ b/detect-plugin/package.json @@ -2,22 +2,28 @@ "name": "deadlock-detect", "displayName": "deadlock-detect", "description": "Deadlock detect for C/C++ program which use the posix thread library for Linux system platform.", + "publisher": "kylin-code", "version": "0.0.1", "engines": { "vscode": "^1.54.0" }, + "license": "SEE LICENSE IN LICENSE.txt", + "repository": { + "type": "git", + "url": "https://gitee.com/openkylin/deadlock-detect.git" + }, "categories": [ "Other" ], "activationEvents": [ - "onCommand:deadlock-detect.open" + "onCommand:deadlock-detect.detect" ], "main": "./out/extension.js", "contributes": { "commands": [ { - "command": "deadlock-detect.open", - "title": "C/C++ 死锁检测" + "command": "deadlock-detect.detect", + "title": "C/C++程序死锁检测" } ] }, diff --git a/detect-plugin/src/extension.ts b/detect-plugin/src/extension.ts index b95e83f3..c3888131 100644 --- a/detect-plugin/src/extension.ts +++ b/detect-plugin/src/extension.ts @@ -10,6 +10,9 @@ function getWebViewContent(context: vscode.ExtensionContext, templatePath: strin let html = fs.readFileSync(resourcePath, 'utf-8'); // vscode不支持直接加载本地资源,需要替换成其专有路径格式,这里只是简单的将样式和JS的路径替换 html = html.replace(/( { + if($2[0] === '/'){ + $2 = "." + $2; + } return $1 + vscode.Uri.file(path.resolve(dirPath, $2)).with({ scheme: 'vscode-resource' }).toString() + '"'; }); return html; @@ -26,7 +29,7 @@ export function activate(context: vscode.ExtensionContext) { // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('deadlock-detect.open', () => { + let disposable = vscode.commands.registerCommand('deadlock-detect.detect', () => { // The code you place here will be executed every time your command is executed // Display a message box to the user const panel = vscode.window.createWebviewPanel( @@ -38,7 +41,7 @@ export function activate(context: vscode.ExtensionContext) { retainContextWhenHidden: false, } ); - panel.webview.html = getWebViewContent(context, "src/dist/index.html"); + panel.webview.html = getWebViewContent(context, "./dist/index.html"); }); context.subscriptions.push(disposable); diff --git a/detect-plugin/yarn.lock b/detect-plugin/yarn.lock index 4de3a608..f72f8167 100644 --- a/detect-plugin/yarn.lock +++ b/detect-plugin/yarn.lock @@ -171,7 +171,7 @@ resolved "https://registry.npmmirror.com/@types/node/-/node-16.11.58.tgz#0a3698dee3492617a8d5fe7998d18d7520b63026" integrity sha512-uMVxJ111wpHzkx/vshZFb6Qni3BOMnlWLq7q9jrwej7Yw/KvjsEbpxCCxw+hLKxexFMc8YmpG8J9tnEe/rKsIg== -"@types/vscode@^1.71.0": +"@types/vscode@^1.54.0": version "1.71.0" resolved "https://registry.npmmirror.com/@types/vscode/-/vscode-1.71.0.tgz#a8d9bb7aca49b0455060e6eb978711b510bdd2e2" integrity sha512-nB50bBC9H/x2CpwW9FzRRRDrTZ7G0/POttJojvN/LiVfzTGfLyQIje1L1QRMdFXK9G41k5UJN/1B9S4of7CSzA==