From ab152efd87623c1bbcd36552a51579bee18779cc Mon Sep 17 00:00:00 2001 From: Rayat Date: Sat, 2 Apr 2022 11:48:47 -0700 Subject: [PATCH 01/11] Update TS -> 4.6.3 Fixes #1639 Update Project TS Version to 4.6.3 + some cspell Fixes #1639 --- package-lock.json | 174 +++++++++--------- package.json | 6 +- src/edit.ts | 2 +- .../unit/common/text-notation.ts | 4 +- src/paredit/extension.ts | 4 +- src/results-output/util.ts | 2 +- tsconfig.json | 2 +- 7 files changed, 97 insertions(+), 97 deletions(-) diff --git a/package-lock.json b/package-lock.json index 18921e3f6..a908f587f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,8 +43,8 @@ "@types/lodash": "^4.14.167", "@types/mocha": "^9.1.0", "@types/vscode": "^1.45.0", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", + "@typescript-eslint/eslint-plugin": "^5.17.0", + "@typescript-eslint/parser": "^5.17.0", "chai": "^4.2.0", "concurrently": "^6.3.0", "cson-parser": "^4.0.3", @@ -71,7 +71,7 @@ "tar": "^4.4.18", "ts-loader": "^8.0.18", "ts-node": "^10.3.0", - "typescript": "^3.9.10", + "typescript": "^4.6.3", "url-loader": "^4.1.1", "vsce": "^2.6.7", "vscode-test": "^1.3.0", @@ -1560,14 +1560,14 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.11.0.tgz", - "integrity": "sha512-HJh33bgzXe6jGRocOj4FmefD7hRY4itgjzOrSs3JPrTNXsX7j5+nQPciAUj/1nZtwo2kAc3C75jZO+T23gzSGw==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.17.0.tgz", + "integrity": "sha512-qVstvQilEd89HJk3qcbKt/zZrfBZ+9h2ynpAGlWjWiizA7m/MtLT9RoX6gjtpE500vfIg8jogAkDzdCxbsFASQ==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/type-utils": "5.11.0", - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/type-utils": "5.17.0", + "@typescript-eslint/utils": "5.17.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -1593,14 +1593,14 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.11.0.tgz", - "integrity": "sha512-x0DCjetHZYBRovJdr3U0zG9OOdNXUaFLJ82ehr1AlkArljJuwEsgnud+Q7umlGDFLFrs8tU8ybQDFocp/eX8mQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.17.0.tgz", + "integrity": "sha512-aRzW9Jg5Rlj2t2/crzhA2f23SIYFlF9mchGudyP0uiD6SenIxzKoLjwzHbafgHn39dNV/TV7xwQkLfFTZlJ4ig==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/typescript-estree": "5.17.0", "debug": "^4.3.2" }, "engines": { @@ -1620,13 +1620,13 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.11.0.tgz", - "integrity": "sha512-z+K4LlahDFVMww20t/0zcA7gq/NgOawaLuxgqGRVKS0PiZlCTIUtX0EJbC0BK1JtR4CelmkPK67zuCgpdlF4EA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.17.0.tgz", + "integrity": "sha512-062iCYQF/doQ9T2WWfJohQKKN1zmmXVfAcS3xaiialiw8ZUGy05Em6QVNYJGO34/sU1a7a+90U3dUNfqUDHr3w==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0" + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/visitor-keys": "5.17.0" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1637,12 +1637,12 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.11.0.tgz", - "integrity": "sha512-wDqdsYO6ofLaD4DsGZ0jGwxp4HrzD2YKulpEZXmgN3xo4BHJwf7kq49JTRpV0Gx6bxkSUmc9s0EIK1xPbFFpIA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.17.0.tgz", + "integrity": "sha512-3hU0RynUIlEuqMJA7dragb0/75gZmwNwFf/QJokWzPehTZousP/MNifVSgjxNcDCkM5HI2K22TjQWUmmHUINSg==", "dev": true, "dependencies": { - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/utils": "5.17.0", "debug": "^4.3.2", "tsutils": "^3.21.0" }, @@ -1663,9 +1663,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.11.0.tgz", - "integrity": "sha512-cxgBFGSRCoBEhvSVLkKw39+kMzUKHlJGVwwMbPcTZX3qEhuXhrjwaZXWMxVfxDgyMm+b5Q5b29Llo2yow8Y7xQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.17.0.tgz", + "integrity": "sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw==", "dev": true, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" @@ -1676,13 +1676,13 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.11.0.tgz", - "integrity": "sha512-yVH9hKIv3ZN3lw8m/Jy5I4oXO4ZBMqijcXCdA4mY8ull6TPTAoQnKKrcZ0HDXg7Bsl0Unwwx7jcXMuNZc0m4lg==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.17.0.tgz", + "integrity": "sha512-X1gtjEcmM7Je+qJRhq7ZAAaNXYhTgqMkR10euC4Si6PIjb+kwEQHSxGazXUQXFyqfEXdkGf6JijUu5R0uceQzg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/visitor-keys": "5.17.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -1703,15 +1703,15 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-g2I480tFE1iYRDyMhxPAtLQ9HAn0jjBtipgTCZmd9I9s11OV8CTsG+YfFciuNDcHqm4csbAgC2aVZCHzLxMSUw==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.17.0.tgz", + "integrity": "sha512-DVvndq1QoxQH+hFv+MUQHrrWZ7gQ5KcJzyjhzcqB1Y2Xes1UQQkTRPUfRpqhS8mhTWsSb2+iyvDW1Lef5DD7vA==", "dev": true, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/typescript-estree": "5.17.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -1749,12 +1749,12 @@ } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.11.0.tgz", - "integrity": "sha512-E8w/vJReMGuloGxJDkpPlGwhxocxOpSVgSvjiLO5IxZPmxZF30weOeJYyPSEACwM+X4NziYS9q+WkN/2DHYQwA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.17.0.tgz", + "integrity": "sha512-6K/zlc4OfCagUu7Am/BD5k8PSWQOgh34Nrv9Rxe2tBzlJ7uOeJ/h7ugCGDCeEZHT6k2CJBhbk9IsbkPI0uvUkA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.11.0", + "@typescript-eslint/types": "5.17.0", "eslint-visitor-keys": "^3.0.0" }, "engines": { @@ -10680,9 +10680,9 @@ } }, "node_modules/typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -13005,14 +13005,14 @@ } }, "@typescript-eslint/eslint-plugin": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.11.0.tgz", - "integrity": "sha512-HJh33bgzXe6jGRocOj4FmefD7hRY4itgjzOrSs3JPrTNXsX7j5+nQPciAUj/1nZtwo2kAc3C75jZO+T23gzSGw==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.17.0.tgz", + "integrity": "sha512-qVstvQilEd89HJk3qcbKt/zZrfBZ+9h2ynpAGlWjWiizA7m/MtLT9RoX6gjtpE500vfIg8jogAkDzdCxbsFASQ==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/type-utils": "5.11.0", - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/type-utils": "5.17.0", + "@typescript-eslint/utils": "5.17.0", "debug": "^4.3.2", "functional-red-black-tree": "^1.0.1", "ignore": "^5.1.8", @@ -13022,52 +13022,52 @@ } }, "@typescript-eslint/parser": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.11.0.tgz", - "integrity": "sha512-x0DCjetHZYBRovJdr3U0zG9OOdNXUaFLJ82ehr1AlkArljJuwEsgnud+Q7umlGDFLFrs8tU8ybQDFocp/eX8mQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.17.0.tgz", + "integrity": "sha512-aRzW9Jg5Rlj2t2/crzhA2f23SIYFlF9mchGudyP0uiD6SenIxzKoLjwzHbafgHn39dNV/TV7xwQkLfFTZlJ4ig==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/typescript-estree": "5.17.0", "debug": "^4.3.2" } }, "@typescript-eslint/scope-manager": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.11.0.tgz", - "integrity": "sha512-z+K4LlahDFVMww20t/0zcA7gq/NgOawaLuxgqGRVKS0PiZlCTIUtX0EJbC0BK1JtR4CelmkPK67zuCgpdlF4EA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.17.0.tgz", + "integrity": "sha512-062iCYQF/doQ9T2WWfJohQKKN1zmmXVfAcS3xaiialiw8ZUGy05Em6QVNYJGO34/sU1a7a+90U3dUNfqUDHr3w==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0" + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/visitor-keys": "5.17.0" } }, "@typescript-eslint/type-utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.11.0.tgz", - "integrity": "sha512-wDqdsYO6ofLaD4DsGZ0jGwxp4HrzD2YKulpEZXmgN3xo4BHJwf7kq49JTRpV0Gx6bxkSUmc9s0EIK1xPbFFpIA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.17.0.tgz", + "integrity": "sha512-3hU0RynUIlEuqMJA7dragb0/75gZmwNwFf/QJokWzPehTZousP/MNifVSgjxNcDCkM5HI2K22TjQWUmmHUINSg==", "dev": true, "requires": { - "@typescript-eslint/utils": "5.11.0", + "@typescript-eslint/utils": "5.17.0", "debug": "^4.3.2", "tsutils": "^3.21.0" } }, "@typescript-eslint/types": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.11.0.tgz", - "integrity": "sha512-cxgBFGSRCoBEhvSVLkKw39+kMzUKHlJGVwwMbPcTZX3qEhuXhrjwaZXWMxVfxDgyMm+b5Q5b29Llo2yow8Y7xQ==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.17.0.tgz", + "integrity": "sha512-AgQ4rWzmCxOZLioFEjlzOI3Ch8giDWx8aUDxyNw9iOeCvD3GEYAB7dxWGQy4T/rPVe8iPmu73jPHuaSqcjKvxw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.11.0.tgz", - "integrity": "sha512-yVH9hKIv3ZN3lw8m/Jy5I4oXO4ZBMqijcXCdA4mY8ull6TPTAoQnKKrcZ0HDXg7Bsl0Unwwx7jcXMuNZc0m4lg==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.17.0.tgz", + "integrity": "sha512-X1gtjEcmM7Je+qJRhq7ZAAaNXYhTgqMkR10euC4Si6PIjb+kwEQHSxGazXUQXFyqfEXdkGf6JijUu5R0uceQzg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/visitor-keys": "5.11.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/visitor-keys": "5.17.0", "debug": "^4.3.2", "globby": "^11.0.4", "is-glob": "^4.0.3", @@ -13076,15 +13076,15 @@ } }, "@typescript-eslint/utils": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.11.0.tgz", - "integrity": "sha512-g2I480tFE1iYRDyMhxPAtLQ9HAn0jjBtipgTCZmd9I9s11OV8CTsG+YfFciuNDcHqm4csbAgC2aVZCHzLxMSUw==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.17.0.tgz", + "integrity": "sha512-DVvndq1QoxQH+hFv+MUQHrrWZ7gQ5KcJzyjhzcqB1Y2Xes1UQQkTRPUfRpqhS8mhTWsSb2+iyvDW1Lef5DD7vA==", "dev": true, "requires": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.11.0", - "@typescript-eslint/types": "5.11.0", - "@typescript-eslint/typescript-estree": "5.11.0", + "@typescript-eslint/scope-manager": "5.17.0", + "@typescript-eslint/types": "5.17.0", + "@typescript-eslint/typescript-estree": "5.17.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, @@ -13108,12 +13108,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.11.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.11.0.tgz", - "integrity": "sha512-E8w/vJReMGuloGxJDkpPlGwhxocxOpSVgSvjiLO5IxZPmxZF30weOeJYyPSEACwM+X4NziYS9q+WkN/2DHYQwA==", + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.17.0.tgz", + "integrity": "sha512-6K/zlc4OfCagUu7Am/BD5k8PSWQOgh34Nrv9Rxe2tBzlJ7uOeJ/h7ugCGDCeEZHT6k2CJBhbk9IsbkPI0uvUkA==", "dev": true, "requires": { - "@typescript-eslint/types": "5.11.0", + "@typescript-eslint/types": "5.17.0", "eslint-visitor-keys": "^3.0.0" } }, @@ -20040,9 +20040,9 @@ } }, "typescript": { - "version": "3.9.10", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.10.tgz", - "integrity": "sha512-w6fIxVE/H1PkLKcCPsFqKE7Kv7QUwhU8qQY2MueZXWx5cPZdwFupLgKK3vntcK98BtNHZtAF4LA/yl2a7k8R6Q==", + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", "dev": true }, "uc.micro": { diff --git a/package.json b/package.json index 3345a96bc..d241cbd8a 100644 --- a/package.json +++ b/package.json @@ -2767,8 +2767,8 @@ "@types/lodash": "^4.14.167", "@types/mocha": "^9.1.0", "@types/vscode": "^1.45.0", - "@typescript-eslint/eslint-plugin": "^5.11.0", - "@typescript-eslint/parser": "^5.11.0", + "@typescript-eslint/eslint-plugin": "^5.17.0", + "@typescript-eslint/parser": "^5.17.0", "chai": "^4.2.0", "concurrently": "^6.3.0", "cson-parser": "^4.0.3", @@ -2795,7 +2795,7 @@ "tar": "^4.4.18", "ts-loader": "^8.0.18", "ts-node": "^10.3.0", - "typescript": "^3.9.10", + "typescript": "^4.6.3", "url-loader": "^4.1.1", "vsce": "^2.6.7", "vscode-test": "^1.3.0", diff --git a/src/edit.ts b/src/edit.ts index 76277baaa..98b407626 100644 --- a/src/edit.ts +++ b/src/edit.ts @@ -19,7 +19,7 @@ export function continueCommentCommand() { } const commentOffset = cursor.rowCol[1]; const commentText = cursor.getToken().raw; - const [_1, startText, bullet, num] = commentText.match(/^([;\s]+)([*-] +|(\d+)\. +)?/); + const [_1, startText, bullet, num] = commentText.match(/^([;\s]+)([*-] +|(\d+)\. +)?/) ?? []; const newNum = num ? parseInt(num) + 1 : undefined; const bulletText = newNum ? bullet.replace(/\d+/, '' + newNum) : bullet; const pad = ' '.repeat(commentOffset); diff --git a/src/extension-test/unit/common/text-notation.ts b/src/extension-test/unit/common/text-notation.ts index 9304ad773..ed674cf4f 100644 --- a/src/extension-test/unit/common/text-notation.ts +++ b/src/extension-test/unit/common/text-notation.ts @@ -14,8 +14,8 @@ import * as model from '../../../cursor-doc/model'; function textNotationToTextAndSelection(s: string): [string, { anchor: number; active: number }] { const text = s.replace(/•/g, '\n').replace(/\|?[<>]?\|/g, ''); - let anchor = undefined; - let active = undefined; + let anchor: undefined | number = undefined; + let active: undefined | number = undefined; anchor = s.indexOf('|>|'); if (anchor >= 0) { active = s.lastIndexOf('|>|') - 3; diff --git a/src/paredit/extension.ts b/src/paredit/extension.ts index 57e85031c..e136c7fce 100644 --- a/src/paredit/extension.ts +++ b/src/paredit/extension.ts @@ -40,7 +40,7 @@ function shouldKillAlsoCutToClipboard() { type PareditCommand = { command: string; - handler: (doc: EditableDocument) => void; + handler: (doc: EditableDocument) => void | Promise; }; const pareditCommands: PareditCommand[] = [ // NAVIGATING @@ -391,7 +391,7 @@ function wrapPareditCommand(command: PareditCommand) { if (!enabled || !languages.has(textEditor.document.languageId)) { return; } - command.handler(mDoc); + void command.handler(mDoc); } catch (e) { console.error(e.message); } diff --git a/src/results-output/util.ts b/src/results-output/util.ts index 822ed1894..2e08c683e 100644 --- a/src/results-output/util.ts +++ b/src/results-output/util.ts @@ -1,7 +1,7 @@ import { takeWhile } from 'lodash'; import type { ResultsBuffer } from './results-doc'; -function addToHistory(history: string[], content: string): string[] { +function addToHistory(history: string[], content?: string): string[] { if (content) { const entry = content.trim(); if (entry !== '') { diff --git a/tsconfig.json b/tsconfig.json index c97595b94..a07a64cca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,7 +18,7 @@ "module": "commonjs", "target": "es6", "outDir": "out", - "lib": ["es2020", "dom", "ESNext.String"], + "lib": ["es2020", "dom"], "sourceMap": true, "rootDir": "src" }, From d8cc25c6a1a89c0d95b4c276389f5545213215dd Mon Sep 17 00:00:00 2001 From: Rayat Date: Sat, 2 Apr 2022 11:55:02 -0700 Subject: [PATCH 02/11] Add changelog entry for #1639 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b538e05b5..444056635 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Changes to Calva. ## [Unreleased] +- Maintenance: [Upgrade TS + some ts eslint plugins + fix any necessary changes thereof](https://github.com/BetterThanTomorrow/calva/issues/1639) + ## [2.0.262] - 2022-04-02 - Tech debt mortgage: [Cleanup/removal of EditableDocument.selectionLeft/Right APIs](https://github.com/BetterThanTomorrow/calva/issues/1607)] - Maintenance: [Update node version to v14, which is maintenance LTS until 2023-04-30](https://github.com/BetterThanTomorrow/calva/pull/1656) From 44fa8f98ec9ade6b9a11814f94e9025df81ac40e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 08:33:02 +0200 Subject: [PATCH 03/11] Update docs about failed Parinfer experiment [skip ci] --- docs/site/parinfer.md | 86 +++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/docs/site/parinfer.md b/docs/site/parinfer.md index 49cb30cf2..54fa2769a 100644 --- a/docs/site/parinfer.md +++ b/docs/site/parinfer.md @@ -1,20 +1,57 @@ --- title: Parinfer -description: Learn how to leverage Calva Parinfer Mode for structural editing +description: Use Calva v2.0.227 to test the experimental and reverted Parinfer Mode for structural editing --- -# Calva Parinfer Mode +# Calva Parinfer Mode is Reverted -!!! Note "Reverted in Calva v2.0.228" - The changes in v2.0.227 seemed to cause problems for some users. Unclear yet if and why. But to not risk causing problems for more users these changes where reverted and Calva v2.0.228 does not contain them. **Please consider using v2.0.227 and help find what the problems are about!** +!!! Failure "Reverted in Calva v2.0.228" + The changes in v2.0.227 seemed to cause problems for some users. Unclear yet if and why. But to not risk causing problems for more users these changes where reverted and Calva v2.0.228 does not contain them. **Please consider using v2.0.227 and help find what the problems are about!** Please note: Even in v2.0.227 this feature is currently disabled by default. [Parinfer](https://shaunlebron.github.io/parinfer/) is a system for editing the structure of LISP text without explicit commands. The structure can be regarded as already being expressed through indentation. With Parinfer you can use your intuition about the structure _inferred_ from the indentation to perform surprisingly many structural edits. -!!! Note "Experimental" - This feature is currently disabled by default and should be considered experimental. There are known [quirks](#quirks). Especially beginners should take note. Parinfer is not as beginner friendly as it might seem, and with the quirks it might be extra ”dangerous”. +## Quirks + +There are some known quirks, of varying severity, with this feature. Some of them will need to be fixed before we move this feature out of **Experimental** status. + +For the most times you can always *Undo* to get back to where the document was fine. You just need to pay some attention and be aware when undo is needed. + +### No multi-cursor support + +The bracket inference will remove all cursors but the first one. So for instance if you edit with multiple cursors and it causes brackets to move, you'll end up with just one cursor and the subsequent edits will not be what you intended. This is particularly important to note when you have cursors that are not in the viewport. In such cases it might be better to turn Parinfer off while you do the edits, fix formatting and such manually and then switch Parinfer on again. + +### Wrong inferences + +For yet unknown reasons an edit such as the following does the wrong thing (the cursor indicated by the vertical bar): + +```clojure +(foo| (bar) + (baz)) +``` + +backspace => + +```clojure +(fo| (bar + (baz))) +``` + +That is `(baz)` is slurped. When what should happen is: + +```clojure +(fo| (bar) + (baz)) +``` + +### Lag causing errors when fast typing + +The way that Calva Parinfer works is that for any edit of the document it first reformats the code around the cursor, then infer brackets. Currently these two steps are not atomic to VS Code, so if you type fast bracket inference might happen on the yet unformatted code, and thus not be correct. You might also see the cursor end up at the wrong position at times. ## Infer Parens +!!! Mote "This is no longer available in Calva" + See above about how to try this build anyway, warts and all. + When you enable Calva's Parinfer it is all about infering brackets from indentation. There are no further Parinfer modes. Calva's auto-formatter will take care of keeping the code correctly indented. Enable it with from this setting: `calva.fmt.experimental.inferParensAsYouType` or from the status bar item. @@ -74,43 +111,6 @@ In Calva, Parinfer and [Paredit](paredit.md) are designed to coexist and both be If you want to have Parinfer you are probably best served by Calva's built-in version. It is designed, and will continue to be improved to function well together with Calva's other structural editing and formatting features. _It will also probably conflict with the Parinfer Extension._ -## Quirks - -There are some known quirks, of varying severity, with this feature. Some of them will need to be fixed before we move this feature out of **Experimental** status. - -For the most times you can always *Undo* to get back to where the document was fine. You just need to pay some attention and be aware when undo is needed. - -### No multi-cursor support - -The bracket inference will remove all cursors but the first one. So for instance if you edit with multiple cursors and it causes brackets to move, you'll end up with just one cursor and the subsequent edits will not be what you intended. This is particularly important to note when you have cursors that are not in the viewport. In such cases it might be better to turn Parinfer off while you do the edits, fix formatting and such manually and then switch Parinfer on again. - -### Wrong inferences - -For yet unknown reasons an edit such as the following does the wrong thing (the cursor indicated by the vertical bar): - -```clojure -(foo| (bar) - (baz)) -``` - -backspace => - -```clojure -(fo| (bar - (baz))) -``` - -That is `(baz)` is slurped. When what should happen is: - -```clojure -(fo| (bar) - (baz)) -``` - -### Lag causing errors when fast typing - -The way that Calva Parinfer works is that for any edit of the document it first reformats the code around the cursor, then infer brackets. Currently these two steps are not atomic to VS Code, so if you type fast bracket inference might happen on the yet unformatted code, and thus not be correct. You might also see the cursor end up at the wrong position at times. - ## See also * [Paredit](paredit.md) From 942298271b3b3cfff40226e94b5cda006d534966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 09:01:29 +0200 Subject: [PATCH 04/11] Fix syntax [skip ci] --- docs/site/formatting.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/site/formatting.md b/docs/site/formatting.md index 0a3b47c39..405c9d0d4 100644 --- a/docs/site/formatting.md +++ b/docs/site/formatting.md @@ -37,8 +37,7 @@ Not a fan of some default setting? The formatter is quite configurable. You configure Calva's formatting using [cljfmt's configuration EDN](https://github.com/weavejester/cljfmt#configuration). This means that you can adjust the above mentioned defaults, including the indenting. -This configuration can either be provided via a file or via clojure-lsp (see [Clojure LSP Settings] -(https://clojure-lsp.io/settings/)). +This configuration can either be provided via a file or via clojure-lsp (see [Clojure LSP Settings](https://clojure-lsp.io/settings/)). ??? Note "Only use the clojure-lsp config option if you need it" The option to read formatting config from clojure-lsp is there to let teams where some members use clojure-lsp for formatting, share the config. To provide the settings via clojure-lsp, set `calva.fmt.configPath` to `CLOJURE-LSP` (case sensitive). However, there are limitations: From fe471e4f91879c7c82ba73b22c0902d1551c9915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 10:24:24 +0200 Subject: [PATCH 05/11] Do formatting before format watch --- .vscode/tasks.json | 2 +- package.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index e0444a50f..b05265257 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -21,7 +21,7 @@ { "label": "Calva Watch CLJS", "type": "npm", - "script": "watch", + "script": "watch-cljs", "isBackground": true, "group": { "kind": "build", diff --git a/package.json b/package.json index df1344b5b..118670d65 100644 --- a/package.json +++ b/package.json @@ -2712,10 +2712,10 @@ "compile": "npm run compile-cljs && npm run compile-ts", "watch-ts": "npx tsc --watch --project ./tsconfig.json", "watch-cljs": "npx shadow-cljs watch :calva-lib :test", - "watch": "npm run watch-cljs", - "watch-with-strict-nulls": "npx tsc --watch --project ./tsconfig.json --strictNullChecks", + "watch-ts-with-strict-nulls": "npx tsc --watch --project ./tsconfig.json --strictNullChecks", "release-cljs": "npx shadow-cljs release :calva-lib :test", "release": "npm i && npm run clean && npm run update-grammar && npm run release-cljs && webpack --mode production", + "prerelease": "npm run precompile && npm run release-cljs", "compile-test": "tsc -p ./", "postrelease": "", "vscode:prepublish": "npm run release", @@ -2729,6 +2729,7 @@ "prettier-check": "npx prettier --check './**/*.{ts,js,json}'", "prettier-check-watch": "npx onchange './**/*.{ts,js,json}' -- prettier --check {{changed}}", "prettier-format-watch": "npx onchange './**/*.{ts,js,json}' -- prettier --write {{changed}}", + "preprettier-format-watch": "npm run prettier-format", "eslint": "npx eslint . --ext .js,.jsx,.ts,.tsx", "eslint-watch": "npx esw . --ext .js,.jsx,.ts,.tsx --watch" }, From fc3dbd858d4ba974269664e4b09da196dcb64c84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 15:19:54 +0200 Subject: [PATCH 06/11] Harmonize task names --- .vscode/tasks.json | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index b05265257..4e4b7a583 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -48,7 +48,7 @@ } }, { - "label": "Calva Test Watch", + "label": "Calva Watch Test TS", "type": "npm", "script": "unit-test-watch", "isBackground": true, @@ -81,7 +81,7 @@ } }, { - "label": "Calva Lint Watch", + "label": "Calva Watch Lint", "type": "npm", "script": "eslint-watch", "isBackground": true, @@ -96,7 +96,7 @@ } }, { - "label": "Calva Prettier Format Watch", + "label": "Calva Watch TS Format", "type": "npm", "script": "prettier-format-watch", "isBackground": true, @@ -109,17 +109,17 @@ } }, { - "label": "Calva Watch", + "label": "Calva Watchers", "group": { "kind": "build", "isDefault": false }, "dependsOn": [ - "Calva Prettier Format Watch", + "Calva Watch TS Format", "Calva Watch TS", "Calva Watch CLJS", - "Calva Test Watch", - "Calva Lint Watch" + "Calva Watch Test TS", + "Calva Watch Lint" ] }, { @@ -129,7 +129,7 @@ "isDefault": true }, "dependsOrder": "sequence", - "dependsOn": ["Calva Compile", "Calva Watch"] + "dependsOn": ["Calva Compile", "Calva Watchers"] } ] } From c63450f4acc2776863f1f56393859631778ac0c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 22:34:58 +0200 Subject: [PATCH 07/11] Append prompt after switcing ns of output window Fixes #1503 --- CHANGELOG.md | 3 ++- src/results-output/results-doc.ts | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae801eb66..43189589c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,9 @@ Changes to Calva. ## [Unreleased] - [Improve kondo configuration documentation](https://github.com/BetterThanTomorrow/calva/issues/1282) - [Require VS Code 1.66+ (and update project node version to 16+)](https://github.com/BetterThanTomorrow/calva/issues/1638#issuecomment-1086726236) - - Maintenance: [Upgrade TS + some ts eslint plugins + fix any necessary changes thereof](https://github.com/BetterThanTomorrow/calva/issues/1639) +- Fix: [Command not working: sync the Output/REPL window namespace with the current file](https://github.com/BetterThanTomorrow/calva/issues/1503) + ## [2.0.262] - 2022-04-02 - Tech debt mortgage: [Cleanup/removal of EditableDocument.selectionLeft/Right APIs](https://github.com/BetterThanTomorrow/calva/issues/1607)] diff --git a/src/results-output/results-doc.ts b/src/results-output/results-doc.ts index f8fd08571..4e2bf8c7d 100644 --- a/src/results-output/results-doc.ts +++ b/src/results-output/results-doc.ts @@ -229,10 +229,11 @@ export async function setNamespaceFromCurrentFile() { const session = replSession.getSession(); const ns = namespace.getNamespace(util.tryToGetDocument({})); if (getNs() !== ns && util.isDefined(ns)) { - await session.eval("(in-ns '" + ns + ')', session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; } setSession(session, ns); replSession.updateReplSessionType(); + appendPrompt(); } async function appendFormGrabbingSessionAndNS(topLevel: boolean) { @@ -250,7 +251,7 @@ async function appendFormGrabbingSessionAndNS(topLevel: boolean) { } if (code != '') { if (getNs() !== ns) { - await session.eval("(in-ns '" + ns + ')', session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; } setSession(session, ns); append(code, (_) => revealResultsDoc(false)); From 949df97b7cf8b03c4615e1997d92cf01c7ee9bb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 22:36:20 +0200 Subject: [PATCH 08/11] Always refer-clojure after switching ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fewer strange ”str is not defined” type of errors --- src/evaluate.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/evaluate.ts b/src/evaluate.ts index efc3c741a..40b4eaf3e 100644 --- a/src/evaluate.ts +++ b/src/evaluate.ts @@ -93,7 +93,7 @@ async function evaluateCode( const err: string[] = []; if (outputWindow.getNs() !== ns) { - await session.eval("(in-ns '" + ns + ')', session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; } const context: NReplEvaluation = session.eval(code, ns, { @@ -417,7 +417,7 @@ async function loadFile( outputWindow.append('; Evaluating file: ' + fileName); - await session.eval("(in-ns '" + ns + ')', session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; const res = session.loadFile(fileContents, { fileName, @@ -474,7 +474,7 @@ async function requireREPLUtilitiesCommand() { if (session) { try { await namespace.createNamespaceFromDocumentIfNotExists(util.tryToGetDocument({})); - await session.eval("(in-ns '" + ns + ')', session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; await session.eval(form, ns).value; chan.appendLine(`REPL utilities are now available in namespace ${ns}.`); } catch (e) { @@ -548,7 +548,7 @@ export async function evaluateInOutputWindow( const session = replSession.getSession(sessionType); replSession.updateReplSessionType(); if (outputWindow.getNs() !== ns) { - await session.eval(`(in-ns '${ns})`, session.client.ns).value; + await session.eval(`(in-ns '${ns}) (clojure.core/refer-clojure)`, session.client.ns).value; outputWindow.setSession(session, ns); if (options.evaluationSendCodeToOutputWindow !== false) { outputWindow.appendPrompt(); From dc4a8791621229e03c1df228b6d246bb6e676a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Wed, 6 Apr 2022 22:57:55 +0200 Subject: [PATCH 09/11] Add changelog section for v2.0.263 [skip ci] --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 43189589c..52787b539 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Changes to Calva. ## [Unreleased] + +## [2.0.263] - 2022-04-06 - [Improve kondo configuration documentation](https://github.com/BetterThanTomorrow/calva/issues/1282) - [Require VS Code 1.66+ (and update project node version to 16+)](https://github.com/BetterThanTomorrow/calva/issues/1638#issuecomment-1086726236) - Maintenance: [Upgrade TS + some ts eslint plugins + fix any necessary changes thereof](https://github.com/BetterThanTomorrow/calva/issues/1639) From d3ec568fb309471e44113501868a922c1cbfb12b Mon Sep 17 00:00:00 2001 From: Peter Date: Wed, 6 Apr 2022 21:07:09 +0000 Subject: [PATCH 10/11] Bring on version 2.0.264! --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e3cd8917..7cc0038ff 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "calva", - "version": "2.0.263", + "version": "2.0.264", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "calva", - "version": "2.0.263", + "version": "2.0.264", "license": "MIT", "dependencies": { "@types/escape-html": "0.0.20", diff --git a/package.json b/package.json index 118670d65..9d699c983 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Calva: Clojure & ClojureScript Interactive Programming", "description": "Integrated REPL, formatter, Paredit, and more. Powered by cider-nrepl and clojure-lsp.", "icon": "assets/calva.png", - "version": "2.0.263", + "version": "2.0.264", "publisher": "betterthantomorrow", "author": { "name": "Better Than Tomorrow", From d13bc3ebde5eae579a574faffd20437f2fb5b01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Str=C3=B6mberg?= Date: Thu, 7 Apr 2022 07:29:10 +0200 Subject: [PATCH 11/11] Theme the test-data project --- test-data/.vscode/settings.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test-data/.vscode/settings.json b/test-data/.vscode/settings.json index 913aa2ffb..48eeb143c 100644 --- a/test-data/.vscode/settings.json +++ b/test-data/.vscode/settings.json @@ -14,5 +14,12 @@ "name": "Show doc string", "snippet": "(clojure.string/replace (with-out-str (clojure.repl/doc $hover-text)) \"\n\" \"\n\n\")" } - ] + ], + "workbench.colorCustomizations": { + "sash.hoverBorder": "#DB9550", + "titleBar.activeBackground": "#90B4FE", + "titleBar.activeForeground": "#131722", + "titleBar.inactiveBackground": "#90B4FEd5", + "titleBar.inactiveForeground": "#13172299" + } }