diff --git a/.vscode/settings.json b/.vscode/settings.json index 02d207bf0..2f9ffaa23 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,6 +12,7 @@ "arglists", "autoindent", "Batsov", + "behaviour", "bencode", "betterthantomorrow", "bhauman", @@ -33,6 +34,7 @@ "cljify", "cljslib", "CLJSREPL", + "Clojuredocs", "clojurians", "Clojurists", "cmdline", @@ -58,6 +60,7 @@ "docmirror", "Docstring", "Dorg", + "doseq", "dotimes", "Dvlaaad", "eckstein", @@ -103,6 +106,7 @@ "jszip", "junit", "keywordize", + "keywordized", "klepsch", "kondo", "lein", @@ -201,5 +205,17 @@ "languageId": ["clojure", "json", "typescript"], "allowCompoundWords": false } - ] + ], + "githubIssues.issueBranchTitle": "wip/${user}/issue-#${issueNumber}/${sanitizedIssueTitle}", + "typescript.tsdk": "node_modules/typescript/lib", + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "vscode.json-language-features" + }, + "[jsonc]": { + "editor.defaultFormatter": "vscode.json-language-features" + }, + "peacock.color": "#e48141" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 54ad77601..4ff96f7b3 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -12,7 +12,140 @@ "kind": "build", "isDefault": true }, - "problemMatcher": "$tsc-watch" + "problemMatcher": "$tsc-watch", + "presentation": { + "panel": "dedicated", + "group": "defaultCalva" + } + }, + { + "label": "Calva Test Watch", + "type": "npm", + "script": "unit-test-watch", + "isBackground": true, + "group": { + "kind": "test", + "isDefault": true + }, + "problemMatcher": { + // "owner": "mocha", + "fileLocation": ["relative", "${workspaceRoot}"], + "pattern": [ + { + "regexp": "^not\\sok\\s\\d+\\s(.*)$" + }, + { + "regexp": "\\s+(.*)$", + "message": 1 + }, + { + "regexp": "\\s+at\\s(.*)\\s\\((.*):(\\d+):(\\d+)\\)", + "file": 2, + "line": 3, + "column": 4 + } + ] + }, + "presentation": { + "panel": "dedicated", + "group": "defaultCalva" + } + }, + { + "label": "Calva Lint Watch", + "type": "npm", + "script": "eslint-watch", + "isBackground": true, + "group": { + "kind": "build", + "isDefault": false + }, + "problemMatcher": "$eslint-compact", + "presentation": { + "panel": "dedicated", + "group": "defaultCalva" + } + }, + { + "label": "Calva Prettier Check Watch", + "type": "npm", + "script": "prettier-check-watch", + "isBackground": true, + "group": { + "kind": "build", + "isDefault": false + }, + "problemMatcher": [ + { + "owner": "prettier", + "source": "prettier", + "fileLocation": ["relative", "${workspaceRoot}"], + "severity": "warning", + "pattern": { + "regexp": "\\[warn\\] (.+)", + "kind": "file", + "file": 1, + "message": 1 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "Checking formatting", + "endsPattern": "(\\[warn\\] Code style issues found in the above file\\(s\\))|(All matched files use Prettier code style!)" + } + }, + { + "owner": "prettier", + "source": "prettier", + "fileLocation": ["relative", "${workspaceRoot}"], + "severity": "error", + "pattern": { + "regexp": "\\[(error)\\] (.+?): (.+) \\((\\d+?):(\\d+?)\\)", + "kind": "location", + "severity": 1, + "file": 2, + "message": 3, + "line": 4, + "column": 5 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "Checking formatting", + "endsPattern": "(\\[warn\\] Code style issues found in the above file\\(s\\))|(All matched files use Prettier code style!)" + } + } + ], + "presentation": { + "panel": "dedicated", + "group": "defaultCalva" + } + }, + { + "label": "Calva Prettier Format Watch", + "type": "npm", + "script": "prettier-format-watch", + "isBackground": true, + "group": { + "kind": "build", + "isDefault": false + }, + + "presentation": { + "panel": "dedicated", + "group": "defaultCalva" + } + }, + { + "label": "Calva Dev", + "group": { + "kind": "build", + "isDefault": false + }, + "dependsOn": [ + "Calva Watch", + "Calva Test Watch", + "Calva Lint Watch", + "Calva Prettier Format Watch" + ] } ] } diff --git a/CHANGELOG.md b/CHANGELOG.md index e5b45b201..99faa73b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ Changes to Calva. - Maintenance: [Cleanup/removal of EditableDocument.selectionLeft/Right APIs](https://github.com/BetterThanTomorrow/calva/issues/1607)] - Update node version to v14, which is maintenance LTS until 2023-04-30 +- Maintenance: Create npm scripts for prettier format+check watching, and expose vsc tasks for watching unit tests, prettier format, eslint and a compound task to run them all in one go. + ## [2.0.261] - 2022-04-01 - Fix: [Results doc gets in a bad state and does not update](https://github.com/BetterThanTomorrow/calva/issues/1509) - Fix: [Indenting not working correctly in vectors starting with fn-like symbols](https://github.com/BetterThanTomorrow/calva/issues/1622) diff --git a/package.json b/package.json index 89cfa6e31..6e3961a52 100644 --- a/package.json +++ b/package.json @@ -2695,10 +2695,12 @@ "calva-lib-test": "node ./out/cljs-lib/test/cljs-lib-tests.js", "integration-test": "node ./out/extension-test/integration/runTests.js", "unit-test": "npx mocha --require ts-node/register 'src/extension-test/unit/**/*-test.ts'", - "unit-test-watch": "npm run unit-test -- --watch", + "unit-test-watch": "npx mocha --watch --require ts-node/register 'src/extension-test/unit/**/*-test.ts'", "publish": "bb publish.clj", "prettier-format": "npx prettier --write './**/*.{ts,js,json}'", "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}}", "eslint": "npx eslint . --ext .js,.jsx,.ts,.tsx", "eslint-watch": "npx esw . --ext .js,.jsx,.ts,.tsx --watch" },