vscode-extensions

Visual Studio Code: Is it possible to make a decorations hoverMessage clickable

时光毁灭记忆、已成空白 提交于 2019-12-10 16:58:09
问题 Hi I am developing an extension for VSCode. I am decorating the text editor and hovering some items. Is it possible to make clickable items at hoverMessage and modify the range according to it. The extension is at: https://marketplace.visualstudio.com/items?itemName=serayuzgur.crates You can see the hoverMessage from the GIF 回答1: Yes, using markdown you can then create a command link that will execute a command when a user clicks on it: import * as vscode from 'vscode'; const myContent = new

What regular expression variant is used in Visual Studio code?

ⅰ亾dé卋堺 提交于 2019-12-10 10:19:23
问题 I know that I can use Ruby's regular expressions in a tmLanguage file, however that seems not to be the case in other configuration files, e.g. for extensions. Take for example the firstLine value in the language contribution. I get errors when I use character classes (e.g. \s or \p{L} ). Hence I wonder what is actually allowed there. How would you match whitespaces there? Update : After the comments I tried this: "firstLine": "^(lexer|parser)?\\s*grammar\\w+;" which is supposed to match a

How to open browser from Visual Studio Code API

岁酱吖の 提交于 2019-12-09 16:34:03
问题 I am just exploring a way in order to open the default browser from Visual Studio Code API used for developing extensions. Following is my code : var disposable = vscode.commands.registerCommand('extension.browser', () => { // The code you place here will be executed every time your command is executed vscode.Uri.call("http://facebook.com"); }); How to open Browser URL from API using vscode class. 回答1: There is no need for node or external libraries. If you are using VS Code 1.31+, use the

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

怎甘沉沦 提交于 2019-12-09 14:09:15
问题 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:

How can I change the coloring of parentheses and brackets?

£可爱£侵袭症+ 提交于 2019-12-09 13:42:14
问题 This might be a general vsCode question, but I'm trying to make it work in the Microsoft Python plugin for vsCode. I tried all the textMate definitions that show as intellisense suggestions when editing the settings file but none worked. I want to either colorize the parentheses, braces & brackets or any other token in order to make a visual difference between the preceding identifier (function name or collection name) and what goes inside the delimiters (function arguments or collection

How can I implement my own code outline layout in vscode?

这一生的挚爱 提交于 2019-12-09 09:48:20
问题 I'm looking for an extension in Visual Studio Code (vscode) where I can define my custom code outline. Essentially, listing all my functions/definitions in a tree-like manner. Let's say I'm using a simple language that looks as follows: begin foo1 arriving procedure move into queue1 print queue1 send to foo2 end begin foo2 arriving procedure move into queue2 print queue2 send to foo3 end I would like to know if there is an extension for vscode that let's me implement something like this:

Detect when document is closed

房东的猫 提交于 2019-12-08 15:44:41
问题 I'm working on Visual Studio Code extension and I need to detect when some document window is closed. I know about vscode.workspace.onDidCloseTextDocument event and it works at general. But if I open a file from the workspace via API: vscode.workspace.openTextDocument(localPath).then(function (doc) { vscode.window.showTextDocument(doc, 1); }); and then close it, the onDidCloseTextDocument doesn't fire as usual. Its fire but few minutes later. I know if this is some bug or this is the way

WebView Extension in TypeScript

╄→尐↘猪︶ㄣ 提交于 2019-12-08 13:46:43
问题 In the code example (catcoding) the backing webview logic is written as an anonymous function in JavaScript however I would like to build this backing logic in Typescript. I have tired to reproduce this logic as a typescript package with requireJS but I can't get this to work. // This script will be run within the webview itself // It cannot access the main VS Code APIs directly. (function () { const vscode = acquireVsCodeApi(); … }(); I expect to build this backing WebView logic within

How do I contribute a command to the VS Code explorer title bar or command palette that is only active when my webview is focused?

感情迁移 提交于 2019-12-08 04:48:14
问题 I'm writing an extension that uses VS Code's webview api. My extension also registers a refresh preview command that updates the webview's content. How can I make it so that: The refresh preview command only shows up in the command palette when my webview is focused? The refresh preview command shows in the webview's editor title bar? 回答1: First, create a custom context key that tracks when your webview is focused. Use VS Code's setContext command to make this context key track when your

How to use “!” as the comment indicator, but also NOT operator in language syntax highlight?

若如初见. 提交于 2019-12-08 03:52:02
问题 I am using VScode and create my own language extension to highlight syntax, where I need to use regular expression to find the comments. The basic rule is that everything after ! is a comment, however there is a special case. When ! is inside eval() command, it means NOT. For example some of my code would look like: if condition=(eval(!DB_EXIST)) ! this is a comment (eval( !DB_UPDATED && !DB_EXIST)) !---"!" inside eval() means NOT !this is another comment <some commands> ! this is also a