From bf97b231ffb739ef046916b1978b1a54053bbd7d Mon Sep 17 00:00:00 2001 From: Kirigaya <1193466151@qq.com> Date: Wed, 27 Nov 2024 21:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD=20.dideign?= =?UTF-8?q?ore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/ignore.configuration.json | 16 + images/svg/dark/view.svg | 10 +- images/svg/light/view.svg | 10 +- package-lock.json | 508 ++++++++++++++++++----------- package.json | 23 +- src/function/lsp/linter/default.ts | 8 +- src/function/treeView/command.ts | 10 +- src/function/treeView/tree.ts | 10 +- src/global/opeParam.ts | 9 + src/hdlFs/file.ts | 135 +++++--- src/hdlFs/path.ts | 10 +- src/hdlParser/core.ts | 9 + src/manager/PL/index.ts | 32 +- src/manager/PL/xilinx.ts | 14 +- src/manager/PS/xilinx.ts | 2 +- src/manager/ignore.ts | 59 +++- src/manager/lib.ts | 6 +- src/manager/prj.ts | 22 +- src/monitor/base.ts | 0 src/monitor/event.ts | 314 +----------------- src/monitor/hdl.ts | 180 ++++++++++ src/monitor/ignore.ts | 70 ++++ src/monitor/index.ts | 67 ++-- src/monitor/propery.ts | 110 +++++++ syntaxes/ignore.json | 11 + 25 files changed, 1018 insertions(+), 627 deletions(-) create mode 100644 config/ignore.configuration.json create mode 100644 src/monitor/base.ts create mode 100644 src/monitor/hdl.ts create mode 100644 src/monitor/ignore.ts create mode 100644 src/monitor/propery.ts create mode 100644 syntaxes/ignore.json diff --git a/config/ignore.configuration.json b/config/ignore.configuration.json new file mode 100644 index 0000000..5e14c1d --- /dev/null +++ b/config/ignore.configuration.json @@ -0,0 +1,16 @@ +{ + "comments": { + "lineComment": "#" + }, + "brackets": [ + ["{", "}"], + ["[", "]"], + ["(", ")"] + ], + "autoClosingPairs": [ + {"open":"(", "close":")", "notIn":["string", "comment"]}, + {"open":"[", "close":"]", "notIn":["string", "comment"]}, + {"open":"{", "close":"}", "notIn":["string", "comment"]}, + {"open":"\"", "close":"\"", "notIn":["string", "comment"]} + ] +} \ No newline at end of file diff --git a/images/svg/dark/view.svg b/images/svg/dark/view.svg index 7ccda0f..69ae3cf 100644 --- a/images/svg/dark/view.svg +++ b/images/svg/dark/view.svg @@ -1 +1,9 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/images/svg/light/view.svg b/images/svg/light/view.svg index 7ccda0f..69ae3cf 100644 --- a/images/svg/light/view.svg +++ b/images/svg/light/view.svg @@ -1 +1,9 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 956b9a7..0867dbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,8 @@ "dependencies": { "axios": "^1.7.7", "bson": "^6.8.0", - "chokidar": "^3.5.3", + "chokidar": "^4.0.1", + "minimatch": "^10.0.1", "puppeteer-core": "^19.4.1", "showdown": "^2.1.0", "state-machine-cat": "^9.2.5", @@ -23,7 +24,6 @@ "zlib": "^1.0.5" }, "devDependencies": { - "@types/glob": "^8.0.0", "@types/mocha": "^10.0.0", "@types/node": "16.x", "@types/showdown": "^2.0.0", @@ -32,7 +32,6 @@ "@typescript-eslint/parser": "^5.42.0", "@vscode/test-electron": "^2.2.0", "eslint": "^8.26.0", - "glob": "^8.0.3", "mocha": "^10.1.0", "typescript": "^4.8.4", "webpack-cli": "^5.1.4" @@ -70,6 +69,18 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.8", "resolved": "https://registry.npmmirror.com/@humanwhocodes/config-array/-/config-array-0.11.8.tgz", @@ -84,6 +95,18 @@ "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmmirror.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -345,28 +368,12 @@ "dev": true, "peer": true }, - "node_modules/@types/glob": { - "version": "8.0.0", - "resolved": "https://registry.npmmirror.com/@types/glob/-/glob-8.0.0.tgz", - "integrity": "sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==", - "dev": true, - "dependencies": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.11.tgz", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, - "node_modules/@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmmirror.com/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, "node_modules/@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmmirror.com/@types/mocha/-/mocha-10.0.1.tgz", @@ -889,8 +896,9 @@ }, "node_modules/anymatch": { "version": "3.1.3", - "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -962,11 +970,15 @@ } }, "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/bit-field": { @@ -1063,6 +1075,7 @@ "version": "3.0.2", "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "dependencies": { "fill-range": "^7.0.1" }, @@ -1224,34 +1237,17 @@ } }, "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" + "readdirp": "^4.0.1" }, "engines": { - "node": ">= 8.10.0" + "node": ">= 14.16.0" }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/chokidar/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" + "funding": { + "url": "https://paulmillr.com/funding/" } }, "node_modules/chownr": { @@ -1649,6 +1645,18 @@ "node": ">=4.0" } }, + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/espree": { "version": "9.4.1", "resolved": "https://registry.npmmirror.com/espree/-/espree-9.4.1.tgz", @@ -1850,6 +1858,7 @@ "version": "7.0.1", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "dependencies": { "to-regex-range": "^5.0.1" }, @@ -1969,9 +1978,10 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -2013,6 +2023,18 @@ "node": "*" } }, + "node_modules/fstream/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/fstream/node_modules/rimraf": { "version": "2.7.1", "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-2.7.1.tgz", @@ -2053,22 +2075,6 @@ "node": ">=8" } }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmmirror.com/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz", @@ -2088,27 +2094,6 @@ "dev": true, "peer": true }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/globals": { "version": "13.19.0", "resolved": "https://registry.npmmirror.com/globals/-/globals-13.19.0.tgz", @@ -2312,8 +2297,9 @@ }, "node_modules/is-binary-path": { "version": "2.1.0", - "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -2337,6 +2323,7 @@ "version": "2.1.1", "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -2353,6 +2340,7 @@ "version": "4.0.3", "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "dependencies": { "is-extglob": "^2.1.1" }, @@ -2364,6 +2352,7 @@ "version": "7.0.0", "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz", "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, "engines": { "node": ">=0.12.0" } @@ -2691,14 +2680,25 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": "20 || >=22" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/minimatch/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" } }, "node_modules/minimist": { @@ -2833,6 +2833,33 @@ "node": ">= 14.0.0" } }, + "node_modules/mocha/node_modules/chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "funding": [ + { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + ], + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, "node_modules/mocha/node_modules/glob": { "version": "7.2.0", "resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.0.tgz", @@ -2850,6 +2877,18 @@ "node": "*" } }, + "node_modules/mocha/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/mocha/node_modules/glob/node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", @@ -2889,6 +2928,18 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "node_modules/mocha/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, "node_modules/mocha/node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", @@ -2963,8 +3014,9 @@ }, "node_modules/normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -3128,6 +3180,7 @@ "version": "2.3.1", "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, "engines": { "node": ">=8.6" } @@ -3290,14 +3343,15 @@ "dev": true }, "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dependencies": { - "picomatch": "^2.2.1" - }, + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", + "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==", "engines": { - "node": ">=8.10.0" + "node": ">= 14.16.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" } }, "node_modules/rechoir": { @@ -3421,6 +3475,17 @@ "node": "*" } }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmmirror.com/run-parallel/-/run-parallel-1.2.0.tgz", @@ -3924,6 +3989,17 @@ "node": "*" } }, + "node_modules/temp/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/temp/node_modules/rimraf": { "version": "2.6.3", "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-2.6.3.tgz", @@ -4021,6 +4097,7 @@ "version": "5.0.1", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "dependencies": { "is-number": "^7.0.0" }, @@ -4631,6 +4708,17 @@ "js-yaml": "^4.1.0", "minimatch": "^3.1.2", "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "@humanwhocodes/config-array": { @@ -4642,6 +4730,17 @@ "@humanwhocodes/object-schema": "^1.2.1", "debug": "^4.1.1", "minimatch": "^3.0.5" + }, + "dependencies": { + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + } } }, "@humanwhocodes/module-importer": { @@ -4844,28 +4943,12 @@ "dev": true, "peer": true }, - "@types/glob": { - "version": "8.0.0", - "resolved": "https://registry.npmmirror.com/@types/glob/-/glob-8.0.0.tgz", - "integrity": "sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==", - "dev": true, - "requires": { - "@types/minimatch": "*", - "@types/node": "*" - } - }, "@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmmirror.com/@types/json-schema/-/json-schema-7.0.11.tgz", "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", "dev": true }, - "@types/minimatch": { - "version": "5.1.2", - "resolved": "https://registry.npmmirror.com/@types/minimatch/-/minimatch-5.1.2.tgz", - "integrity": "sha512-K0VQKziLUWkVKiRVrx4a40iPaxTUefQmjtkQofBkYRcoaaL/8rhwDWww9qWbrgicNOgnpIsMxyNIUM4+n6dUIA==", - "dev": true - }, "@types/mocha": { "version": "10.0.1", "resolved": "https://registry.npmmirror.com/@types/mocha/-/mocha-10.0.1.tgz", @@ -5281,8 +5364,9 @@ }, "anymatch": { "version": "3.1.3", - "resolved": "https://registry.npmmirror.com/anymatch/-/anymatch-3.1.3.tgz", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, "requires": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -5342,9 +5426,10 @@ } }, "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmmirror.com/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true }, "bit-field": { "version": "1.7.0", @@ -5429,6 +5514,7 @@ "version": "3.0.2", "resolved": "https://registry.npmmirror.com/braces/-/braces-3.0.2.tgz", "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, "requires": { "fill-range": "^7.0.1" } @@ -5529,28 +5615,11 @@ } }, "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmmirror.com/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", + "integrity": "sha512-n8enUVCED/KVRQlab1hr3MVpcVMvxtZjmEa956u+4YijlmQED223XMSYj2tLuKvr4jcCTzNNMpQDUer72MMmzA==", "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "dependencies": { - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "requires": { - "is-glob": "^4.0.1" - } - } + "readdirp": "^4.0.1" } }, "chownr": { @@ -5833,6 +5902,15 @@ "resolved": "https://registry.npmmirror.com/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } } } }, @@ -6029,6 +6107,7 @@ "version": "7.0.1", "resolved": "https://registry.npmmirror.com/fill-range/-/fill-range-7.0.1.tgz", "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, "requires": { "to-regex-range": "^5.0.1" } @@ -6110,9 +6189,10 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, "optional": true }, "fstream": { @@ -6141,6 +6221,15 @@ "path-is-absolute": "^1.0.0" } }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, "rimraf": { "version": "2.7.1", "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-2.7.1.tgz", @@ -6171,39 +6260,6 @@ "pump": "^3.0.0" } }, - "glob": { - "version": "8.1.0", - "resolved": "https://registry.npmmirror.com/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "dependencies": { - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - } - } - }, "glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmmirror.com/glob-parent/-/glob-parent-6.0.2.tgz", @@ -6370,8 +6426,9 @@ }, "is-binary-path": { "version": "2.1.0", - "resolved": "https://registry.npmmirror.com/is-binary-path/-/is-binary-path-2.1.0.tgz", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, "requires": { "binary-extensions": "^2.0.0" } @@ -6388,7 +6445,8 @@ "is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmmirror.com/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true }, "is-fullwidth-code-point": { "version": "3.0.0", @@ -6399,6 +6457,7 @@ "version": "4.0.3", "resolved": "https://registry.npmmirror.com/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, "requires": { "is-extglob": "^2.1.1" } @@ -6406,7 +6465,8 @@ "is-number": { "version": "7.0.0", "resolved": "https://registry.npmmirror.com/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true }, "is-path-inside": { "version": "3.0.3", @@ -6668,11 +6728,21 @@ } }, "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", + "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", "requires": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + } } }, "minimist": { @@ -6775,6 +6845,22 @@ "yargs-unparser": "2.0.0" }, "dependencies": { + "chokidar": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", + "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + } + }, "glob": { "version": "7.2.0", "resolved": "https://registry.npmmirror.com/glob/-/glob-7.2.0.tgz", @@ -6800,6 +6886,15 @@ } } }, + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + }, "minimatch": { "version": "5.0.1", "resolved": "https://registry.npmmirror.com/minimatch/-/minimatch-5.0.1.tgz", @@ -6826,6 +6921,15 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "dev": true }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-8.1.1.tgz", @@ -6882,8 +6986,9 @@ }, "normalize-path": { "version": "3.0.0", - "resolved": "https://registry.npmmirror.com/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==" + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true }, "once": { "version": "1.4.0", @@ -7012,7 +7117,8 @@ "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmmirror.com/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true }, "pkg-dir": { "version": "4.2.0", @@ -7149,12 +7255,9 @@ } }, "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmmirror.com/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "requires": { - "picomatch": "^2.2.1" - } + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.0.2.tgz", + "integrity": "sha512-yDMz9g+VaZkqBYS/ozoBJwaBhTbZo3UNYQHNRw1D3UFQB8oHB4uS/tAODO+ZLjGWmUbKnIlOWO+aaIiAxrUWHA==" }, "rechoir": { "version": "0.8.0", @@ -7241,6 +7344,14 @@ "once": "^1.3.0", "path-is-absolute": "^1.0.0" } + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } } } }, @@ -7626,6 +7737,14 @@ "path-is-absolute": "^1.0.0" } }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, "rimraf": { "version": "2.6.3", "resolved": "https://registry.npmmirror.com/rimraf/-/rimraf-2.6.3.tgz", @@ -7699,6 +7818,7 @@ "version": "5.0.1", "resolved": "https://registry.npmmirror.com/to-regex-range/-/to-regex-range-5.0.1.tgz", "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, "requires": { "is-number": "^7.0.0" } diff --git a/package.json b/package.json index bf71743..8d64fa8 100644 --- a/package.json +++ b/package.json @@ -990,6 +990,17 @@ "light": "./images/svg/light/view.svg" } }, + { + "id": "dideignore", + "filenames": [ + ".dideignore" + ], + "icon": { + "dark": "./images/icon.svg", + "light": "./images/icon.svg" + }, + "configuration": "./config/ignore.configuration.json" + }, { "id": "digital-ide-output", "mimetypes": [ @@ -1043,6 +1054,11 @@ "language": "digital-ide-output", "scopeName": "digital-ide.output", "path": "./syntaxes/digital-ide-output.json" + }, + { + "language": "dideignore", + "scopeName": "source.dideignore", + "path": "./syntaxes/ignore.json" } ], "snippets": [ @@ -1201,7 +1217,6 @@ "test": "node ./out/test/runTest.js" }, "devDependencies": { - "@types/glob": "^8.0.0", "@types/mocha": "^10.0.0", "@types/node": "16.x", "@types/showdown": "^2.0.0", @@ -1210,7 +1225,6 @@ "@typescript-eslint/parser": "^5.42.0", "@vscode/test-electron": "^2.2.0", "eslint": "^8.26.0", - "glob": "^8.0.3", "mocha": "^10.1.0", "typescript": "^4.8.4", "webpack-cli": "^5.1.4" @@ -1218,7 +1232,8 @@ "dependencies": { "axios": "^1.7.7", "bson": "^6.8.0", - "chokidar": "^3.5.3", + "chokidar": "^4.0.1", + "minimatch": "^10.0.1", "puppeteer-core": "^19.4.1", "showdown": "^2.1.0", "state-machine-cat": "^9.2.5", @@ -1230,4 +1245,4 @@ "wavedrom": "^2.9.1", "zlib": "^1.0.5" } -} \ No newline at end of file +} diff --git a/src/function/lsp/linter/default.ts b/src/function/lsp/linter/default.ts index 678c118..d9556cf 100644 --- a/src/function/lsp/linter/default.ts +++ b/src/function/lsp/linter/default.ts @@ -26,7 +26,9 @@ class DefaultVlogLinter implements BaseLinter { const diagnostics: vscode.Diagnostic[] = []; if (all.error && all.error.length > 0) { for (const hdlError of all.error) { - LspOutput.report(` line: ${hdlError.range.line}, info: ${hdlError.message}`, ReportType.Run); + LspOutput.report(` line: ${hdlError.range.line}, info: ${hdlError.message}`, { + level: ReportType.Run + }); const syntaxInfo = hdlError.message.replace(/\\r\\n/g, '\n'); const range = this.makeCorrectRange(document, hdlError.range); const diag = new vscode.Diagnostic(range, syntaxInfo, hdlError.severity); @@ -99,7 +101,9 @@ class DefaultVhdlLinter implements BaseLinter { const diagnostics: vscode.Diagnostic[] = []; if (all.error && all.error.length > 0) { for (const hdlError of all.error) { - LspOutput.report(` line: ${hdlError.range.line}, info: ${hdlError.message}`, ReportType.Run); + LspOutput.report(` line: ${hdlError.range.line}, info: ${hdlError.message}`, { + level: ReportType.Run + }); const range = this.makeCorrectRange(document, hdlError.range); const diag = new vscode.Diagnostic(range, hdlError.message, hdlError.severity); diff --git a/src/function/treeView/command.ts b/src/function/treeView/command.ts index 69240f6..3643028 100644 --- a/src/function/treeView/command.ts +++ b/src/function/treeView/command.ts @@ -221,14 +221,13 @@ class ToolTreeProvider extends BaseCommandTreeProvider { vscode.window.showWarningMessage(t('warn.command.clean.prjPath-is-workspace')); } - const ignores = hdlIgnore.getIgnoreFiles(); - const strFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.str')); + const strFiles = hdlFile.pickFileRecursive(workspacePath, p => p.endsWith('.str')); for (const path of strFiles) { hdlFile.removeFile(path); MainOutput.report("remove file " + path); } - const logFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.log')); + const logFiles = hdlFile.pickFileRecursive(workspacePath, p => p.endsWith('.log')); for (const path of logFiles) { hdlFile.readFile(path); } @@ -265,14 +264,13 @@ export async function clean() { vscode.window.showWarningMessage(t('warn.command.clean.prjPath-is-workspace')); } - const ignores = hdlIgnore.getIgnoreFiles(); - const strFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.str')); + const strFiles = hdlFile.pickFileRecursive(workspacePath, p => p.endsWith('.str')); for (const path of strFiles) { hdlFile.removeFile(path); MainOutput.report("remove file " + path); } - const logFiles = hdlFile.pickFileRecursive(workspacePath, ignores, p => p.endsWith('.log')); + const logFiles = hdlFile.pickFileRecursive(workspacePath, p => p.endsWith('.log')); for (const path of logFiles) { hdlFile.readFile(path); } diff --git a/src/function/treeView/tree.ts b/src/function/treeView/tree.ts index c1fad06..cedf004 100644 --- a/src/function/treeView/tree.ts +++ b/src/function/treeView/tree.ts @@ -189,6 +189,9 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { parent: element, })); + // 根据字母序列进行排序 + topModuleItemList.sort((a, b) => a.name.localeCompare(b.name)); + if (topModuleItemList.length > 0) { const type = moduleType as keyof FirstTop; @@ -241,7 +244,10 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { const targetModule = hdlParam.getHdlModule(element.path, element.name); if (targetModule) { - for (const instance of targetModule.getAllInstances()) { + const allInstances = targetModule.getAllInstances(); + // 根据出现次序进行排序 + allInstances.sort((a, b) => a.range.start.line - b.range.start.line); + for (const instance of allInstances) { // 所有的例化模块都定向到它的定义文件上 const item: ModuleDataItem = { icon: 'file', @@ -267,7 +273,7 @@ class ModuleTreeProvider implements vscode.TreeDataProvider { level: ReportType.Error }); } - + return moduleDataItemList; } diff --git a/src/global/opeParam.ts b/src/global/opeParam.ts index 79d56b5..49040b0 100644 --- a/src/global/opeParam.ts +++ b/src/global/opeParam.ts @@ -2,6 +2,7 @@ import * as assert from 'assert'; import * as fs from 'fs'; import { Arch, PrjInfo, RawPrjInfo, resolve } from './prjInfo'; +import { hdlPath } from '../hdlFs'; type AbsPath = string; type RelPath = string; @@ -78,6 +79,14 @@ class OpeParam { return this._propertyJsonPath; } + /** + * .dideignore 的路径 + */ + public get dideignorePath(): AbsPath { + const workspace = this._workspacePath; + return hdlPath.join(workspace, '.dideignore'); + } + /** * path of property-schema.json */ diff --git a/src/hdlFs/file.ts b/src/hdlFs/file.ts index 75b3523..7d2d7d3 100644 --- a/src/hdlFs/file.ts +++ b/src/hdlFs/file.ts @@ -7,13 +7,14 @@ import { verilogExts, vhdlExts, systemVerilogExts, hdlExts } from '../global/lan import * as hdlPath from './path'; import { HdlFileProjectType } from '../hdlParser/common'; import { opeParam } from '../global'; +import { hdlIgnore } from '../manager/ignore'; /** * judge if the path represent a file * @param path * @returns */ -function isFile(path: AbsPath): boolean { +export function isFile(path: AbsPath): boolean { if (!fs.existsSync(path)) { return false; } @@ -29,7 +30,7 @@ function isFile(path: AbsPath): boolean { * @param path * @returns */ -function isDir(path: AbsPath): boolean { +export function isDir(path: AbsPath): boolean { if (!fs.existsSync(path)) { return false; } @@ -41,7 +42,7 @@ function isDir(path: AbsPath): boolean { return false; } -function isVerilogFile(path: AbsPath): boolean { +export function isVerilogFile(path: AbsPath): boolean { if (!isFile(path)) { return false; } @@ -49,7 +50,7 @@ function isVerilogFile(path: AbsPath): boolean { return verilogExts.includes(ext); } -function isVhdlFile(path: AbsPath): boolean { +export function isVhdlFile(path: AbsPath): boolean { if (!isFile(path)) { return false; } @@ -57,7 +58,7 @@ function isVhdlFile(path: AbsPath): boolean { return vhdlExts.includes(ext); } -function isSystemVerilogFile(path: AbsPath): boolean { +export function isSystemVerilogFile(path: AbsPath): boolean { if (!isFile(path)) { return false; } @@ -65,7 +66,7 @@ function isSystemVerilogFile(path: AbsPath): boolean { return systemVerilogExts.includes(ext); } -function isHDLFile(path: AbsPath): boolean { +export function isHDLFile(path: AbsPath): boolean { if (!isFile(path)) { return false; } @@ -73,34 +74,47 @@ function isHDLFile(path: AbsPath): boolean { return hdlExts.includes(ext); } - -function getHDLFiles(path: AbsPath | AbsPath[] | Set, ignores?: AbsPath[]): AbsPath[] { - const allFiles = pickFileRecursive(path, ignores, - filePath => isHDLFile(filePath)); +/** + * @description 获取 path 下所有的 hdl 类型的文件 + * @param path + * @returns + */ +export function getHDLFiles(path: AbsPath | AbsPath[] | Set): AbsPath[] { + const allFiles = pickFileRecursive(path, filePath => { + // 判断是否在 ignore 里面 + if (hdlIgnore.isignore(filePath)) { + return false; + } + // 判断是否为 hdl 文件 + return isHDLFile(filePath); + }); const pathSet = new Set(allFiles); return [...pathSet]; } - -function pickFileRecursive(path: AbsPath | AbsPath[] | Set, ignores?: AbsPath[], condition?: (filePath: string) => boolean | undefined | void): AbsPath[] { +/** + * @description 从 path 下递归地获取所有文件 + * @param path + * @param condition 条件函数,判定为 true 的文件才会出现了返回文件中 + * @returns + */ +export function pickFileRecursive( + path: AbsPath | AbsPath[] | Set, + condition?: (filePath: string) => boolean | undefined | void +): AbsPath[] { if ((path instanceof Array) || (path instanceof Set)) { const hdlFiles: AbsPath[] = []; - path.forEach(p => hdlFiles.push(...pickFileRecursive(p, ignores, condition))); + path.forEach(p => hdlFiles.push(...pickFileRecursive(p, condition))); return hdlFiles; } if (isDir(path)) { - // return if ignore have path - if (ignores?.includes(path)) { - return []; - } - const hdlFiles = []; for (const file of fs.readdirSync(path)) { const filePath = hdlPath.join(path, file); if (isDir(filePath)) { - const subHdlFiles = pickFileRecursive(filePath, ignores, condition); + const subHdlFiles = pickFileRecursive(filePath, condition); if (subHdlFiles.length > 0) { hdlFiles.push(...subHdlFiles); } @@ -122,7 +136,7 @@ function pickFileRecursive(path: AbsPath | AbsPath[] | Set, ignores?: A * @param path * @returns */ -function getLanguageId(path: AbsPath | RelPath): HdlLangID { +export function getLanguageId(path: AbsPath | RelPath): HdlLangID { if (!isFile(path)) { return HdlLangID.Unknown; } @@ -139,7 +153,7 @@ function getLanguageId(path: AbsPath | RelPath): HdlLangID { } -function readFile(path: AbsPath): string | undefined { +export function readFile(path: AbsPath): string | undefined { try { const content = fs.readFileSync(path, 'utf-8'); return content; @@ -149,7 +163,7 @@ function readFile(path: AbsPath): string | undefined { } } -function writeFile(path: AbsPath, content: string): boolean { +export function writeFile(path: AbsPath, content: string): boolean { try { const parent = fspath.dirname(path); fs.mkdirSync(parent, {recursive: true}); @@ -161,7 +175,7 @@ function writeFile(path: AbsPath, content: string): boolean { } } -function readJSON(path: AbsPath): object { +export function readJSON(path: AbsPath): object { try { const context = fs.readFileSync(path, 'utf-8'); return JSON.parse(context); @@ -171,7 +185,7 @@ function readJSON(path: AbsPath): object { return {}; } -function writeJSON(path: AbsPath, obj: object): boolean { +export function writeJSON(path: AbsPath, obj: object): boolean { try { const jsonString = JSON.stringify(obj, null, '\t'); return writeFile(path, jsonString); @@ -181,7 +195,7 @@ function writeJSON(path: AbsPath, obj: object): boolean { return false; } -function removeFile(path: AbsPath): boolean { +export function removeFile(path: AbsPath): boolean { if (!isFile(path)) { return false; } @@ -195,7 +209,7 @@ function removeFile(path: AbsPath): boolean { return false; } -function moveFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { +export function moveFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { if (src === dest) { return false; } @@ -218,7 +232,7 @@ function moveFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { return false; } -function copyFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { +export function copyFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { if (src === dest) { return false; } @@ -248,7 +262,7 @@ function copyFile(src: AbsPath, dest: AbsPath, cover: boolean = true): boolean { * remove folder or file by path * @param path */ -function rmSync(path: AbsPath): void { +export function rmSync(path: AbsPath): void { if (fs.existsSync(path)) { if (fs.statSync(path).isDirectory()) { const files = fs.readdirSync(path); @@ -273,7 +287,7 @@ function rmSync(path: AbsPath): void { * @param attr attribution or attributions, split by '.' * @returns */ -function isHasAttr(obj: any, attr: string): boolean{ +export function isHasAttr(obj: any, attr: string): boolean{ if (!obj) { return false; } @@ -297,7 +311,7 @@ function isHasAttr(obj: any, attr: string): boolean{ } -function isHasValue(obj: any, attr: string, value: any): boolean{ +export function isHasValue(obj: any, attr: string, value: any): boolean{ if (!obj) { return false; } @@ -323,7 +337,7 @@ function isHasValue(obj: any, attr: string, value: any): boolean{ return true; } -function* walk(path: AbsPath | RelPath, condition?: (filePath: AbsPath) => boolean): Generator { +export function* walk(path: AbsPath | RelPath, condition?: (filePath: AbsPath) => boolean): Generator { if (isFile(path)) { if (!condition || condition(path)) { yield path; @@ -344,25 +358,40 @@ function* walk(path: AbsPath | RelPath, condition?: (filePath: AbsPath) => boole } } -export { - isFile, - isDir, - isVerilogFile, - isVhdlFile, - isSystemVerilogFile, - isHDLFile, - getHDLFiles, - getLanguageId, - readFile, - writeFile, - readJSON, - writeJSON, - rmSync, - pickFileRecursive, - isHasAttr, - isHasValue, - copyFile, - removeFile, - moveFile, - walk -}; \ No newline at end of file +interface DiffResult { + /** + * @description 新文件布局和老的相比,新增了哪些文件 + */ + addFiles: AbsPath[], + /** + * @description 新文件布局和老的相比,少了哪些文件 + */ + delFiles: AbsPath[] +} + +/** + * @description 比较新老文件布局,并返回有哪些新增,哪些减少 + * @param newFiles + * @param oldFiles + * @returns + */ +export function diffFiles(newFiles: AbsPath[], oldFiles: AbsPath[]): DiffResult { + const uncheckHdlFileSet = new Set(oldFiles); + const addFiles: AbsPath[] = []; + const delFiles: AbsPath[] = []; + + for (const path of newFiles) { + if (!uncheckHdlFileSet.has(path)) { + addFiles.push(path); + } else { + uncheckHdlFileSet.delete(path); + } + } + + for (const path of uncheckHdlFileSet) { + delFiles.push(path); + } + return { + addFiles, delFiles + }; +} \ No newline at end of file diff --git a/src/hdlFs/path.ts b/src/hdlFs/path.ts index 46d2983..020a1c7 100644 --- a/src/hdlFs/path.ts +++ b/src/hdlFs/path.ts @@ -102,6 +102,13 @@ function toEscapePath(path: AbsPath): AbsPath { } } +function toPureRelativePath(path: RelPath): RelPath { + if (path.startsWith('./') || path.startsWith('.\\')) { + return path.slice(2); + } + return path; +} + export { toSlash, rel2abs, @@ -112,5 +119,6 @@ export { extname, basename, exist, - toEscapePath + toEscapePath, + toPureRelativePath }; \ No newline at end of file diff --git a/src/hdlParser/core.ts b/src/hdlParser/core.ts index 0c46a77..cffd5d8 100644 --- a/src/hdlParser/core.ts +++ b/src/hdlParser/core.ts @@ -483,6 +483,15 @@ class HdlParam { moduleFile.deleteHdlModule(moduleName); } } + + public async updateByMonitor(addFiles: AbsPath[], delFiles: AbsPath[]) { + for (const path of addFiles) { + await this.addHdlFile(path); + } + for (const path of delFiles) { + this.deleteHdlFile(path); + } + } }; const hdlParam = new HdlParam(); diff --git a/src/manager/PL/index.ts b/src/manager/PL/index.ts index d4215a7..857fc34 100644 --- a/src/manager/PL/index.ts +++ b/src/manager/PL/index.ts @@ -12,7 +12,8 @@ import { hdlFile, hdlPath } from '../../hdlFs'; import { moduleTreeProvider, ModuleDataItem } from '../../function/treeView/tree'; import { HdlFileProjectType } from '../../hdlParser/common'; import { PropertySchema } from '../../global/propertySchema'; -import { HardwareOutput, ReportType } from '../../global/outputChannel'; +import { HardwareOutput, MainOutput, ReportType } from '../../global/outputChannel'; +import { AbsPath } from '../../global'; import { t } from '../../i18n'; class PlManage extends BaseManage { @@ -118,7 +119,36 @@ class PlManage extends BaseManage { moduleTreeProvider.refreshSim(); } } + + /** + * @description 因发生文件布局变动而进行更新 + * @param addFiles + * @param delFiles + */ + public async updateByMonitor(addFiles: AbsPath[], delFiles: AbsPath[]) { + // 目前只支持 Xilinx + const addfileActionTag = '(add files) '; + const delfileActionTag = '(del files) '; + if (addFiles.length > 0) { + const reportMsg = ['', ...addFiles].join('\n\t'); + MainOutput.report(addfileActionTag + t('info.pl.xilinx.update-addfiles') + reportMsg, { + level: ReportType.Run + }); + await this.addFiles(addFiles); + } else { + MainOutput.report(addfileActionTag + t('info.pl.xilinx.no-need-add-files')); + } + if (delFiles.length > 0) { + const reportMsg = ['', ...delFiles].join('\n\t'); + MainOutput.report(delfileActionTag + t('info.pl.xilinx.update-delfiles') + reportMsg, { + level: ReportType.Run + }); + await this.delFiles(delFiles); + } else { + MainOutput.report(delfileActionTag + t('info.pl.xilinx.no-need-del-files')); + } + } async addFiles(files: string[]) { this.context.ope.addFiles(files, this.context); diff --git a/src/manager/PL/xilinx.ts b/src/manager/PL/xilinx.ts index a842ae1..269f60a 100644 --- a/src/manager/PL/xilinx.ts +++ b/src/manager/PL/xilinx.ts @@ -146,7 +146,7 @@ class XilinxOperation { let prjFilePath = this.prjPath as AbsPath; // 找到所有的 xilinx 工程文件 - const prjFiles = hdlFile.pickFileRecursive(prjFilePath, [], + const prjFiles = hdlFile.pickFileRecursive(prjFilePath, filePath => filePath.endsWith('.xpr') ); @@ -349,7 +349,7 @@ class XilinxOperation { hdlPath.join(this.prjInfo.path, this.prjInfo.name + '.src', 'sources_1', 'bd') ]; - hdlFile.pickFileRecursive(bdPaths, [], (filePath) => { + hdlFile.pickFileRecursive(bdPaths, filePath => { if (filePath.endsWith('.bd')) { scripts.push(`add_files ${filePath} -quiet`); scripts.push(`add_files ${fspath.dirname(filePath)}/hdl -quiet`); @@ -365,7 +365,7 @@ class XilinxOperation { } const mrefPath = hdlPath.join(this.HWPath, 'bd', 'mref'); - hdlFile.pickFileRecursive(mrefPath, [], filePath => { + hdlFile.pickFileRecursive(mrefPath, filePath => { if (filePath.endsWith('.tcl')) { scripts.push(`source ${filePath}`); } @@ -377,7 +377,7 @@ class XilinxOperation { hdlPath.join(this.prjInfo.path, this.prjInfo.name + '.src', 'sources_1', 'ip') ]; - hdlFile.pickFileRecursive(ipPaths, [], filePath => { + hdlFile.pickFileRecursive(ipPaths, filePath => { if (filePath.endsWith('.xci')) { scripts.push(`add_files ${filePath} -quiet`); } @@ -925,7 +925,7 @@ const tools = { }, async getfsblPath(outsidePath: AbsPath, insidePath: AbsPath): Promise { - const paths: AbsPath[] = hdlFile.pickFileRecursive(outsidePath, [], + const paths: AbsPath[] = hdlFile.pickFileRecursive(outsidePath, filePath => filePath.endsWith('fsbl.elf')); if (paths.length) { @@ -944,7 +944,7 @@ const tools = { }, async getBitPath(bitPath: AbsPath): Promise { - let bitList = hdlFile.pickFileRecursive(bitPath, [], + let bitList = hdlFile.pickFileRecursive(bitPath, filePath => filePath.endsWith('.bit')); if (bitList.length === 0) { @@ -999,7 +999,7 @@ const tools = { }, pickElfFile(path: AbsPath): AbsPath[] { - return hdlFile.pickFileRecursive(path, [], + return hdlFile.pickFileRecursive(path, filePath => filePath.endsWith('.elf') && !filePath.endsWith('fsbl.elf')); } }; diff --git a/src/manager/PS/xilinx.ts b/src/manager/PS/xilinx.ts index 34f40ec..bc3518c 100644 --- a/src/manager/PS/xilinx.ts +++ b/src/manager/PS/xilinx.ts @@ -43,7 +43,7 @@ class XilinxOperation { } launch(config: PSConfig) { - const hdfs = hdlFile.pickFileRecursive(this.config.dat, [], + const hdfs = hdlFile.pickFileRecursive(this.config.dat, p => p.endsWith('.hdf')); if (hdfs.length) { diff --git a/src/manager/ignore.ts b/src/manager/ignore.ts index 990dcc2..d934d0e 100644 --- a/src/manager/ignore.ts +++ b/src/manager/ignore.ts @@ -1,18 +1,67 @@ import * as vscode from 'vscode'; -import { AbsPath } from '../global'; +import { AbsPath, opeParam } from '../global'; +import { hdlPath } from '../hdlFs'; +import * as fs from 'fs'; +import { minimatch } from 'minimatch'; class HdlIgnore { + // 用于进行 glob 匹配的模式 + public patterns: string[] constructor() { - + this.patterns = []; } - public getIgnoreFiles(): AbsPath[] { - return []; + /** + * @description 判断输入的路径是否为 ignore + */ + public isignore(path: AbsPath): boolean { + const workspace = opeParam.workspacePath; + // 转换成相对于 ws 的相对路径,形如 ./src/test.py + let relativePath = hdlPath.toPureRelativePath(hdlPath.relative(workspace, path)); + console.log('current path:', relativePath); + + for (const pattern of this.patterns.map(p => hdlPath.toPureRelativePath(p))) { + const matched = minimatch(relativePath, pattern); + if (matched) { + return true; + } + } + return false; + } + + + public updatePatterns() { + // ignore 文件一般不会很大,直接全量解析即可 + const ignorePath = opeParam.dideignorePath; + + if (fs.existsSync(ignorePath)) { + const validGlobStrings = new Set(); + const ignoreContent = fs.readFileSync(ignorePath, { encoding: 'utf-8' }); + for (const line of ignoreContent.split('\n')) { + const lineText = line.trim(); + // 如果是空行或者 # 注释,则跳过 + if (lineText.length === 0 || lineText.startsWith('#')) { + continue; + } + + const commentTagIndex = lineText.indexOf('#'); + if (commentTagIndex > -1) { + // 存在注释, # 往后都是注释 + validGlobStrings.add(lineText.slice(0, commentTagIndex)); + } else { + // index 为 -1 说明本行没有注释,直接加入即可 + validGlobStrings.add(lineText); + } + } + this.patterns = [...validGlobStrings]; + } else { + // .dideignore 不存在直接赋值为空 + this.patterns = []; + } } } - const hdlIgnore = new HdlIgnore(); export { diff --git a/src/manager/lib.ts b/src/manager/lib.ts index 42d349d..1f0da6a 100644 --- a/src/manager/lib.ts +++ b/src/manager/lib.ts @@ -144,8 +144,7 @@ class LibManage { libPathSet.checkAdd(path); } - const ignores = hdlIgnore.getIgnoreFiles(); - const libPathList = hdlFile.getHDLFiles(libPathSet.files, ignores); + const libPathList = hdlFile.getHDLFiles(libPathSet.files); return libPathList; } @@ -169,8 +168,7 @@ class LibManage { } public deleteLocalLib() { - const ignores = hdlIgnore.getIgnoreFiles(); - const hdlFileList = hdlFile.getHDLFiles([this.localLibPath], ignores); + const hdlFileList = hdlFile.getHDLFiles([this.localLibPath]); for (const path of hdlFileList) { hdlParam.deleteHdlFile(path); } diff --git a/src/manager/prj.ts b/src/manager/prj.ts index b9e91b3..fd52ec0 100644 --- a/src/manager/prj.ts +++ b/src/manager/prj.ts @@ -12,12 +12,12 @@ import { hdlParam } from '../hdlParser'; import { PlManage } from './PL'; import { PsManage } from './PS'; import { hdlIgnore } from './ignore'; -import { ppyAction } from '../monitor/event'; import { hdlMonitor } from '../monitor'; import { NotificationType } from 'vscode-jsonrpc'; import { refreshArchTree } from '../function/treeView'; import { Fast } from '../hdlParser/common'; import { t } from '../i18n'; +import { PpyAction } from '../monitor/propery'; interface RefreshPrjConfig { mkdir: boolean @@ -36,8 +36,9 @@ class PrjManage { const template = hdlFile.readJSON(opeParam.propertyInitPath) as RawPrjInfo; hdlFile.writeJSON(opeParam.propertyJsonPath, template); - // TODO : this is a bug, that monitor cannot sense the add event of ppy - // so we need to do manually here + // 当创建 property.json 时,monitor 似乎无法获取到 ppy 的 add 事件 + // 所以此处需要手动调用 + const ppyAction = new PpyAction(); await ppyAction.add(opeParam.propertyJsonPath, hdlMonitor); } @@ -130,12 +131,8 @@ class PrjManage { level: ReportType.Run }); - // TODO : make something like .gitignore - const ignores = hdlIgnore.getIgnoreFiles(); - - // do search - const searchPaths = searchPathSet.files; - const hdlFiles = hdlFile.getHDLFiles(searchPaths, ignores); + // 根据搜索路径获取所有 HDL 文件(出现在 .dideignore 中的文件不会被搜索到) + const hdlFiles = hdlFile.getHDLFiles(searchPathSet.files); return hdlFiles; } @@ -184,6 +181,8 @@ class PrjManage { console.time('launch'); } + // 初始化 ignore + hdlIgnore.updatePatterns(); // 解析 hdl 文件,构建 hdlParam const hdlFiles = await this.getPrjHardwareFiles(); @@ -191,10 +190,7 @@ class PrjManage { // 根据 toolchain 解析合法的 IP,构建 hdlParam const IPsPath = await this.getPrjIPs(); - await hdlParam.initializeIPsPath(IPsPath, progress); - - // TODO: 解析原语并构建,向后端索要原语缓存 - + await hdlParam.initializeIPsPath(IPsPath, progress); // 构建 instance 解析 await hdlParam.makeAllInstance(); diff --git a/src/monitor/base.ts b/src/monitor/base.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/monitor/event.ts b/src/monitor/event.ts index 0de6e24..9695e56 100644 --- a/src/monitor/event.ts +++ b/src/monitor/event.ts @@ -1,27 +1,14 @@ -/* eslint-disable @typescript-eslint/naming-convention */ -import assert = require('assert'); import * as chokidar from 'chokidar'; -import * as vscode from 'vscode'; -import * as fs from 'fs'; - -import { refreshArchTree } from '../function/treeView'; import { AbsPath, MainOutput, opeParam, PrjInfoDefaults, RelPath, ReportType } from '../global'; -import { isSameSet } from '../global/util'; -import { hdlFile, hdlPath } from '../hdlFs'; -import { hdlParam, HdlSymbol } from '../hdlParser'; -import { prjManage } from '../manager'; -import { libManage } from '../manager/lib'; import type { HdlMonitor } from './index'; -import { HdlLangID, ToolChainType } from '../global/enum'; -import { vlogLinterManager, vhdlLinterManager, svlogLinterManager } from '../function/lsp/linter'; -import { t } from '../i18n'; -enum Event { +export enum Event { Add = 'add', // emit when add file AddDir = 'addDir', // emit when add folder Unlink = 'unlink', // emit when delete file UnlinkDir = 'unlinkDir', // emit when delete folder Change = 'change', // emit when file changed + Move = 'move', All = 'all', // all the change above Ready = 'ready', Raw = 'raw', @@ -29,7 +16,7 @@ enum Event { }; -abstract class BaseAction { +export abstract class BaseAction { public listenChange(m: HdlMonitor) { const fSWatcher = this.selectFSWatcher(m); if (!fSWatcher) { @@ -62,302 +49,9 @@ abstract class BaseAction { } fSWatcher.on(Event.Unlink, path => this.unlink(path, m)); } + abstract selectFSWatcher(m: HdlMonitor): chokidar.FSWatcher | undefined; abstract change(path: AbsPath, m: HdlMonitor): Promise; abstract add(path: AbsPath, m: HdlMonitor): Promise; abstract unlink(path: AbsPath, m: HdlMonitor): Promise; } - -class HdlAction extends BaseAction { - selectFSWatcher(m: HdlMonitor): chokidar.FSWatcher | undefined { - return m.hdlMonitor; - } - - async add(path: string, m: HdlMonitor): Promise { - console.log('HdlAction add', path); - - path = hdlPath.toSlash(path); - this.updateLinter(path); - - // check if it has been created - if (hdlParam.hasHdlFile(path)) { - MainOutput.report(' HdlFile ' + path + ' has been created', { - level: ReportType.Warn - }); - return; - } - - // create corresponding moduleFile - await hdlParam.addHdlFile(path); - - refreshArchTree(); - } - - async unlink(path: string, m: HdlMonitor): Promise { - console.log('HdlAction unlink', path); - - // operation to process unlink of hdl files can be deleted in - path = hdlPath.toSlash(path); - hdlParam.deleteHdlFile(path); - - refreshArchTree(); - - const uri = vscode.Uri.file(path); - const langID = hdlFile.getLanguageId(path); - if (langID === HdlLangID.Verilog) { - vlogLinterManager.remove(uri); - } else if (langID === HdlLangID.Vhdl) { - vhdlLinterManager.remove(uri); - } else if (langID === HdlLangID.SystemVerilog) { - svlogLinterManager.remove(uri); - } - } - - async unlinkDir(path: string, m: HdlMonitor): Promise { - console.log('HdlAction unlinkDir', path); - - } - - async addDir(path: string, m: HdlMonitor): Promise { - console.log('HdlAction addDir', path); - - } - - async change(path: string, m: HdlMonitor): Promise { - console.log('HdlAction change'); - path = hdlPath.toSlash(path); - - await this.updateHdlParam(path); - await this.updateLinter(path); - - refreshArchTree(); - } - - // 下一个版本丢弃,完全由后端承担这部分功能 - async updateLinter(path: string) { - const uri = vscode.Uri.file(path); - const document = await vscode.workspace.openTextDocument(uri); - const langID = hdlFile.getLanguageId(path); - - if (langID === HdlLangID.Verilog) { - vlogLinterManager.lint(document); - } else if (langID === HdlLangID.Vhdl) { - vhdlLinterManager.lint(document); - } else if (langID === HdlLangID.SystemVerilog) { - svlogLinterManager.lint(document); - } - } - - async updateHdlParam(path: string) { - const moduleFile = hdlParam.getHdlFile(path); - - if (!moduleFile) { - return; - } - - const fast = await HdlSymbol.fast(path, 'common'); - console.log('update fast: ' + path); - - if (!fast) { - // vscode.window.showErrorMessage('error happen when parse ' + path + '\nFail to update'); - return; - } - - // 1. update marco directly - moduleFile.updateMacro(fast.macro); - - // 2. update modules one by one - const uncheckedModuleNames = new Set(); - for (const name of moduleFile.getAllModuleNames()) { - uncheckedModuleNames.add(name); - } - - for (const rawHdlModule of fast.content) { - const moduleName = rawHdlModule.name; - if (uncheckedModuleNames.has(moduleName)) { - // match the same module, check then - const originalModule = moduleFile.getHdlModule(moduleName); - uncheckedModuleNames.delete(moduleName); - originalModule?.update(rawHdlModule); - } else { - // no matched, create it - const newModule = moduleFile.createHdlModule(rawHdlModule); - newModule.makeNameToInstances(); - newModule.solveUnhandleInstance(); - } - } - - // 3. delete module not visited yet - for (const moduleName of uncheckedModuleNames) { - moduleFile.deleteHdlModule(moduleName); - } - } -} - - -class PpyAction extends BaseAction { - selectFSWatcher(m: HdlMonitor): chokidar.FSWatcher | undefined { - return m.ppyMonitor; - } - - async add(path: string, m: HdlMonitor): Promise { - console.log('PpyAction add'); - assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); - await this.updateProperty(Event.Add, m); - } - - async unlink(path: string, m: HdlMonitor): Promise { - console.log('PpyAction unlink'); - assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); - await this.updateProperty(Event.Unlink, m); - } - - async change(path: string, m: HdlMonitor): Promise { - console.log('PpyAction change'); - assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); - await this.updateProperty(Event.Change, m); - console.log(hdlParam); - } - - // get path set from opeParam that used to tell if need to remake HdlMonitor - private getImportantPathSet(): Set { - const pathSet = new Set(); - pathSet.add(opeParam.prjInfo.hardwareSimPath); - pathSet.add(opeParam.prjInfo.hardwareSrcPath); - for (const path of opeParam.prjInfo.getLibraryCommonPaths()) { - pathSet.add(path); - } - for (const path of opeParam.prjInfo.getLibraryCustomPaths()) { - pathSet.add(path); - } - return pathSet; - } - - public async updateProperty(e: Event, m: HdlMonitor) { - const originalPathSet = this.getImportantPathSet(); - const originalHdlFiles = await prjManage.getPrjHardwareFiles(); - const originalLibState = opeParam.prjInfo.library.state; - - const rawPrjInfo = opeParam.getRawUserPrjInfo(); - // when delete, make ws path to be main parse path - if (e === Event.Unlink) { - console.log('unlink ppy, PrjInfoDefaults.arch:', PrjInfoDefaults.arch); - rawPrjInfo.arch = PrjInfoDefaults.arch; - } - - opeParam.mergePrjInfo(rawPrjInfo); - await prjManage.refreshPrjFolder(); - - const currentPathSet = this.getImportantPathSet(); - const currentLibState = opeParam.prjInfo.library.state; - - if (isSameSet(originalPathSet, currentPathSet)) { - // skip hdl remake - if (originalLibState !== currentLibState) { - const fileChange = await libManage.processLibFiles(opeParam.prjInfo.library); - MainOutput.report(`libManage finish process, add ${fileChange.add.length} files, del ${fileChange.del.length} files`, { - level: ReportType.Info - }); - } - } else { - // update hdl monitor - await this.refreshHdlMonitor(m, originalHdlFiles); - } - - refreshArchTree(); - } - - public diffNewOld(newFiles: AbsPath[], oldFiles: AbsPath[]) { - const uncheckHdlFileSet = new Set(oldFiles); - const addFiles: AbsPath[] = []; - const delFiles: AbsPath[] = []; - - for (const path of newFiles) { - if (!uncheckHdlFileSet.has(path)) { - addFiles.push(path); - } else { - uncheckHdlFileSet.delete(path); - } - } - - for (const path of uncheckHdlFileSet) { - hdlParam.deleteHdlFile(path); - delFiles.push(path); - } - return { - addFiles, delFiles - }; - } - - public async refreshHdlMonitor(m: HdlMonitor, originalHdlFiles: AbsPath[]) { - m.remakeHdlMonitor(); - const newFiles = await prjManage.getPrjHardwareFiles(); - const { addFiles, delFiles } = this.diffNewOld(newFiles, originalHdlFiles); - - await vscode.window.withProgress({ - location: vscode.ProgressLocation.Notification, - title: t('info.monitor.ppy.impl-change-to-project', opeParam.prjInfo.toolChain) - }, async () => { - await this.updateHdlParam(addFiles, delFiles); - - switch (opeParam.prjInfo.toolChain) { - case ToolChainType.Xilinx: - await this.updatePL(addFiles, delFiles); - break; - - default: - break; - } - }); - } - - public async updateHdlParam(addFiles: AbsPath[], delFiles: AbsPath[]) { - for (const path of addFiles) { - await hdlParam.addHdlFile(path); - } - for (const path of delFiles) { - hdlParam.deleteHdlFile(path); - } - } - - - public async updatePL(addFiles: AbsPath[], delFiles: AbsPath[]) { - // current only support xilinx - if (prjManage.pl) { - const addfileActionTag = '(add files) '; - const delfileActionTag = '(del files) '; - if (addFiles.length > 0) { - const reportMsg = ['', ...addFiles].join('\n\t'); - MainOutput.report(addfileActionTag + t('info.pl.xilinx.update-addfiles') + reportMsg, { - level: ReportType.Run - }); - await prjManage.pl.addFiles(addFiles); - } else { - MainOutput.report(addfileActionTag + t('info.pl.xilinx.no-need-add-files')); - } - - if (delFiles.length > 0) { - const reportMsg = ['', ...delFiles].join('\n\t'); - MainOutput.report(delfileActionTag + t('info.pl.xilinx.update-delfiles') + reportMsg, { - level: ReportType.Run - }); - await prjManage.pl.delFiles(delFiles); - } else { - MainOutput.report(delfileActionTag + t('info.pl.xilinx.no-need-del-files')); - } - - } else { - MainOutput.report('PL is not registered', { - level: ReportType.Warn - }); - } - } -} - -const hdlAction = new HdlAction(); -const ppyAction = new PpyAction(); - -export { - hdlAction, - ppyAction -}; \ No newline at end of file diff --git a/src/monitor/hdl.ts b/src/monitor/hdl.ts new file mode 100644 index 0000000..33b70b8 --- /dev/null +++ b/src/monitor/hdl.ts @@ -0,0 +1,180 @@ +import * as chokidar from 'chokidar'; +import * as vscode from 'vscode'; + +import { refreshArchTree } from '../function/treeView'; +import { AbsPath, MainOutput, opeParam, ReportType } from '../global'; +import { hdlFile, hdlPath } from '../hdlFs'; +import { hdlParam, HdlSymbol } from '../hdlParser'; +import type { HdlMonitor } from './index'; +import { HdlLangID } from '../global/enum'; +import { vlogLinterManager, vhdlLinterManager, svlogLinterManager } from '../function/lsp/linter'; +import { BaseAction, Event } from './event'; +import { hdlIgnore } from '../manager/ignore'; + + +export class HdlAction extends BaseAction { + selectFSWatcher(m: HdlMonitor): chokidar.FSWatcher | undefined { + return m.hdlMonitor; + } + + /** + * @description 用户新建了 hdl 文件 + * @param path + * @param m + * @returns + */ + async add(path: string, m: HdlMonitor): Promise { + console.log('HdlAction add', path); + + path = hdlPath.toSlash(path); + + // 如果不是 src 或者 sim 下的直接不管 + if (!this.isvalid(path)) { + return; + } + + this.updateLinter(path); + + // check if it has been created + if (hdlParam.hasHdlFile(path)) { + MainOutput.report(' HdlFile ' + path + ' has been created', { + level: ReportType.Warn + }); + return; + } + + // create corresponding moduleFile + await hdlParam.addHdlFile(path); + + refreshArchTree(); + } + + /** + * @description 用户删除了 hdl 文件 + * @param path + * @param m + */ + async unlink(path: string, m: HdlMonitor): Promise { + console.log('HdlAction unlink', path); + + // operation to process unlink of hdl files can be deleted in + path = hdlPath.toSlash(path); + + // 如果不是 src 或者 sim 下的直接不管 + if (!this.isvalid(path)) { + return; + } + + hdlParam.deleteHdlFile(path); + + refreshArchTree(); + + const uri = vscode.Uri.file(path); + const langID = hdlFile.getLanguageId(path); + if (langID === HdlLangID.Verilog) { + vlogLinterManager.remove(uri); + } else if (langID === HdlLangID.Vhdl) { + vhdlLinterManager.remove(uri); + } else if (langID === HdlLangID.SystemVerilog) { + svlogLinterManager.remove(uri); + } + } + + /** + * @description 用户删除了文件夹(文件夹下的所有文件会自动触发 unlink 事件,不需要额外处理) + * @param path + * @param m + */ + async unlinkDir(path: string, m: HdlMonitor): Promise { + console.log('HdlAction unlinkDir', path); + } + + /** + * @description 用户增加了文件夹(文件夹下的所有文件会自动触发 add 事件,不需要额外处理) + * @param path + * @param m + */ + async addDir(path: string, m: HdlMonitor): Promise { + console.log('HdlAction addDir', path); + } + + /** + * @description 用户修改了 hdl 文件 + * @param path + * @param m + */ + async change(path: string, m: HdlMonitor): Promise { + console.log('HdlAction change'); + path = hdlPath.toSlash(path); + + // 如果不是 src 或者 sim 下的直接不管 + if (!this.isvalid(path)) { + return; + } + + // 更新 hdl 文件 + const fast = await HdlSymbol.fast(path, 'common'); + if (fast) { + hdlParam.updateFast(path, fast); + } + + // 更新 linter + await this.updateLinter(path); + + refreshArchTree(); + } + + public listenAddDir(m: HdlMonitor) { + const fSWatcher = this.selectFSWatcher(m); + if (!fSWatcher) { + MainOutput.report("FSWatcher hasn't been made!", { + level: ReportType.Error + }); + return; + } + fSWatcher.on(Event.AddDir, path => this.addDir(path, m)); + } + + + public listenUnlinkDir(m: HdlMonitor) { + const fSWatcher = this.selectFSWatcher(m); + if (!fSWatcher) { + MainOutput.report("FSWatcher hasn't been made!", { + level: ReportType.Error + }); + return; + } + fSWatcher.on(Event.UnlinkDir, path => this.unlinkDir(path, m)); + } + + /** + * @description 是否为有效的工作区文件(必须在 src/sim 下且不被 ignore 包含) + * @param path + */ + private isvalid(path: AbsPath): boolean { + const prjInfo = opeParam.prjInfo; + if (path.startsWith(prjInfo.hardwareSrcPath) || path.startsWith(prjInfo.hardwareSimPath)) { + if (!hdlIgnore.isignore(path)) { + return true; + } + } + + return false; + } + + // 下一个版本丢弃,完全由后端承担这部分功能 + async updateLinter(path: string) { + const uri = vscode.Uri.file(path); + const document = await vscode.workspace.openTextDocument(uri); + const langID = hdlFile.getLanguageId(path); + + if (langID === HdlLangID.Verilog) { + vlogLinterManager.lint(document); + } else if (langID === HdlLangID.Vhdl) { + vhdlLinterManager.lint(document); + } else if (langID === HdlLangID.SystemVerilog) { + svlogLinterManager.lint(document); + } + } +} + diff --git a/src/monitor/ignore.ts b/src/monitor/ignore.ts new file mode 100644 index 0000000..9bfe729 --- /dev/null +++ b/src/monitor/ignore.ts @@ -0,0 +1,70 @@ +import * as vscode from 'vscode'; +import { FSWatcher } from "chokidar"; +import { HdlMonitor } from "."; +import { BaseAction } from "./event"; +import { AbsPath, MainOutput, opeParam } from "../global"; +import { hdlIgnore } from "../manager/ignore"; +import { prjManage } from "../manager"; +import { diffFiles } from "../hdlFs/file"; +import { t } from '../i18n'; +import { hdlParam } from '../hdlParser'; +import { ToolChainType } from '../global/enum'; +import { refreshArchTree } from '../function/treeView'; + +export class IgnoreAction extends BaseAction { + selectFSWatcher(m: HdlMonitor): FSWatcher | undefined { + return m.ignoreMonitor; + } + + // 用户新建了 .dideignore + async add(path: AbsPath, m: HdlMonitor): Promise { + const oldFiles = await prjManage.getPrjHardwareFiles(); + hdlIgnore.updatePatterns(); + await this.update(oldFiles); + + refreshArchTree(); + } + + // 用户删除了 .dideignore + async unlink(path: AbsPath, m: HdlMonitor): Promise { + const oldFiles = await prjManage.getPrjHardwareFiles(); + hdlIgnore.updatePatterns(); + await this.update(oldFiles); + + refreshArchTree(); + } + + // 用户修改了 .dideignore 中的内容 + async change(path: AbsPath, m: HdlMonitor): Promise { + const oldFiles = await prjManage.getPrjHardwareFiles(); + hdlIgnore.updatePatterns(); + await this.update(oldFiles); + + refreshArchTree(); + } + + async update(oldFiles: AbsPath[]) { + const newFiles = await prjManage.getPrjHardwareFiles(); + const { addFiles, delFiles } = diffFiles(newFiles, oldFiles); + + if (addFiles.length + delFiles.length === 0) { + return; + } + + await vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: t('info.monitor.ppy.impl-change-to-project', opeParam.prjInfo.toolChain) + }, async () => { + await hdlParam.updateByMonitor(addFiles, delFiles); + switch (opeParam.prjInfo.toolChain) { + case ToolChainType.Xilinx: + await prjManage.pl?.updateByMonitor(addFiles, delFiles); + break; + + default: + break; + } + }); + } + +} \ No newline at end of file diff --git a/src/monitor/index.ts b/src/monitor/index.ts index b4e1540..b133bdf 100644 --- a/src/monitor/index.ts +++ b/src/monitor/index.ts @@ -4,13 +4,16 @@ import { hdlExts } from '../global/lang'; import { PathSet } from '../global/util'; import { hdlPath } from '../hdlFs'; -import * as Event from './event'; import { t } from '../i18n'; +import { HdlAction } from './hdl'; +import { PpyAction } from './propery'; +import { IgnoreAction } from './ignore'; class HdlMonitor{ - private monitorConfig: chokidar.WatchOptions; + private monitorConfig: chokidar.ChokidarOptions; public hdlMonitor?: chokidar.FSWatcher; public ppyMonitor?: chokidar.FSWatcher; + public ignoreMonitor?: chokidar.FSWatcher; constructor() { // public config for monitor @@ -21,7 +24,7 @@ class HdlMonitor{ }; } - public makeMonitor(paths: string | string[], config?: chokidar.WatchOptions): chokidar.FSWatcher { + public makeMonitor(paths: string | string[], config?: chokidar.ChokidarOptions): chokidar.FSWatcher { if (!config) { config = this.monitorConfig; } @@ -40,27 +43,27 @@ class HdlMonitor{ * @description get monitor for HDLParam update */ public getHdlMonitor() { - const hdlExtsGlob = `**/*.{${hdlExts.join(',')}}`; const prjInfo = opeParam.prjInfo; const monitorPathSet = new PathSet(); + + // 在输出中展示当前的监视路径 + monitorPathSet.checkAdd(opeParam.workspacePath); monitorPathSet.checkAdd(prjInfo.hardwareSimPath); monitorPathSet.checkAdd(prjInfo.hardwareSrcPath); monitorPathSet.checkAdd(prjInfo.libCommonPath); - monitorPathSet.checkAdd(prjInfo.libCustomPath); - - const monitorFoldersWithGlob = []; - for (const folder of monitorPathSet.files) { - const globPath = hdlPath.join(folder, hdlExtsGlob); - monitorFoldersWithGlob.push(globPath); - } - const reportString = ['', ...monitorPathSet.files].join('\n\t'); MainOutput.report(t('info.launch.following-folder-tracked') + reportString, { level: ReportType.Launch }); - return this.makeMonitor(monitorFoldersWithGlob); + // chokidar 4.0.0 开始不支持 glob,需要在每一个入口自己判断 + return this.makeMonitor([opeParam.workspacePath, prjInfo.libCommonPath]); + } + + public getIgnoreMonitor() { + const watcherPath = opeParam.dideignorePath; + return this.makeMonitor(watcherPath); } public close() { @@ -72,9 +75,11 @@ class HdlMonitor{ // make monitor this.hdlMonitor = this.getHdlMonitor(); this.ppyMonitor = this.getPpyMonitor(); + this.ignoreMonitor = this.getIgnoreMonitor(); this.registerHdlMonitorListener(); this.registerPpyMonitorListener(); + this.registerIgnoreMonitorListener(); } public remakeHdlMonitor() { @@ -93,19 +98,37 @@ class HdlMonitor{ } } - public registerHdlMonitorListener() { - Event.hdlAction.listenAdd(this); - Event.hdlAction.listenChange(this); - Event.hdlAction.listenUnlink(this); + public remakeIgnoreMonitor() { + if (this.ignoreMonitor) { + this.ignoreMonitor.close(); + this.ignoreMonitor = this.getIgnoreMonitor(); + this.registerIgnoreMonitorListener(); + } + } - // Event.hdlAction.listenAddDir(this); - // Event.hdlAction.listenUnlinkDir(this); + public registerHdlMonitorListener() { + // 不需要实现 addDir 和 unlinkDir 事件 + // 因为删除文件夹时,下级各个文件会自动触发 add 和 unlink 事件 + // 因此,monitor 只需要实现对文件的监听即可 + + const hdlAction = new HdlAction(); + hdlAction.listenAdd(this); + hdlAction.listenChange(this); + hdlAction.listenUnlink(this); } public registerPpyMonitorListener() { - Event.ppyAction.listenAdd(this); - Event.ppyAction.listenChange(this); - Event.ppyAction.listenUnlink(this); + const ppyAction = new PpyAction(); + ppyAction.listenAdd(this); + ppyAction.listenChange(this); + ppyAction.listenUnlink(this); + } + + public registerIgnoreMonitorListener() { + const ignoreAction = new IgnoreAction(); + ignoreAction.listenAdd(this); + ignoreAction.listenChange(this); + ignoreAction.listenUnlink(this); } }; diff --git a/src/monitor/propery.ts b/src/monitor/propery.ts new file mode 100644 index 0000000..f313efa --- /dev/null +++ b/src/monitor/propery.ts @@ -0,0 +1,110 @@ +import assert = require('assert'); +import * as chokidar from 'chokidar'; +import * as vscode from 'vscode'; + +import { refreshArchTree } from '../function/treeView'; +import { AbsPath, MainOutput, opeParam, PrjInfoDefaults, RelPath, ReportType } from '../global'; +import { isSameSet } from '../global/util'; +import { hdlPath } from '../hdlFs'; +import { hdlParam } from '../hdlParser'; +import { prjManage } from '../manager'; +import { libManage } from '../manager/lib'; +import type { HdlMonitor } from './index'; +import { ToolChainType } from '../global/enum'; +import { t } from '../i18n'; +import { BaseAction, Event } from './event'; +import { diffFiles } from '../hdlFs/file'; + +export class PpyAction extends BaseAction { + selectFSWatcher(m: HdlMonitor): chokidar.FSWatcher | undefined { + return m.ppyMonitor; + } + + async add(path: string, m: HdlMonitor): Promise { + console.log('PpyAction add'); + assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); + await this.updateProperty(Event.Add, m); + } + + async unlink(path: string, m: HdlMonitor): Promise { + console.log('PpyAction unlink'); + assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); + await this.updateProperty(Event.Unlink, m); + } + + async change(path: string, m: HdlMonitor): Promise { + console.log('PpyAction change'); + assert.equal(hdlPath.toSlash(path), opeParam.propertyJsonPath); + await this.updateProperty(Event.Change, m); + } + + // get path set from opeParam that used to tell if need to remake HdlMonitor + private getImportantPathSet(): Set { + const pathSet = new Set(); + pathSet.add(opeParam.prjInfo.hardwareSimPath); + pathSet.add(opeParam.prjInfo.hardwareSrcPath); + for (const path of opeParam.prjInfo.getLibraryCommonPaths()) { + pathSet.add(path); + } + for (const path of opeParam.prjInfo.getLibraryCustomPaths()) { + pathSet.add(path); + } + return pathSet; + } + + public async updateProperty(e: Event, m: HdlMonitor) { + const originalPathSet = this.getImportantPathSet(); + const originalHdlFiles = await prjManage.getPrjHardwareFiles(); + const originalLibState = opeParam.prjInfo.library.state; + + const rawPrjInfo = opeParam.getRawUserPrjInfo(); + // when delete, make ws path to be main parse path + if (e === Event.Unlink) { + console.log('unlink ppy, PrjInfoDefaults.arch:', PrjInfoDefaults.arch); + rawPrjInfo.arch = PrjInfoDefaults.arch; + } + + opeParam.mergePrjInfo(rawPrjInfo); + await prjManage.refreshPrjFolder(); + + const currentPathSet = this.getImportantPathSet(); + const currentLibState = opeParam.prjInfo.library.state; + + if (isSameSet(originalPathSet, currentPathSet)) { + // skip hdl remake + if (originalLibState !== currentLibState) { + const fileChange = await libManage.processLibFiles(opeParam.prjInfo.library); + MainOutput.report(`libManage finish process, add ${fileChange.add.length} files, del ${fileChange.del.length} files`, { + level: ReportType.Info + }); + } + } else { + // update hdl monitor + await this.refreshHdlMonitor(m, originalHdlFiles); + } + + refreshArchTree(); + } + + public async refreshHdlMonitor(m: HdlMonitor, originalHdlFiles: AbsPath[]) { + // 获取布局更新后的新的文件 + const newFiles = await prjManage.getPrjHardwareFiles(); + const { addFiles, delFiles } = diffFiles(newFiles, originalHdlFiles); + + await vscode.window.withProgress({ + location: vscode.ProgressLocation.Notification, + title: t('info.monitor.ppy.impl-change-to-project', opeParam.prjInfo.toolChain) + }, async () => { + await hdlParam.updateByMonitor(addFiles, delFiles); + + switch (opeParam.prjInfo.toolChain) { + case ToolChainType.Xilinx: + await prjManage.pl?.updateByMonitor(addFiles, delFiles); + break; + + default: + break; + } + }); + } +} \ No newline at end of file diff --git a/syntaxes/ignore.json b/syntaxes/ignore.json new file mode 100644 index 0000000..7ff57df --- /dev/null +++ b/syntaxes/ignore.json @@ -0,0 +1,11 @@ +{ + "name": "dideignore", + "scopeName": "source.dideignore", + "patterns": [ + { + "match": "^\\s*#.*$", + "name": "comment.line.number-sign.gitignore" + } + ], + "uuid": "12345678-1234-1234-1234-123456789012" +} \ No newline at end of file