visual-studio-code

vscode api for file explorer

自作多情 提交于 2021-02-05 05:57:05
问题 I am onto writing a VSCode extension and need to create files / remove files based in a folder / subfolder selected by the user. Is there a way to find selected folder from the explorer tree through visual studio code api? One can track the opened file through active text editor or onDidOpenTextDocument() . I am interested in finding if user has selected a folder and if so the path to selected folder. For example: workspace.rootPath provides a root of the opened project. Similarly, how do I

Task output encoding in VSCode

好久不见. 提交于 2021-02-04 21:01:33
问题 I'm learning BeautifullSoup with Visual Studio Code and when I run this script: import requests from bs4 import BeautifulSoup from fake_useragent import UserAgent ua = UserAgent() header = {'user-agent':ua.chrome} google_page = requests.get('https://www.google.com',headers=header) soup = BeautifulSoup(google_page.content,'lxml') # html.parser print(soup.prettify()) And I'm getting the following error: Traceback (most recent call last): File "c:\ ... \intro-to-soup-2.py", line 13, in print

Task output encoding in VSCode

£可爱£侵袭症+ 提交于 2021-02-04 21:01:32
问题 I'm learning BeautifullSoup with Visual Studio Code and when I run this script: import requests from bs4 import BeautifulSoup from fake_useragent import UserAgent ua = UserAgent() header = {'user-agent':ua.chrome} google_page = requests.get('https://www.google.com',headers=header) soup = BeautifulSoup(google_page.content,'lxml') # html.parser print(soup.prettify()) And I'm getting the following error: Traceback (most recent call last): File "c:\ ... \intro-to-soup-2.py", line 13, in print

VSCode - wrap selected text in “<mark></mark>”

╄→гoц情女王★ 提交于 2021-02-04 19:39:06
问题 I'm using the markdown previewer in VSCode and would like the ability to highlight some text in an ".md" file and wrap it in a " <mark></mark> " tag so that it displays highlighted when you view the markdown file in its rendered format. Is there a quick and easy way to do this? 回答1: A snippet should do the trick. "wrap_mark": { "prefix": "wrap_mark", "body": [ "<mark>$TM_SELECTED_TEXT</mark>" ], "description": "Wrap selected with <mark>" }, Add that to your snippets/markdown.json file. Then,

VSCode - wrap selected text in “<mark></mark>”

大城市里の小女人 提交于 2021-02-04 19:37:22
问题 I'm using the markdown previewer in VSCode and would like the ability to highlight some text in an ".md" file and wrap it in a " <mark></mark> " tag so that it displays highlighted when you view the markdown file in its rendered format. Is there a quick and easy way to do this? 回答1: A snippet should do the trick. "wrap_mark": { "prefix": "wrap_mark", "body": [ "<mark>$TM_SELECTED_TEXT</mark>" ], "description": "Wrap selected with <mark>" }, Add that to your snippets/markdown.json file. Then,

How to enable Node.js code autocompletion in VSCode?

守給你的承諾、 提交于 2021-02-04 18:14:26
问题 I have installed Visual Studio Code and Node.js and both basically work, but autocomplete is not (completely) working. If I type 'console.' I do indeed see a list popup. Likewise if I do: const http = require("http"); http. But if I simply type 'process.' I don't see anything. In fact as soon as I type '.' Code autocompletes 'process' to 'ProcessingInstruction'. I was expecting to see argv pop up, along with all the other stuff you see if you type 'process' at a Node prompt. Here's what I see

When creating a VSCode snippet, how can I transform a variable to title-case (like TitleCase)?

江枫思渺然 提交于 2021-02-04 17:49:07
问题 https://code.visualstudio.com/docs/editor/userdefinedsnippets#_placeholdertransform My aim is to automatically set the class name within the context of the snippet being inserted. VSCode does not natively support class or method names, but it does support the file name. My file names closely mimic the class name: foo-bar.ts for class FooBar . Here is my current code snippet wherein I can transform "foo-bar" to "Foo-bar" using the native "capitalize" grammar provided by VSCode. TM_FILENAME

What is the pwa-node type launch configuration on VSCode?

情到浓时终转凉″ 提交于 2021-02-04 17:02:10
问题 I noticed that the default launch configuration generated by VSCode for npm debugging (Launch via NPM) sets the configuration type as "pwa-node" by default. Adding "Launch via NPM" configuration: Generated configuration type: I've searched a bit but didn't find the meaning of this (maybe something related to Progressive Web Apps?). Does anyone know the meaning of "pwa-node" and why "pwa-node" and not "node"? 回答1: The pwa- prefix is/was a way to target VS Code's new JavaScript debugger, which

How to do Coverage exports for vscode extensions

大兔子大兔子 提交于 2021-02-04 15:26:37
问题 I have seen a lot of tutorials how to make vscode extensions. Like: https://code.visualstudio.com/docs/extensions/testing-extensions And there is many tutorials how to do coverage exports, there many ways how to do it, but I didn't seen good examples which would follow the examples from their docs and work with vscode extensions (they need the extensionHost instead of nodejs). I have all the tests written in the mocha which is bundled in the vscode as proposed by their documents. I tried to

How to do Coverage exports for vscode extensions

廉价感情. 提交于 2021-02-04 15:26:06
问题 I have seen a lot of tutorials how to make vscode extensions. Like: https://code.visualstudio.com/docs/extensions/testing-extensions And there is many tutorials how to do coverage exports, there many ways how to do it, but I didn't seen good examples which would follow the examples from their docs and work with vscode extensions (they need the extensionHost instead of nodejs). I have all the tests written in the mocha which is bundled in the vscode as proposed by their documents. I tried to