vscode-extensions

VS Code: How to access debug variables from within extension?

北慕城南 提交于 2019-12-03 21:27:01
I am writing an extension for visual studio code where I want to evaluate the current variables of a javascript debug session. These variables are normally shown when one have open the debug pane under the section VARIABLES . See the attached screenshot. I want to get access to these variables when the user right clicks the editor, but I don't know how. My current extension setting for this is like that: in the package.json I have registered a menu contribution along with a command: "contributes": { "menus": { "editor/context": [{ "command": "extension.showVariables", "group": "navigation" }]

How to programmatically close vscode.window's showInformationMessage box

不想你离开。 提交于 2019-12-03 14:14:31
I just began learning about vscode extensions and I'm wondering if there is a simple way to programmatically close the information message box that is generated via vscode.window.showInformationMessage() . If you want to reproduce, I started with the WordCount demo here , and after copy/pasting the body of extension.ts , as outlined in the tutorial, I made some modifications to activate() like so... export function activate(context: ExtensionContext) { let wordCounter = new WordCounter(); let wcTimeout = null; let setWCTimeout = function() { clearWCTimeout(); wcTimeout = setTimeout

VS Code execute current line or selection to in the integrated console

扶醉桌前 提交于 2019-12-03 13:37:58
This old Emacs user, who is used to elpy, is attempting to move onto VSCode with Scala & more specifically Ammonite repl. I used Ctrl+' to open the integrated terminal & all I have to do is type amm on the bash shell (ubuntu) to open the repl; however, I still miss being able to send the either the line or selection from the editor to integrated shell with Ctrl+Enter. I guess this means a bit of coding. Where can I start? Has anyone accomplished similar? Thanks much, user6273920 Actually, I found that adding VSCode Macros extension does the job: I just changed settings.json: { "window

How to create a custom dialog in vscode?

我们两清 提交于 2019-12-03 13:00:19
I'm developing an extension for vscode, and I want to display a custom dialog to help the user configure an ini file. It's possible to create a custom dialog, with labels and inputs? Llewey You cannot create new UI elements, but if you want to get inputs from the user you can use code like below: let options: InputBoxOptions = { prompt: "Label: ", placeHolder: "(placeholder)" } window.showInputBox(options).then(value => { if (!value) return; answer1 = value; // show the next dialog, etc. }); This will use the same UI as the command palette (when you press Ctrl + P , or any of the other

Contribute language association from extensions in VSCode

浪尽此生 提交于 2019-12-02 07:00:44
问题 How can I contribute a language association from an extension in VSCode? In settings.json it would've looked like this: "files.associations": { "*.something": "markdown" } I know that it's possible to use vscode.languages.setTextDocumentLanguage . But that seems excessive to do every time the activeEditor changes, and it's one more event listener. Using the API to write into user settings doesn't seem right either. 回答1: Yes, extensions can contribute settings via configurationDefaults.

Capturing keystrokes in visual studio code extension

試著忘記壹切 提交于 2019-12-02 06:26:14
问题 I would like to be able to capture keystrokes in a visual studio code extension. I need to know the new text that was either added or removed and the position of the change in the file. I have registered a listener: vscode.window.onDidChangeTextEditorSelection(handleChange) and am getting updates on every single caret move but I am having a hard time getting added/removed text and positions from the event that is passed in. Currently, I am doing this in the handler: function handleChange

Adding drag and drop support in a custom TreeView

独自空忆成欢 提交于 2019-12-02 05:36:09
问题 I have successfully populated a TreeView via creating a TreeDataProvider and customized the icons and its collapse-able property. Now I want to be able to drag and drop its ViewItem (s) onto a WebView. There are unfortunately no samples for drag and drop. Reading through the TreeView source, ViewItem (s) are created in HeightMap.OnInsertItems() via the TreeView.createViewItem() , from the derived class. The public TreeView.onInsertItem() would appear to be a great extension point, extending

Contribute language association from extensions in VSCode

本小妞迷上赌 提交于 2019-12-02 05:00:34
How can I contribute a language association from an extension in VSCode? In settings.json it would've looked like this: "files.associations": { "*.something": "markdown" } I know that it's possible to use vscode.languages.setTextDocumentLanguage . But that seems excessive to do every time the activeEditor changes, and it's one more event listener. Using the API to write into user settings doesn't seem right either. Yes, extensions can contribute settings via configurationDefaults . However, I don't think this works for the files.associations setting. What you can do instead is contribute a new

Capturing keystrokes in visual studio code extension

我与影子孤独终老i 提交于 2019-12-02 02:31:50
I would like to be able to capture keystrokes in a visual studio code extension. I need to know the new text that was either added or removed and the position of the change in the file. I have registered a listener: vscode.window.onDidChangeTextEditorSelection(handleChange) and am getting updates on every single caret move but I am having a hard time getting added/removed text and positions from the event that is passed in. Currently, I am doing this in the handler: function handleChange(event) { console.log("Change in the text editor"); for(var i = 0;i < event.selections.length;i++) { var

Adding drag and drop support in a custom TreeView

孤街醉人 提交于 2019-12-02 01:17:47
I have successfully populated a TreeView via creating a TreeDataProvider and customized the icons and its collapse-able property. Now I want to be able to drag and drop its ViewItem (s) onto a WebView. There are unfortunately no samples for drag and drop. Reading through the TreeView source, ViewItem (s) are created in HeightMap.OnInsertItems() via the TreeView.createViewItem() , from the derived class. The public TreeView.onInsertItem() would appear to be a great extension point, extending TreeView and onInsertItem() and capturing its ViewItem parameter. This Unfortunately, the creation of