From 6289e32c5a2497761f163b8e469424a122c4eef2 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Tue, 15 Sep 2020 10:04:47 +0100 Subject: [PATCH] fix: space strip and tweak settings txt --- CHANGELOG.md | 5 +++++ extension.js | 2 ++ lib/format-on-type.provider.js | 4 +--- lib/txt2bas-version.command.js | 16 ++++++++++++++++ package-lock.json | 8 ++++---- package.json | 16 +++++++++++++--- 6 files changed, 41 insertions(+), 10 deletions(-) create mode 100644 lib/txt2bas-version.command.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b552e1..9212407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the "nextbasic" extension will be documented in this file. +## [1.5.3] - 2020-09-15 + +- Fix issues in format document when spaces were being incorrectly striped +- Add expose the current txt2bas version (useful for debugging) + ## [1.5.2] - 2020-09-10 - Add more detailed error reporting if cspect fails to launch diff --git a/extension.js b/extension.js index 5357bd9..a6ee4a9 100644 --- a/extension.js +++ b/extension.js @@ -15,6 +15,7 @@ const runInCspect = require('./lib/auto-run.task'); const validationDiagnostic = require('./lib/validation.diagnostic'); const shift = require('./lib/shift.command'); const renumber = require('./lib/renumber.command'); +const txt2basVersion = require('./lib/txt2bas-version.command'); /** * @param {vscode.ExtensionContext} context @@ -37,6 +38,7 @@ function activate(context) { context.subscriptions.push(hoverHelp()); context.subscriptions.push(runInCspect(context.extensionPath)); context.subscriptions.push(validationDiagnostic(context)); + context.subscriptions.push(txt2basVersion()); } function deactivate() {} diff --git a/lib/format-on-type.provider.js b/lib/format-on-type.provider.js index 48b0b56..2489d8f 100644 --- a/lib/format-on-type.provider.js +++ b/lib/format-on-type.provider.js @@ -10,9 +10,7 @@ const format = (module.exports.format = (document, position) => { const line = document.lineAt(position.line - 1).text; if (line.trim() === '') return; - const autoline = isAutoLine(document); - - const formatted = formatText(line, autoline); + const formatted = formatText(line, true); const editor = vscode.window.activeTextEditor; return editor.edit((editBuilder) => { editBuilder.replace( diff --git a/lib/txt2bas-version.command.js b/lib/txt2bas-version.command.js new file mode 100644 index 0000000..f1376ce --- /dev/null +++ b/lib/txt2bas-version.command.js @@ -0,0 +1,16 @@ +const vscode = require('vscode'); +const { version } = require('txt2bas'); + +console.log(version); + +module.exports = main; + +function main() { + return vscode.commands.registerTextEditorCommand( + 'nextbasic.txt2basVersion', + () => + vscode.window.showInformationMessage( + 'Current txt2bas version: v' + version + ) + ); +} diff --git a/package-lock.json b/package-lock.json index a900962..4cf472a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "nextbasic", - "version": "1.5.0", + "version": "1.5.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1703,9 +1703,9 @@ "dev": true }, "txt2bas": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/txt2bas/-/txt2bas-1.14.1.tgz", - "integrity": "sha512-yZ1F2RnJgBs6oN6p63jIo1WpTSYbDcH3GCSpCXn41LBGUW+dxbRV5ZbKsM7pAktx1w9RrbP9ILtPdfEwckSYdA==", + "version": "1.14.3", + "resolved": "https://registry.npmjs.org/txt2bas/-/txt2bas-1.14.3.tgz", + "integrity": "sha512-lY5vsu01mPawlkyfHITrx24EGgu9Q/ohQBKFdn1SbubHrvWp/zT4plRyC7dISQo+0jAOxbHRyObWFkedJkulgg==", "requires": { "@remy/unpack": "^2.1.6" } diff --git a/package.json b/package.json index 8965cf5..424f328 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "NextBASIC", "description": "NextBASIC", "publisher": "remysharp", - "version": "1.5.2", + "version": "1.5.3", "prettier": { "singleQuote": true }, @@ -45,7 +45,7 @@ "nextbasic.hdfmonkeyPath": { "type": "string", "default": "hdfmonkey", - "description": "Points the hdfmonkey binary, defaults to searching your $PATH" + "description": "Points the full path to the hdfmonkey executable, defaults to searching your $PATH" }, "nextbasic.commentWith": { "type": "string", @@ -115,6 +115,12 @@ "command": "nextbasic.commentLine", "key": "ctrl+/", "when": "!isMac && editorLangId == nextbasic" + }, + { + "key": "shift+ctrl+r", + "mac": "shift+cmd+r", + "command": "nextbasic.run", + "when": "editorTextFocus && editorLangId == 'nextbasic'" } ], "commands": [ @@ -153,6 +159,10 @@ { "title": "NextBASIC: Comment", "command": "nextbasic.commentLine" + }, + { + "title": "NextBASIC: txt2bas version", + "command": "nextbasic.txt2basVersion" } ] }, @@ -176,7 +186,7 @@ }, "dependencies": { "lodash.debounce": "^4.0.8", - "txt2bas": "^1.14.1" + "txt2bas": "^1.14.3" }, "repository": { "type": "git",