Is there a way to track an extension's resource usage? - visual-studio-code

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 Explorer command:

Related

How to add "onView" "Settings" Page as ActivationEvent for vscode Extension?

The title is the TL;DR, but I'll start off with intent, I'm working on a vscode extension that have configuration/settings that will have an initial auto-detection (on activation) and populated during runtime, eg. selectable version of application installed on the computer (such as LLVM that could have 13 and/or 14). The closest is something like the built-in git extension's executable path detection.
So basically this runtime detection means I cannot use the configuration contribution points as everything in package.json is hardcoded...
Back to activation, the extension can be activated on any few commands indicated in the activationEvents, but the main thing is the detection must be done prior to users opening the Preferences: Open Settings (UI), I've looked through the vscode repo and found onCommand:workbench.action.openSettings2 to be closest to what I need, however I found a niche scenario where if the user have "Settings" page opened prior to installing the extension and relaunching vscode will jump straight to the Settings page, this will not activate the extension.
I checked the built-in git extension and found that they have been using "*" which is not recommended, so I'm using onStartupFinished as a workaround for now.
I found onView may be what I am looking for, but how do I know what is the editor/webview name for "Settings" page - onView:xxx.openSettings?

Opening the Command Prompt in VSCode

How can I open the command prompt in vs code? But as a window separate from vs code?
I tried shortcuts and other questions on StackOverflow but they all are on vs code and not opening it on a separate window.
You cannot do exactly what you are asking for. However, it sounds like you might be interested in installing Microsoft Terminal, available for free in the Microsoft Store. I use Microsoft Terminal Preview, it works extremely well.

Chrome OS vscode:// and other links not opening, gives "Google Chrome OS can't open this page"

So I've already solved this problem, but it was so frustrating I wanted to make sure there was a post about it for people in the future.
The issue comes from Chrome OS's browser, because it does not support links that open apps in linux, such as vscode://. On linux systems, such as the ubuntu container used to install linux apps on Chrome OS, opening links is handled by xdg-open, which starts the browser/associated programs.
On Chrome OS however, this doesn't happen. Because it is not linux, and does not rely on the linux filesystem, the normal system for registering alternate URL protocol handlers does not function. This means that vscode:// and other such links don't work.
Solution
This is more of a workaround than a permanent solution, but will work:
xdg-open <url>
Usage
It may not be immediately clear on exactly how to use xdg-open with your links, or even how to get links. I found this problem when logging into VSCode live share using microsoft. What you have to do is quite simple:
Inspect the page
Go to Network or equivalent
Click Continue
Right click the new request sent
Copy address
Open up terminal
Write xdg open
Paste your link, making sure to put "" quotation marks around it, because they often contain the & character, which is significant in bash.
Enjoy
Explanation
It was a problem not well documented, because few people try to run VSCode on Chrome OS. The root of the problem, as I said, comes from the browser not being linked to anything else.
The heart of protocol handlers rests in this directory:
~
❯ ls ~/.local/share/applications/
mimeinfo.cache vsls-launcher.desktop
vsls-launcher.desktop contains the data necessary for xdg-open to launch vscode with vscode:// links.
My first hints came from this reddit thread, u/kgjv's comment in particular: https://www.reddit.com/r/Crostini/comments/chizyk/crostini_how_to_make_linux_apps_open_links_in/
It says how xdg-open will launch chrome from linux, so I did a little more digging and found ~/.local/share/applications/ to contain the configuration.
Any apps that support this will have their own .desktops, so you need only copy the link and launch it with xdg open
I tried the method with simplenote on Lenovo Duet, but it did not work, it just kept on saying no URL handler. It might have been due to it being only available as an app image for arm64 architecture.
Anyways I solved it by installing another browser on Linux, Example:
sudo apt install firefox-esr
Browsers installed by this method are then made the default browser for links opened from linux, and also easily picks up the url-schemes since it also runs from the same partition.
Note: This is just a workaround as installing another browser kinda goes against the entire chome-os ideals but it always comes in handy while dealing with Linux apps.

How can I enable file path autocompletion in the IPython console in PyCharm?

Note: The suboptimal autocompletion (not necessarily of file paths only, but autocompletion in general) is a known issue, and there seems to be no generic quality solution yet. Please see the researched links below.
Path autocompletion in the IPython console in PyCharm does not work well:
c:/U<TAB>
should autocomplete to:
cd c:/Users/
on my machine; instead, the best it manages is:
cd c:/UserWarning
which is plain wrong. IPython in the Anaconda prompt, however, behaves as it should.
My strong assumption (supported by a link, below) is that this is due to PyCharm not using the standard IPython configuration files.
I'm aware of the console starting script in PyCharm:
Settings->Build, Execution, Deployment->Console->Python console
and I've successfully used it to activate a simple magic command I've written.
So here my question: is there a code configuration snippet that could be inserted there, and that could just enable file path autocompletion? Or a pointer to a general description on how IPython configuration files "work", that would enable me to figure it out myself? That is, I imagine, the most doable hack that would solve the problem for the time being.
Alternatively, any experiences with writing your own autocompletion using the following libraries:
IPython.core.completer
IPython.core.completerlib
?
Is that doable? How much work can that be?
Thanks in advance!
My SW-Setup:
I use:
PyCharm Community Edition 2017.2.1
Anaconda 2 (Python 2.7), version 4.3.22 which contains
IPython 5.1.0
on Windows 7 Professional N
Links supporting claims in the question(s) above - just two, due to lack of StackOverflow-"reputation" :(
1) Autocompletion in IPython console in PyCharm not working as it should
JetBrains (creators of PyCharm) knows about this since, at least, two years (please Google it under "PyCharm Console tab completion" or similar, I'm allowed to add just a limited number of links here), and seems to have started working on it, but never finished it.
The discussion states " this is only the initial step to getting full IPython tab completions": https://youtrack.jetbrains.com/issue/PY-9345, but the issue is closed since October 2016.
On StackOverflow there are three questions with similar wording, but not one substantial answer (no, using Ctrl+Space instead of Tab does not solve anything). Again, I can't add more links here.
_2) PyCharm not using ipython_config.py to configure IPython Console:_
https://intellij-support.jetbrains.com/hc/en-us/community/posts/206603035-Which-ipython-config-py-is-used-to-configure-IPython-for-Python-Console-
See the comment by JetBrains at the end of the page.

Is there a way to get the Code Mirror editor in Google Chrome developer tools to use a specific keymap?

Google Chrome now supports using the CodeMirror editor instead of its old editor in developer tools. You can turn it on by going to developer tools settings and checking “use code mirror editor”.
While this is very cool, I would like to use it with a certain keymap, specifically the vim one, which Code Mirror supports. I am wondering whether there is a way to hack it to load vim.js into the developer tools context. I have tried looking in the folder where Chrome is installed on my machine, but I could not find where it does its thing.
Apparently, Chrome loads the CodeMirror stuff from chrome-devtools://devtools/CodeMirrorTextEditor.js, which seems to come from the resources.pak file in the Chrome install directory, but making changes to that file does not seem to have an effect. Maybe I am not refreshing things property, or maybe you’re not supposed to edit the pak file directly.