How to add "onView" "Settings" Page as ActivationEvent for vscode Extension? - visual-studio-code

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?

Related

github login and sync failure in updated vscode linux version

recently I installed a fresh version of the KDE neon user edition and I updated it and works fine.
I also installed the vscode Debian version and nothing is wrong.
but when I want to login with my GitHub account in vscode for configs sync it opens a firefox tab that I log in to my GitHub and authorizes the vscode and it succeeds and gets back to vscode and instead of signing in and syncing the configs it opens an empty unsaved file named something like this:
did-authenticate\?windowid\=1\&code\=6beea2fcb8a47e0ea49e\&state\=2efc5efd-9c68-4735-a4a0-fd690dd7aec0
in this path : "~/vscode:/vscode.GitHub-authentication"
and after a few seconds canceled notification appears.
I've installed vscode for Debian version 1.63.2 which people in this Github issue had the same problem in version 1.62.2 and they are saying that this problem is fixed for them in version 1.62.3.
I don't have this problem with the Microsoft account sign-in.
what am I missing?
Update:
for testing, I tried to install an extension for vscode and I pasted the URL with vscode protocol in a web browser like this (vscode:extension/GitHub.vscode-pull-request-github), and instead of opening the vscode extensions tab, it goes back to vscode and opens an empty file in the same directory ("~/vscode:/vscode.GitHub-authentication").
so this is vscodes fault that cant handle the vscode: URLs.
I found out what the problem is but I don't know how to fix it
for the record I've updated the vscode today to the 1.64.1 version and still have the problem.
enter image description here
First, you need to get the GitHub Pull Requests and Issues and GitHub extensions together. Then go to the section specified in the photo and give the details of the account and repository you are using. And then it will be fixed.
I ran into this issue myself and discovered that it's because the VS Code command-line application isn't designed to handle URLs, but local file paths. VS Code registers the vscode:// URL scheme with XDG using an appropriate *.desktop file and these URLs should be opened using the command-line program xdg-open. In Firefox, if you have not yet set a default application for vscode:// URLs, then it will ask you for a program to open it with, select /usr/bin/xdg-open. If you have already set it to a different default, you can change it as follows: go to the Menu -> Settings -> General -> Applications -> vscode -> Use other... -> Select /usr/bin/xdg-open as the program for vscode.
With the default for vscode:// URLs set to use xdg-open, then any future integration with VS Code should work naturally to open it as expected.

Install VS Code extension during development?

I am developing an extension for VS Code. This extension is already good enough for me to use during daily work, but not good enough to be published (yet). Is there a canonical way to make an unpublished extension under development available to VS Code? Optimally, I would like to always have the current state of the code running.
I did find a way that seems to work, but I'm not sure whether this is a terrible hack or okay: Create a symbolic link in VS Code's extensions directory (~/.vscode/extensions on Linux) to the development directory. Is there a better/official way?
You can package your extension (even if it's in development) using vsce with the command vsce package. This will create a .vsix file which you can install in your regular instance of VSCode in the marketplace menu (click on the ... icon at the top and select "Install from .vsix file).
If you need to view the logs of the extension, go to Help>Toggle Developer tools and use the console to view your extension's output (if there is any).

Custom keybindings in vscode devcontainer definition

I’m trying to add a couple of key-bindings to my codespace image. But I can’t find where to store the keybindings.json, when I open the file in an active codespace it’s located in /User/keybindings.json, but I can’t find it in bash or when I try to Open Folder that folder. It seems to be a virtual file.
Is there a way to add these to the devcontainer.json? Or a magic place I can send them to from my Docker File?
Based on a number of closed issues, keybindings are considered more a personal preference and are synced from the users' preferences as well as platform dependent.
To supply or override keybindings a custom extension must be created, published to the marketplace and installed through the devcontainer.json.

How to access Visual Studio Code extension settings

Got myself Visual Studio Code. I've installed a Uncrustify extension to make my files be formatted when I edit them. I wanted to make it format my files on save, but I cannot open like Options menu for this extension or something like that. The author gives this screenshot:
But I cannot reach that menu. When I click on this little gear circle near the extension under the Extensions tab, it just pops up a menu with: Disable (Workspace), Disable (Always), Uninstall. I can only edit 4 things, like my .cfg file path under Ctrl+Comma settings, but that's not what I am searching for, and it's not what is on this screen provided by author
I guess I am not only asking about this particular extension, but generally for extension settings in this editor.
Many ways mentioned here in an issue created available on VSCode repository: Allow to change settings from Extensions editor.
On Windows, I could be able to change settings by going to:
File -> Preferences -> Settings -> Extensions.
Dont know if you figured it out yet or not but maybe for someone who comes here to find an answer.
Step 1: Press ctrl+alt+p to open the command pallet.
Step 2: Search and execute this command Uncrustify: Open config file
If your config file has not been created, then before step 2 you must execute Uncrustify: Create default config file command.
Anyways, these instructions are present their in Details section of the extension.

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.