Last active
January 17, 2021 15:57
-
-
Save sametoz/9de3ffd12bd71f93aa790ca995c9ccb7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as vscode from 'vscode'; | |
export function activate(context: vscode.ExtensionContext) { | |
console.log('Congratulations, your extension "tertip" is now active!'); | |
const editor = vscode.window.activeTextEditor; | |
let disposable = vscode.commands.registerCommand('tertip.clearSpaces', () => { | |
if (editor) { | |
const document = editor.document; | |
const selection = editor.selection; | |
const selectedPortion = document.getText(selection); | |
const withoutSpaces = selectedPortion.replace(/\s+/g, ''); | |
editor.edit(editBuilder => { | |
editBuilder.replace(selection, withoutSpaces); | |
}); | |
vscode.window.showInformationMessage('Everything is non-spaces!'); | |
} | |
}); | |
context.subscriptions.push(disposable); | |
} | |
export function deactivate() {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment