diff --git a/CHANGELOG.md b/CHANGELOG.md index ae2068cd9..462b12ad7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,8 +2,9 @@ Changes to Calva. ## [Unreleased] +- [Remove warning that extensions use the `vscode-resource:` scheme directly](https://github.com/BetterThanTomorrow/calva/issues/391) - [Use of undeclared var in REPL window resets the namespace](https://github.com/BetterThanTomorrow/calva/issues/257) -- [calva.evalCurrentTopLevelFormInREPLWindow fails in specific condition](https://github.com/BetterThanTomorrow/calva/issues/374) +- [Fix bugs in comment form selection](https://github.com/BetterThanTomorrow/calva/issues/374) ## [2.0.47] - 10.10.2019 - [Support Jack-in without file open for single-rooted workspace](https://github.com/BetterThanTomorrow/calva/issues/366) diff --git a/package-lock.json b/package-lock.json index 1465dacf4..690557475 100644 --- a/package-lock.json +++ b/package-lock.json @@ -60,6 +60,12 @@ "@types/node": "*" } }, + "@types/vscode": { + "version": "1.39.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.39.0.tgz", + "integrity": "sha512-rlg0okXDt7NjAyHXbZ2nO1I/VY/8y9w67ltLRrOxXQ46ayvrYZavD4A6zpYrGbs2+ZOEQzcUs+QZOqcVGQIxXQ==", + "dev": true + }, "@webassemblyjs/ast": { "version": "1.8.5", "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.8.5.tgz", @@ -287,15 +293,6 @@ } } }, - "agent-base": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-4.3.0.tgz", - "integrity": "sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg==", - "dev": true, - "requires": { - "es6-promisify": "^5.0.0" - } - }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -790,12 +787,6 @@ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -1972,23 +1963,6 @@ "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.0.2.tgz", "integrity": "sha1-AQ1YWEI6XxGJeWZfRkhqlcbuK7Y=" }, - "es6-promisify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", - "integrity": "sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM=", - "dev": true, - "requires": { - "es6-promise": "^4.0.3" - }, - "dependencies": { - "es6-promise": { - "version": "4.2.8", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", - "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==", - "dev": true - } - } - }, "escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", @@ -3444,12 +3418,6 @@ "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==", "dev": true }, - "growl": { - "version": "1.10.3", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", - "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", - "dev": true - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -3583,12 +3551,6 @@ "minimalistic-assert": "^1.0.1" } }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, "hmac-drbg": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", @@ -3657,27 +3619,6 @@ } } }, - "http-proxy-agent": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-2.1.0.tgz", - "integrity": "sha512-qwHbBLV7WviBl0rQsOzH6o5lwyOIvwp/BdFnvVxXORldu5TmjFfjzBcWUWS5kWAZhmv+JtiDhSuQCp4sBfbIgg==", - "dev": true, - "requires": { - "agent-base": "4", - "debug": "3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -3694,33 +3635,6 @@ "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", "dev": true }, - "https-proxy-agent": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz", - "integrity": "sha512-HPCTS1LW51bcyMYbxUIOO4HEOlQ1/1qRaFWcyxvwaqUS9TY88aoEuHUY33kuAh1YhVVaDQhLZsnPd+XNARWZlQ==", - "dev": true, - "requires": { - "agent-base": "^4.1.0", - "debug": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "3.2.6", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.6.tgz", - "integrity": "sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, "iconv-lite": { "version": "0.4.23", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", @@ -4692,76 +4606,6 @@ } } }, - "mocha": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.1.0.tgz", - "integrity": "sha512-0RVnjg1HJsXY2YFDoTNzcc1NKhYuXKRrBAG2gDygmJJA136Cs2QlRliZG1mA0ap7cuaT30mw16luAeln+4RiNA==", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.11.0", - "debug": "3.1.0", - "diff": "3.3.1", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.3", - "he": "1.1.1", - "mkdirp": "0.5.1", - "supports-color": "4.4.0" - }, - "dependencies": { - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "diff": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", - "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", - "dev": true - }, - "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", - "dev": true, - "requires": { - "has-flag": "^2.0.0" - } - } - } - }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", @@ -8907,12 +8751,6 @@ "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", "dev": true }, - "querystringify": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", - "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==", - "dev": true - }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -9162,12 +9000,6 @@ "resolve-from": "^1.0.0" } }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=", - "dev": true - }, "resolve": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.10.0.tgz", @@ -10508,16 +10340,6 @@ } } }, - "url-parse": { - "version": "1.4.7", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.7.tgz", - "integrity": "sha512-d3uaVyzDB9tQoSXFvuSUNFibTd9zxd2bkVrDRvF5TmvWWQwqE4lgYJ5m+x1DbecWkw+LK4RNl2CU1hHuOKPVlg==", - "dev": true, - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "url-parse-lax": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", @@ -10626,29 +10448,6 @@ } } }, - "vscode": { - "version": "1.1.34", - "resolved": "https://registry.npmjs.org/vscode/-/vscode-1.1.34.tgz", - "integrity": "sha512-GuT3tCT2N5Qp26VG4C+iGmWMgg/MuqtY5G5TSOT3U/X6pgjM9LFulJEeqpyf6gdzpI4VyU3ZN/lWPo54UFPuQg==", - "dev": true, - "requires": { - "glob": "^7.1.2", - "mocha": "^4.0.1", - "request": "^2.88.0", - "semver": "^5.4.1", - "source-map-support": "^0.5.0", - "url-parse": "^1.4.4", - "vscode-test": "^0.4.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, "vscode-extension-telemetry": { "version": "0.0.15", "resolved": "https://registry.npmjs.org/vscode-extension-telemetry/-/vscode-extension-telemetry-0.0.15.tgz", @@ -10657,16 +10456,6 @@ "applicationinsights": "1.0.1" } }, - "vscode-test": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/vscode-test/-/vscode-test-0.4.3.tgz", - "integrity": "sha512-EkMGqBSefZH2MgW65nY05rdRSko15uvzq4VAPM5jVmwYuFQKE7eikKXNJDRxL+OITXHB6pI+a3XqqD32Y3KC5w==", - "dev": true, - "requires": { - "http-proxy-agent": "^2.1.0", - "https-proxy-agent": "^2.2.1" - } - }, "watchpack": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", diff --git a/package.json b/package.json index 24f316d81..fdeff7383 100644 --- a/package.json +++ b/package.json @@ -1391,8 +1391,7 @@ "release": "npm i && npm run clean && npm run update-grammar && npm run release-cljs && webpack --mode production", "postrelease": "rimraf ./out/cljs-lib", "vscode:prepublish": "npm run release", - "bump-version": "npm set git-tag-version false && npm version patch", - "postinstall": "node ./node_modules/vscode/bin/install" + "bump-version": "npm set git-tag-version false && npm version patch" }, "dependencies": { "@types/escape-html": "0.0.20", @@ -1444,7 +1443,7 @@ "typescript": "^3.5.1", "url-loader": "^1.1.2", "vsce": "^1.67.1", - "vscode": "^1.1.34", + "@types/vscode": "^1.30.0", "webpack": "^4.33.0", "webpack-cli": "^3.3.5" } diff --git a/src/calva-fmt/src/docmirror/index.ts b/src/calva-fmt/src/docmirror/index.ts index 6298da477..37cff4162 100644 --- a/src/calva-fmt/src/docmirror/index.ts +++ b/src/calva-fmt/src/docmirror/index.ts @@ -7,9 +7,9 @@ let documents = new Map(); let registered = false; -function processChanges(document: vscode.TextDocument, contentChanges: vscode.TextDocumentContentChangeEvent[]) { - let model = documents.get(document) - for(let change of contentChanges) { +function processChanges(event: vscode.TextDocumentChangeEvent) { + let model = documents.get(event.document) + for(let change of event.contentChanges) { // vscode may have a \r\n marker, so it's line offsets are all wrong. let myStartOffset = model.getOffsetForLine(change.range.start.line)+change.range.start.character let myEndOffset = model.getOffsetForLine(change.range.end.line)+change.range.end.character @@ -21,16 +21,6 @@ function processChanges(document: vscode.TextDocument, contentChanges: vscode.Te model.dirtyLines = [] model.insertedLines.clear() model.deletedLines.clear(); - - // this is an important diagnostic check to ensure the models haven't de-synced, but it MUST be removed before release. - // let mtext = model.getText(0, model.maxOffset) - // let dtext = document.getText().replace(/\r\n/g,"\n"); - // if(mtext != dtext) { - // vscode.window.showErrorMessage("document hozed") - // console.error(mtext) - // console.error("vs") - // console.error(dtext) - // } } export function getDocument(doc: vscode.TextDocument) { @@ -82,7 +72,7 @@ export function activate() { vscode.workspace.onDidChangeTextDocument(e => { if (addDocument(e.document)) { - processChanges(e.document, e.contentChanges) + processChanges(e); } }); } diff --git a/src/repl-window.ts b/src/repl-window.ts index 46a41b122..f1a2ae26c 100644 --- a/src/repl-window.ts +++ b/src/repl-window.ts @@ -116,16 +116,16 @@ class REPLWindow { const cljTypeSlug = `clj-type-${cljType.replace(/ /, "-").toLowerCase()}`; const cljsTypeSlug = `cljs-type-${cljsType.replace(/ /, "-").toLowerCase()}`; let html = fs.readFileSync(path.join(ctx.extensionPath, "assets/webview.html")).toString(); - let script = vscode.Uri.file(path.join(ctx.extensionPath, "out/webview.js")).with({ scheme: 'vscode-resource' }).toString() + let script = panel.webview.asWebviewUri(vscode.Uri.file(path.join(ctx.extensionPath, "out/webview.js"))).toString() html = html.replace("{{script}}", script); - html = html.replace("{{logo-symbol}}", getImageUrl(`calva-symbol-logo.svg`)); + html = html.replace("{{logo-symbol}}", panel.webview.asWebviewUri(getImageUrl(`calva-symbol-logo.svg`)).toString()); html = html.replace(/{{hero-classes}}/g, `${type} ${cljTypeSlug} ${cljsTypeSlug}`); html = html.replace("{{clj-type}}", `${cljType.replace(/ /g, " ")}`); - html = html.replace("{{clj-type-logo}}", getImageUrl(`${cljTypeSlug}.svg`)); - html = html.replace("{{clj-logo}}", getImageUrl(`clj.svg`)); + html = html.replace("{{clj-type-logo}}", panel.webview.asWebviewUri(getImageUrl(`${cljTypeSlug}.svg`)).toString()); + html = html.replace("{{clj-logo}}", panel.webview.asWebviewUri(getImageUrl(`clj.svg`)).toString()); html = html.replace("{{cljs-type}}", `${cljsType.replace(/ /g, " ")}`); - html = html.replace("{{cljs-type-logo}}", getImageUrl((`${cljsTypeSlug}.svg`))); - html = html.replace("{{cljs-logo}}", getImageUrl(`cljs.svg`)); + html = html.replace("{{cljs-type-logo}}", panel.webview.asWebviewUri(getImageUrl((`${cljsTypeSlug}.svg`))).toString()); + html = html.replace("{{cljs-logo}}", panel.webview.asWebviewUri(getImageUrl(`cljs.svg`)).toString()); panel.webview.html = html; this.connect().catch(reason => { @@ -220,7 +220,7 @@ function getImageUrl(name: string) { if (!fs.existsSync(imagepath)) { imagepath = path.join(ctx.extensionPath, "assets/images/empty.svg"); } - return vscode.Uri.file(imagepath).with({ scheme: 'vscode-resource' }).toString() + return vscode.Uri.file(imagepath); } export async function reconnectReplWindow(mode: "clj" | "cljs") {