vscode-extensions

Can a language in Visual Studio Code be extended?

最后都变了- 提交于 2020-01-13 10:10:06
问题 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

Possible to invoke a VSCode extension command from command line?

可紊 提交于 2020-01-13 08:48:11
问题 Is it possible to invoke a VSCode extension command from a terminal? I'm aware of the code command and all the switches under the Extensions Management category. However, I do not understand if it's possible to invoke a command implemented within a VSCode extension from the command line or it is required that a user must invoke it from the editor's context? I cannot seem to find a definitive answer after Googling and searching StackOverflow, so I'm asking as a new question. Any insights? 回答1:

Can you customize code folding?

十年热恋 提交于 2020-01-12 14:34:50
问题 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

Can you customize code folding?

南楼画角 提交于 2020-01-12 14:33:08
问题 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

How to execute local bash code from VSCode extension

孤街浪徒 提交于 2020-01-11 07:33:05
问题 I am creating an extension for simple git commands, and when a user enters a command in the Command Palette, like Init , I want to call git init on their current directory. Unfortunately, there is no documentation on executing code locally with the VSCode extensions API. Is there any way to do this? 回答1: Yes, this is possible, by using child_process.spawn. I have used it in my extension to run a Java jar. The core of the execution is shown here: let spawnOptions = { cwd: options.baseDir ?

Detect light/dark theme programmatically in Visual Studio Code

和自甴很熟 提交于 2020-01-11 04:48:06
问题 I'm developing a Visual Studio Code extension that enables previewing mermaid diagrams: The extension uses a default stylesheet that works fine if using the light theme. However, if the user has switched Visual Studio Code to use the dark theme, the stylesheet has some rules that are not compatible with the default dark stylesheet: Is is possible to detect programmatically the active theme type (e.g. light/dark) so that I could provide a different stylesheet for each case? I would like to use

How to enable “Go to symbol” with a custom language in vscode?

老子叫甜甜 提交于 2020-01-09 10:32:32
问题 I have made a custom language extension and I would like to enable the "Go To Symbol" feature. I have tried to follow the guidelines here, but I'm still kind of lost. I think all I need to do is implement a DocumentSymbolProvider , but I'm not really sure how to go about it. UPDATE The example language server docs point to a repo that is deprecated. It is replaced with this one, which is much more complex. I think the simplest example I can find there is the lsp-sample, but it doesn't use a

How to enable “Go to symbol” with a custom language in vscode?

不羁的心 提交于 2020-01-09 10:29:07
问题 I have made a custom language extension and I would like to enable the "Go To Symbol" feature. I have tried to follow the guidelines here, but I'm still kind of lost. I think all I need to do is implement a DocumentSymbolProvider , but I'm not really sure how to go about it. UPDATE The example language server docs point to a repo that is deprecated. It is replaced with this one, which is much more complex. I think the simplest example I can find there is the lsp-sample, but it doesn't use a

Customize link / URL syntax highlighting color in Visual Studio Code?

时光总嘲笑我的痴心妄想 提交于 2020-01-04 14:30:52
问题 I am creating my own Visual Studio Code theme, and I want the links / URLs to have their own independent color in HTML and CSS. From what I have read it seems that this was once accomplished with detected-link, but should now use linkForeground. I have tried both in the theme.json file I created, but neither seems to work. Does anyone know how to customize link / URL syntax highlighting color in Visual Studio Code .json file? This is what I tried... { "name": "goto-definition-link", "scope":

Overriding existing Visual Studio Code commands in an extension

て烟熏妆下的殇ゞ 提交于 2020-01-03 19:30:33
问题 Is it possible to override an existing VS Code command like e.g. editor.action.clipboardPasteAction ? By override, I mean to register my own command that will automatically be called every time when the original one was supposed to be called. For example, the editor.action.clipboardPasteAction is called when the Ctrl+V is pressed (or some other shortcut, depending on the key bindings), but also when it is invoked explicitly in code of e.g. various extensions by calling commands.executeCommand