diff --git a/package-lock.json b/package-lock.json
index d1a27a9..17f14a0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "deeplink",
- "version": "0.0.21",
+ "version": "0.0.22",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "deeplink",
- "version": "0.0.21",
+ "version": "0.0.22",
"dependencies": {
"axios": "^1.7.2",
"hasbin": "^1.2.3",
@@ -22,13 +22,12 @@
"styled-components": "^5.0.1"
},
"devDependencies": {
- "@types/jest": "^29.5.12",
"@types/marked": "^2.0.2",
"@types/mocha": "^10.0.7",
"@types/node": "20.x",
"@types/react": "^16.9.0",
"@types/react-dom": "^16.9.0",
- "@types/vscode": "^1.91.0",
+ "@types/vscode": "^1.19.0",
"@typescript-eslint/eslint-plugin": "^7.14.1",
"@typescript-eslint/parser": "^7.11.0",
"@vscode/test-cli": "^0.0.9",
@@ -44,7 +43,7 @@
"webpack-cli": "^3.3.5"
},
"engines": {
- "vscode": "^1.91.0"
+ "vscode": "^1.29.0"
}
},
"node_modules/@ampproject/remapping": {
@@ -818,50 +817,6 @@
"node": ">=8"
}
},
- "node_modules/@jest/expect-utils": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz",
- "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "jest-get-type": "^29.6.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/schemas": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz",
- "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@sinclair/typebox": "^0.27.8"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/@jest/types": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz",
- "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jest/schemas": "^29.6.3",
- "@types/istanbul-lib-coverage": "^2.0.0",
- "@types/istanbul-reports": "^3.0.0",
- "@types/node": "*",
- "@types/yargs": "^17.0.8",
- "chalk": "^4.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.5",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz",
@@ -959,13 +914,6 @@
"node": ">=14"
}
},
- "node_modules/@sinclair/typebox": {
- "version": "0.27.8",
- "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz",
- "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/@types/hoist-non-react-statics": {
"version": "3.3.5",
"resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.5.tgz",
@@ -983,37 +931,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/istanbul-lib-report": {
- "version": "3.0.3",
- "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz",
- "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/istanbul-lib-coverage": "*"
- }
- },
- "node_modules/@types/istanbul-reports": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz",
- "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/istanbul-lib-report": "*"
- }
- },
- "node_modules/@types/jest": {
- "version": "29.5.12",
- "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz",
- "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "expect": "^29.0.0",
- "pretty-format": "^29.0.0"
- }
- },
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -1096,13 +1013,6 @@
"integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==",
"license": "MIT"
},
- "node_modules/@types/stack-utils": {
- "version": "2.0.3",
- "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz",
- "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/@types/vscode": {
"version": "1.92.0",
"resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.92.0.tgz",
@@ -1110,23 +1020,6 @@
"dev": true,
"license": "MIT"
},
- "node_modules/@types/yargs": {
- "version": "17.0.33",
- "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.33.tgz",
- "integrity": "sha512-WpxBCKWPLr4xSsHgz511rFJAM+wS28w2zEO1QDNY5zM/S8ok70NNfztH0xwhqKyaK0OHCbN98LDAZuy1ctxDkA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@types/yargs-parser": "*"
- }
- },
- "node_modules/@types/yargs-parser": {
- "version": "21.0.3",
- "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz",
- "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==",
- "dev": true,
- "license": "MIT"
- },
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz",
@@ -2669,22 +2562,6 @@
"node": ">=6.0"
}
},
- "node_modules/ci-info": {
- "version": "3.9.0",
- "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz",
- "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==",
- "dev": true,
- "funding": [
- {
- "type": "github",
- "url": "https://github.com/sponsors/sibiraj-s"
- }
- ],
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/cipher-base": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz",
@@ -3424,16 +3301,6 @@
"node": ">=0.3.1"
}
},
- "node_modules/diff-sequences": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz",
- "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
"node_modules/diffie-hellman": {
"version": "5.0.3",
"resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz",
@@ -4086,23 +3953,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/expect": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz",
- "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jest/expect-utils": "^29.7.0",
- "jest-get-type": "^29.6.3",
- "jest-matcher-utils": "^29.7.0",
- "jest-message-util": "^29.7.0",
- "jest-util": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
"node_modules/extend-shallow": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz",
@@ -5908,87 +5758,6 @@
"@pkgjs/parseargs": "^0.11.0"
}
},
- "node_modules/jest-diff": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz",
- "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "chalk": "^4.0.0",
- "diff-sequences": "^29.6.3",
- "jest-get-type": "^29.6.3",
- "pretty-format": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-get-type": {
- "version": "29.6.3",
- "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz",
- "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-matcher-utils": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz",
- "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "chalk": "^4.0.0",
- "jest-diff": "^29.7.0",
- "jest-get-type": "^29.6.3",
- "pretty-format": "^29.7.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-message-util": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz",
- "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@babel/code-frame": "^7.12.13",
- "@jest/types": "^29.6.3",
- "@types/stack-utils": "^2.0.0",
- "chalk": "^4.0.0",
- "graceful-fs": "^4.2.9",
- "micromatch": "^4.0.4",
- "pretty-format": "^29.7.0",
- "slash": "^3.0.0",
- "stack-utils": "^2.0.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/jest-util": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz",
- "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jest/types": "^29.6.3",
- "@types/node": "*",
- "chalk": "^4.0.0",
- "ci-info": "^3.2.0",
- "graceful-fs": "^4.2.9",
- "picomatch": "^2.2.3"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -7959,34 +7728,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/pretty-format": {
- "version": "29.7.0",
- "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz",
- "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "@jest/schemas": "^29.6.3",
- "ansi-styles": "^5.0.0",
- "react-is": "^18.0.0"
- },
- "engines": {
- "node": "^14.15.0 || ^16.10.0 || >=18.0.0"
- }
- },
- "node_modules/pretty-format/node_modules/ansi-styles": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
- "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
"node_modules/prismjs": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.29.0.tgz",
@@ -8268,7 +8009,8 @@
"version": "18.3.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-18.3.1.tgz",
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
- "license": "MIT"
+ "license": "MIT",
+ "peer": true
},
"node_modules/react-redux": {
"version": "7.2.9",
@@ -9329,29 +9071,6 @@
"figgy-pudding": "^3.5.1"
}
},
- "node_modules/stack-utils": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz",
- "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==",
- "dev": true,
- "license": "MIT",
- "dependencies": {
- "escape-string-regexp": "^2.0.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
- "node_modules/stack-utils/node_modules/escape-string-regexp": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz",
- "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==",
- "dev": true,
- "license": "MIT",
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/static-extend": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
diff --git a/package.json b/package.json
index ad2c571..440da3c 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,23 @@
"categories": [
"Other",
"Snippets",
- "Debuggers"
+ "Debuggers",
+ "Extension Packs",
+ "Programming Languages"
+ ],
+ "keywords": [
+ "todo",
+ "todolist",
+ "kanban",
+ "task",
+ "project",
+ "management",
+ "generate",
+ "generator",
+ "template",
+ "webdev",
+ "snippet",
+ "file"
],
"main": "./out/extension.js",
"contributes": {
@@ -139,8 +155,157 @@
"category": "MDT",
"title": "Open Task Board ✅",
"command": "extension.openTaskBoard"
+ },
+ {
+ "category": "MDT",
+ "command": "mdt.dispose",
+ "title": "Remove All Comments"
+ },
+ {
+ "command": "mdt.createNote",
+ "title": "Create Note",
+ "enablement": "!commentIsEmpty"
+ },
+ {
+ "command": "mdt.replyNote",
+ "title": "Reply",
+ "enablement": "!commentIsEmpty"
+ },
+ {
+ "command": "mdt.editNote",
+ "title": "Edit",
+ "icon": {
+ "dark": "resources/edit_inverse.svg",
+ "light": "resources/edit.svg"
+ }
+ },
+ {
+ "command": "mdt.deleteNote",
+ "title": "Delete",
+ "icon": {
+ "dark": "resources/close_inverse.svg",
+ "light": "resources/close.svg"
+ }
+ },
+ {
+ "command": "mdt.deleteNoteComment",
+ "title": "Delete",
+ "icon": {
+ "dark": "resources/close_inverse.svg",
+ "light": "resources/close.svg"
+ }
+ },
+ {
+ "command": "mdt.saveNote",
+ "title": "Save"
+ },
+ {
+ "command": "mdt.cancelsaveNote",
+ "title": "Cancel"
+ },
+ {
+ "command": "mdt.startDraft",
+ "title": "Start Draft",
+ "enablement": "!commentIsEmpty"
+ },
+ {
+ "command": "mdt.finishDraft",
+ "title": "Finish Draft"
}
- ]
+ ],
+ "menus": {
+ "commandPalette": [
+ {
+ "command": "mdt.createNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.replyNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.editNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.deleteNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.deleteNoteComment",
+ "when": "false"
+ },
+ {
+ "command": "mdt.saveNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.cancelsaveNote",
+ "when": "false"
+ },
+ {
+ "command": "mdt.startDraft",
+ "when": "false"
+ },
+ {
+ "command": "mdt.finishDraft",
+ "when": "false"
+ }
+ ],
+ "comments/commentThread/title": [
+ {
+ "command": "mdt.deleteNote",
+ "group": "navigation",
+ "when": "commentController == comment-mdt && !commentThreadIsEmpty"
+ }
+ ],
+ "comments/commentThread/context": [
+ {
+ "command": "mdt.createNote",
+ "group": "inline",
+ "when": "commentController == comment-mdt && commentThreadIsEmpty"
+ },
+ {
+ "command": "mdt.replyNote",
+ "group": "inline",
+ "when": "commentController == comment-mdt && !commentThreadIsEmpty"
+ },
+ {
+ "command": "mdt.startDraft",
+ "group": "inline",
+ "when": "commentController == comment-mdt && commentThreadIsEmpty"
+ },
+ {
+ "command": "mdt.finishDraft",
+ "group": "inline",
+ "when": "commentController == comment-mdt && commentThread == draft"
+ }
+ ],
+ "comments/comment/title": [
+ {
+ "command": "mdt.editNote",
+ "group": "group@1",
+ "when": "commentController == comment-mdt"
+ },
+ {
+ "command": "mdt.deleteNoteComment",
+ "group": "group@2",
+ "when": "commentController == comment-mdt && comment == canDelete"
+ }
+ ],
+ "comments/comment/context": [
+ {
+ "command": "mdt.cancelsaveNote",
+ "group": "inline@1",
+ "when": "commentController == comment-mdt"
+ },
+ {
+ "command": "mdt.saveNote",
+ "group": "inline@2",
+ "when": "commentController == comment-mdt"
+ }
+ ]
+ }
},
"scripts": {
"vscode:prepublish": "npm run compile",
diff --git a/resources/close.svg b/resources/close.svg
new file mode 100644
index 0000000..fde3440
--- /dev/null
+++ b/resources/close.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/close_inverse.svg b/resources/close_inverse.svg
new file mode 100644
index 0000000..d88aa12
--- /dev/null
+++ b/resources/close_inverse.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/edit.svg b/resources/edit.svg
new file mode 100755
index 0000000..ecde924
--- /dev/null
+++ b/resources/edit.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/resources/edit_inverse.svg b/resources/edit_inverse.svg
new file mode 100755
index 0000000..da956cb
--- /dev/null
+++ b/resources/edit_inverse.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/extension.ts b/src/extension.ts
index 590f82d..4550cfc 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -9,6 +9,7 @@ import PushNotificationDelegate from './features/push_notification/push_notifica
import DeviceDelegate from './features/device/device_delegate';
import { GistDelegate } from './features/gists/gist_delegate';
import KanbanBoardDelegate from './features/kanban_board/kanban_board_delegate';
+import CommentDelegate from './features/comment/comment_delegate';
export function deactivate() { }
@@ -19,6 +20,7 @@ export function activate(context: ExtensionContext) {
const deviceDelegate = new DeviceDelegate();
const gistDelegate = new GistDelegate();
const kanbanBoardDelegate = new KanbanBoardDelegate();
+ const commentDelegate = new CommentDelegate();
// Deeplink
createDeeplinkStatusBarItem().show();
@@ -61,4 +63,7 @@ export function activate(context: ExtensionContext) {
// Kanban Board
context.subscriptions.push(commands.registerCommand(OPEN_KANBAN_BOARD, async (uri: Uri) => kanbanBoardDelegate.openKanbanBoard(context, uri)));
+ // Comments
+ commentDelegate.activate(context);
+
}
\ No newline at end of file
diff --git a/src/features/comment/comment_delegate.ts b/src/features/comment/comment_delegate.ts
new file mode 100644
index 0000000..9a24a44
--- /dev/null
+++ b/src/features/comment/comment_delegate.ts
@@ -0,0 +1,149 @@
+import * as vscode from "vscode";
+const { exec, spawn } = require("child_process");
+const fs = require('fs');
+const path = require('path');
+
+let commentId = 1;
+
+export default class CommentDelegate {
+
+ activate(context: vscode.ExtensionContext) {
+ // A `CommentController` is able to provide comments for documents.
+ const commentController = vscode.comments.createCommentController('comment-mdt', 'Mobile Dev Tools Comment API');
+ context.subscriptions.push(commentController);
+
+ // A `CommentingRangeProvider` controls where gutter decorations that allow adding comments are shown
+ commentController.commentingRangeProvider = {
+ provideCommentingRanges: (document: vscode.TextDocument, token: vscode.CancellationToken) => {
+ const lineCount = document.lineCount;
+ return [new vscode.Range(0, 0, lineCount - 1, 0)];
+ }
+ };
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.createNote', (reply: vscode.CommentReply) => {
+ replyNote(reply);
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.replyNote', (reply: vscode.CommentReply) => {
+ replyNote(reply);
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.startDraft', (reply: vscode.CommentReply) => {
+ const thread = reply.thread;
+ thread.contextValue = 'draft';
+ const newComment = new NoteComment(reply.text, vscode.CommentMode.Preview, { name: 'Mobile Dev Tools' }, thread);
+ newComment.label = 'pending';
+ thread.comments = [...thread.comments, newComment];
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.finishDraft', (reply: vscode.CommentReply) => {
+ const thread = reply.thread;
+
+ if (!thread) {
+ return;
+ }
+
+ thread.contextValue = undefined;
+ thread.collapsibleState = vscode.CommentThreadCollapsibleState.Collapsed;
+ if (reply.text) {
+ const newComment = new NoteComment(reply.text, vscode.CommentMode.Preview, { name: 'Mobile Dev Tools' }, thread);
+ thread.comments = [...thread.comments, newComment].map(comment => {
+ comment.label = undefined;
+ return comment;
+ });
+ }
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.deleteNoteComment', (comment: NoteComment) => {
+ const thread = comment.parent;
+ if (!thread) {
+ return;
+ }
+
+ thread.comments = thread.comments.filter(cmt => (cmt as NoteComment).id !== comment.id);
+
+ if (thread.comments.length === 0) {
+ thread.dispose();
+ }
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.deleteNote', (thread: vscode.CommentThread) => {
+ thread.dispose();
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.cancelsaveNote', (comment: NoteComment) => {
+ if (!comment.parent) {
+ return;
+ }
+
+ comment.parent.comments = comment.parent.comments.map(cmt => {
+ if ((cmt as NoteComment).id === comment.id) {
+ cmt.body = (cmt as NoteComment).savedBody;
+ cmt.mode = vscode.CommentMode.Preview;
+ }
+
+ return cmt;
+ });
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.saveNote', (comment: NoteComment) => {
+ if (!comment.parent) {
+ return;
+ }
+
+ comment.parent.comments = comment.parent.comments.map(cmt => {
+ if ((cmt as NoteComment).id === comment.id) {
+ (cmt as NoteComment).savedBody = cmt.body;
+ cmt.mode = vscode.CommentMode.Preview;
+ }
+
+ return cmt;
+ });
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.editNote', (comment: NoteComment) => {
+ if (!comment.parent) {
+ return;
+ }
+
+ comment.parent.comments = comment.parent.comments.map(cmt => {
+ if ((cmt as NoteComment).id === comment.id) {
+ cmt.mode = vscode.CommentMode.Editing;
+ }
+
+ return cmt;
+ });
+ }));
+
+ context.subscriptions.push(vscode.commands.registerCommand('mdt.dispose', () => {
+ commentController.dispose();
+ }));
+
+ function replyNote(reply: vscode.CommentReply) {
+ const thread = reply.thread;
+ const newComment = new NoteComment(reply.text, vscode.CommentMode.Preview, { name: 'Mobile Dev Tools' }, thread, thread.comments.length ? 'canDelete' : undefined);
+ if (thread.contextValue === 'draft') {
+ newComment.label = 'pending';
+ }
+
+ thread.comments = [...thread.comments, newComment];
+ }
+ }
+
+}
+
+class NoteComment implements vscode.Comment {
+ id: number;
+ label: string | undefined;
+ savedBody: string | vscode.MarkdownString; // for the Cancel button
+ constructor(
+ public body: string | vscode.MarkdownString,
+ public mode: vscode.CommentMode,
+ public author: vscode.CommentAuthorInformation,
+ public parent?: vscode.CommentThread,
+ public contextValue?: string
+ ) {
+ this.id = ++commentId;
+ this.savedBody = this.body;
+ }
+}
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index ead9a30..a9f9835 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -3,7 +3,7 @@
"module": "commonjs",
"target": "es6",
"outDir": "out",
- "lib": ["es6"],
+ "lib": ["es6", "es2020"],
"sourceMap": true,
"rootDir": "src",
"noImplicitAny": false,