diff options
author | Indrajith K L | 2017-09-20 17:36:13 +0530 |
---|---|---|
committer | Indrajith K L | 2017-09-20 17:36:13 +0530 |
commit | b2eb4987896cd70bd594aaed11dd075e463cb2a5 (patch) | |
tree | b15e5995b1ef8d800294456e744af0234c0153b4 /src | |
parent | fa707962d8bd220b611f6f5f29cba11ca7e67a92 (diff) | |
download | KopyPlugin-b2eb4987896cd70bd594aaed11dd075e463cb2a5.tar.gz KopyPlugin-b2eb4987896cd70bd594aaed11dd075e463cb2a5.tar.bz2 KopyPlugin-b2eb4987896cd70bd594aaed11dd075e463cb2a5.zip |
Added context menu and get selected text
Diffstat (limited to 'src')
-rw-r--r-- | src/extension.ts | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/extension.ts b/src/extension.ts index 4aa7a1a..f706a2c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -2,6 +2,7 @@ // The module 'vscode' contains the VS Code extensibility API // Import the module and reference it with the alias vscode in your code below import * as vscode from 'vscode'; +import * as axios from 'axios'; // this method is called when your extension is activated // your extension is activated the very first time the command is executed @@ -14,14 +15,21 @@ export function activate(context: vscode.ExtensionContext) { // The command has been defined in the package.json file // Now provide the implementation of the command with registerCommand // The commandId parameter must match the command field in package.json - let disposable = vscode.commands.registerCommand('extension.sayHello', () => { - // The code you place here will be executed every time your command is executed + + let olaCommand = vscode.commands.registerCommand('extension.kopyit', (data) => { + // The code you place here will be executed every time your command is executed + const editor = vscode.window.activeTextEditor; + const document = editor.document; + + console.log(editor.selection); + let selectedText = document.getText(new vscode.Range(editor.selection.start, editor.selection.end)); + console.log(selectedText); // Display a message box to the user - vscode.window.showInformationMessage('Hello World!'); + vscode.window.showInformationMessage('Hello Worlds!'); }); - context.subscriptions.push(disposable); + context.subscriptions.push(olaCommand); } // this method is called when your extension is deactivated |