vscode-extensions

VSCode - Event that fires when a non-text file has been opened / selected

戏子无情 提交于 2019-12-05 20:29:43
In VSCode there is an event when the active text editor has been changed: onDidChangeActiveTextEditor , it doesn't fire when a file that isn't a text file is opened (for example an image). I searched the VSCode API, and googled it, but didn't find anything. Although the onDidChangeActiveTextEditor event does fire when a text file is selected and then you select an image file, it doesn't fire when you have an image file selected and you select another image file. So my question is is there an event that will fire when any file is selected in the explorer, or am I overlooking something with

Can a language in Visual Studio Code be extended?

回眸只為那壹抹淺笑 提交于 2019-12-05 11:25:25
Scenario I have JSON files that describe a series of tasks to be carried out, where each task can refer to other tasks and objects in the JSON file. { "tasks": [ { "id": "first", "action": "doSomething()", "result": {} }, { "id": "second", "action": "doSomething(${id:first.result})", "result": {} }, ] } I'd like to have both JSON schema validation and custom language text effects like keyword coloring and even "Go to definition" support within strings in the JSON. What I can do I can create an extension that specifies a JSON schema for a file extension "*.foo.json". This gives schema

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

依然范特西╮ 提交于 2019-12-05 11:05:40
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. As of VSCode 1.23 (April 2018), there is now a Process Explorer built-in . It can be opened with the Developer: Open Process

Where are the VSCode error logs for extensions?

有些话、适合烂在心里 提交于 2019-12-05 09:11:04
问题 When I get an extension error I have no way of knowing why the error happens. 回答1: From what I know there are no dedicated logs for extensions. When you are debugging your extension you can write notes to the console. However, when you have problems with an installed extension this won't help. But keep in mind vscode is kinda "web browser", so it has the usual browser developer tools (see Help -> Developer Tools), which will show you runtime errors (and all the other stuff those tools allow

How to customize comment block characters in visual studio code?

心不动则不痛 提交于 2019-12-05 05:02:08
I created a language extension for visual studio code and I would like to change the comment block characters but I couldn't find a way to do so.. Has anyone already done or know how to do it? OK, I finally figured out what was the problem. There are two ways you can change the comment blocks: 1 - CONFIG FILE I dont know why it's not in the docs (or at least I couldn't find it) but there is a optional property you pass to the object inside the contributes.languages array in the package.json named configuration . The description found on the vs code source code: A relative path to a file

Language server with semantic highlight in VSCode

做~自己de王妃 提交于 2019-12-05 04:43:05
I'd like to write a language server to VSCode with semantic highlight support. The language I'm using has very complex rules, so I'd like not to rely on a tokenizer to distinguish between identifiers and keywords. I already have a language service in VS Community , where I've written my own Classifier. It's possible to write own classifier in VSCode , or the only way to colorize a document is add TextMate language specification file to a VScode package? Semantic coloring is not supported by the LSP as of VS Code 1.29. There are two main issues currently tracking this feature: LSP issue VS Code

Dynamic snippet evaluation in VSCode

∥☆過路亽.° 提交于 2019-12-05 02:52:44
Is it possible for a snippet to insert a dynamically computed completion or snippet in Visual Studio Code? I would like a snippet for inserting date and time strings of various formats. For example if you type date , the current date in ISO format would automatically be expanded. There is a facility in Sublime Text to do this in the python API via the on_query_completions method in the EventListener class. There the implementation would be very simple: def on_query_completions(self, view, prefix, locations): if prefix == 'date': val = datetime.now().strftime('%Y-%m-%d') return [(prefix, prefix

How to access the api for git in visual studio code

喜你入骨 提交于 2019-12-04 06:44:56
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 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 const gitExtension = vscode.extensions.getExtension<GitExtension>('vscode.git').exports; const api = gitExtension.getAPI(1); const rootPath = vscode.workspace.rootPath;

Can you customize code folding?

故事扮演 提交于 2019-12-04 02:50:49
Is it possible to customize the way code folding works in Visual Studio Code? I use a common pattern of defining regions of code across a variety of different document types. So, for XML I wrap sections of text with <!-- #region --> and <!-- #endregion --> For c#, I use #region to #endregion , For TypeScript/Javascript, I use /* #region */ and /* #endregion */ . In full Visual Studio (not VS Code), I have a custom extension which snoops for the pattern across document types, and creates folds based on that, allowing me to create neat, custom document outlines. I'd like to use the same pattern

Is it possible to call command between extensions in VSCode?

跟風遠走 提交于 2019-12-04 01:24:53
for example there are two VSCode extension. - extension1 is regist command 'exCommand1'. - extension2 is regist command 'exCommand2'. VSCode extension can call command. (ref: https://code.visualstudio.com/docs/extensionAPI/vscode-api ) executeCommand<T>(command: string, ...rest: any[]): Thenable<T | undefined> If API Doc is correct then.. extension1 can call extension2's 'exCommand2'. and extension2 can call extension1's 'exCommand1'. is it possible? VSCode's extension is Lazy Loading... If inter extension's command call is possible then How can loading extension to another extension? Mesh I