vscode-extensions

VS Code Multiple Language highlighters in one File

拥有回忆 提交于 2019-12-12 15:13:43
问题 First of all, I have just migrated to VS Code for Sublime Text couple of days back. what I want is to Multiple Language highlighters in one Language extension. eg: I want to highlight the proper ending tags of HTML , PHP and Javascript inside .php file. The only method I could find out was in the settings I added this following code: "files.associations": { "*.php":"html, php" } When I tried this the .php file only highlights the HTML syntax. So is there any extension or any other way of

How to get the vscode theme color in vscode extensions?

拥有回忆 提交于 2019-12-12 14:51:05
问题 I want to use some color used in current vscode theme in my extension. How do I get the colors? In other words, I want to match the color of extension using original color with the base vscode windows in run-time of extension. 回答1: You can reference workbench colors: const color = new vscode.ThemeColor('badge.background'); That will give you reference to the color of the current theme's badge. Note, that you cannot reference TM scope items: #32813 https://code.visualstudio.com/docs

How to convert a Uri to a FilePath in a VS Code Language Server?

╄→гoц情女王★ 提交于 2019-12-12 14:25:00
问题 In a VS Code extension you can convert a uri to a filePath like this: import {Uri} from 'vscode'; let uri = 'file:///c%3A/WINDOWS/file.txt'; let path:string = Uri.parse(uri).fsPath; However, in a language server this does not work, beacuse importing vscode fails. The reason for this is the fact that vscode is "not a real node_module" vscode issue #6586 after successfully running, node ./node_modules/vscode/bin/install when the language server is started it still does not find the module:

Language server with semantic highlight in VSCode

不打扰是莪最后的温柔 提交于 2019-12-12 09:38:14
问题 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? 回答1: Semantic coloring is not supported

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

核能气质少年 提交于 2019-12-12 07:54:32
问题 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, 回答1: Actually, I found

How can a Visual Studio Code extension directly add key bindings

旧街凉风 提交于 2019-12-12 04:19:45
问题 Question How can a Visual Studio Code extension add key bindings to a workspace directly? Constraints All settings should be contained within the extension, so that any modifications by the extension are easy to find in 1 place, and uninstalling the extension will remove any modifications. Scenario I'm developing a VSCode extension which will need to listen for keystrokes. This question listens through the vscode.workspace.onDidChangeTextDocument event, but I found that route a little messy

Duplicate TreeView Schema is VS Code Extension

微笑、不失礼 提交于 2019-12-11 17:53:16
问题 I'm writing a VS Code extension that implements a custom viewsContainer. It is activated in an onView: event specified in the package JSON. This all works great, and my view pulls in data from a static JSON file and does add each node to the view. My JSON is strucutured like this: { "name": "root", "children": { "Child1": [ { "id": "childId1", "name": "childName1" }, { "id": "childId2", "name": "childId2" } ], "Child2": [ { "id": "childId1", "name": "childName1" }, { "id": "childId2", "name":

How to programmatically reload Visual Studio Code window?

☆樱花仙子☆ 提交于 2019-12-11 15:37:20
问题 User can achieve this by running 'Reload Window' available via editor's 'Command Palette'. That however from an extension authoring point of view is not as straight forward as prompting the user right away. Desired outcome is to take current implementation in this pull request from [screenshot] to [screenshot] . 回答1: Once you prompt the user to confirm using vscode.window.showInformationMessage(...) to confirm, you can run vscode.commands.executeCommand("workbench.action.reloadWindow") to

Open Workspace during integration testing for vscode extension

佐手、 提交于 2019-12-11 15:31:55
问题 I have a use case where I need to have a workspace open in the host environment for vscode testing. I want to know a function to open a default workspace and another function which I can use with await so that the testing function waits till a workspace is opened. 来源: https://stackoverflow.com/questions/54926105/open-workspace-during-integration-testing-for-vscode-extension

Callback function of vscode.workspace.onDidCloseTextDocument is working at development but not after packaging to vsix

感情迁移 提交于 2019-12-11 14:30:35
问题 In my extension, I'm opening a local file using vscode.workspace.openTextDocument and then vscode.window.showTextDocument and vscode.workspace.onDidCloseTextDocument to close the file. This seems to be working fine if run the extension using the code. Now I have created the vsix file using vsce package. Here comes the tricky thing Both vscode.workspace.onDidOpenTextDocument and vscode.workspace.onDidSaveTextDocument callbacks are called as expected. However vscode.workspace