vscode-extensions

Using VSCode Extensions in Visual Studio

时光怂恿深爱的人放手 提交于 2019-12-08 01:01:50
问题 Today I found a VSCode extension that I would very much love to use in Visual Studio 2017 (Pro or Enterprise). I'm not at all familiar with VSCode. Are the platforms entirely different, or is there some hope that I could somehow modify the extension and "port it over"? 回答1: Are the platforms entirely different [...] Yes, they are - VSCode extensions run in a JavaScript engine (and are usually written with TypeScript), while Visual Studio extensions seem to run on .NET (usually C#). They also

How to handle click event in Visual Studio Code message box?

和自甴很熟 提交于 2019-12-07 18:02:35
问题 According to the API docs, a Message box can take a second argument: an array of strings which act as actions on the message box (which normally just has a single close button/action): https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window showInformationMessage(message: string, ...items: string[]): Thenable<string> So I tried this: vscode.window.showInformationMessage('hello world', ['test','taco','cheeseburger'], function(value){ console.log(value + " was clicked"); }); But this

Is there a way to track an extension's resource usage?

萝らか妹 提交于 2019-12-07 07:37:07
问题 I've noticed through GitHub and Google search that a lot of people have similar issues as mine: vscode hangs and apart from the text editor, nothing works. Sometimes everything but debugging works. As usual, disabling all extensions make it work perfectly. Checking developer tools, I can notice [Extension Host] working like crazy. My question is: is there a way to check each extension's usage of process, disk, etc? Something similar to Google Chrome's Task Manager. 回答1: As of VSCode 1.23

VSCode: How to run a command after each terminal open?

落爺英雄遲暮 提交于 2019-12-07 06:43:09
问题 On Windows I have to run the command start-ssh-agent.cmd on each new terminal session I open. My development environment is VSCode, and I open a dozen new terminals each day. After each terminal open, I have to manually run this command. Is there is a way to run this command on the terminal each time I open one ? This may take the form of a VSCode extension, VSCode configuration (settings) or a Windows environment configuration. Any idea? 回答1: You can do the following: "terminal.integrated

Using VSCode Extensions in Visual Studio

时光毁灭记忆、已成空白 提交于 2019-12-06 11:02:47
Today I found a VSCode extension that I would very much love to use in Visual Studio 2017 (Pro or Enterprise). I'm not at all familiar with VSCode. Are the platforms entirely different, or is there some hope that I could somehow modify the extension and "port it over"? Are the platforms entirely different [...] Yes, they are - VSCode extensions run in a JavaScript engine (and are usually written with TypeScript), while Visual Studio extensions seem to run on .NET (usually C#). They also have different extension APIs: Visual Studio 2017 SDK Visual Studio Code Extension API That doesn't mean

Updating VS Code user settings via an extension

寵の児 提交于 2019-12-06 06:59:52
I'm trying to create a simple extension for toggling the visibility of test files in VS Code. Here's my current approach: const testGlobs = [ '**/__tests__', '**/__mocks__', '**/*.spec.js', ] function hideTests() { const exclude = workspace.getConfiguration('files.exclude', vscode.ConfigurationTarget.Global) testGlobs.forEach(glob => exclude.update(glob, true, vscode.ConfigurationTarget.Global)); console.log(exclude) // does not reflect the updated values } This appears to have no impact. The settings for the file patterns remain false in my user settings file, as they do when logging out the

How to add elements to Outline panel in custom extension?

允我心安 提交于 2019-12-06 06:17:41
I have a VS Code extension for ST language support. Right now it provides only syntax highlights and some snippets. I wanted to create a tree structure of the document showing programs, functions and their parameters in the Outline panel. But I cannot find an example of how to do that. Can you refer me to the right direction but not to LSP as it is too complicated for now I want to make it programmatically. The outline view is populated by a DocumentSymbolProvider (see also: registerDocumentSymbolProvider() ). In the language server protocol, this corresponds to the textDocument/documentSymbol

How to handle click event in Visual Studio Code message box?

自作多情 提交于 2019-12-06 01:06:28
According to the API docs, a Message box can take a second argument: an array of strings which act as actions on the message box (which normally just has a single close button/action): https://code.visualstudio.com/docs/extensionAPI/vscode-api#_window showInformationMessage(message: string, ...items: string[]): Thenable<string> So I tried this: vscode.window.showInformationMessage('hello world', ['test','taco','cheeseburger'], function(value){ console.log(value + " was clicked"); }); But this doesn't seem to work. I get the message box along with a Close button like normal. But then to the

How to access the api for git in visual studio code

混江龙づ霸主 提交于 2019-12-06 01:04:03
问题 I want to use the vscode git api in one my extension to do git clone and other tasks. Is it accessible from the vscode api ? The code is present here.. api 回答1: Twitter to the rescue! I asked there and was pointed to the API definitions here: https://github.com/Microsoft/vscode/blob/master/extensions/git/src/api/git.d.ts ...and an example here: https://github.com/Microsoft/vscode-pull-request-github/blob/master/src/extension.ts#L53 // Import the git.d.ts file import { API as GitAPI,

What regular expression variant is used in Visual Studio code?

对着背影说爱祢 提交于 2019-12-06 00:09:14
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 first line like lexer grammar G1; or just grammar G1; . Is there a way to test if that RE works, because