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

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.

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.

Is there a way to track an extension's resource usage?

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:

Jupyter webpages not displaying properly

Screen shot here.
With Cntrl-Shift-I
No matter how I install Jupyter(aka IPython) I get a dud webpage. It does not display tabs or menus as expected.
The screen shot above is from a 64bit Windows Anaconda install. It was a default install. Install finished. No changes to configuration. First action after install was select IPython menu item in start menu.
Now, trust me, I have tried everything. I have tried installing IPython from pip over top my python2.7 installation, anaconda etc. No matter how I install it ends up with the same problem. I even tried 32bit installs etc.
It doesn't appear to be the browser as both IE and Chrome see the same mangled display.
It is almost like the css files are not being picked up or are not there at all.
I opted to allow the installation of the Anaconda to update my environment variables etc. so the dang blasted thing should be finding where it has put itself.
What is the likely cause? What is the fix please?
I did have a very similar issue on Windows recently. Some program has overwritten your mime type associations. For me it was Inkscape killing SVG by setting the mime type to application/svg.
Try this on terminal:
import mimetypes
mimetypes.guess('file.css')
You should get text/css. If you get application/css this is most likely your problem. My solution: Change back the mime type association. Start regedit and search for application/css in HKEY_CLASSES_ROOT. Replace it with text/css.
Please refer to this https://github.com/ipython/ipython/issues/7024 for further reference.

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.

using cygwin sshd and xwin to launch window application from remote client

Could be a flaming thread but hope you dont mind a question from a curious Joe here.
I have Desktop computer running downstairs running with winxp pro,cygwin,sshd,xwin.
Whilst that, I am working upstair with my laptop and my wife will be using the desktop downstair(watching movie,etc,etc). My laptop upstairs is already loaded with Mobaxterm (which actually translate to cygwin as well).
I have already configure my desktop properly with user and ssh and xwin. When I use my laptop to ssh into desktop downstairs, starting the xclock, all works fine. I can see the xclock on my laptop.
Here is my question:
Is it possible now to run firefox(C:\Program Files\Mozilla\Firefox.exe) on my desktop via ssh and getting the display to laptop, so I could control the desktop downloading from upstairs.
After I ssh to my desktop downstair and when I try
cd \cygdrive\c\Program/ Files\Mozilla
./Firefox
Nothing came through display on my laptop.
Any advice. I know vnc could work but meaning to say it would interupt my wife work periodically where she is using on the desktop downstair. And, I have already intended to buy another nettop to do this.
Is there any solutions to this for the time being?
Thanks.
This won't work the way you are describing it. You are using SSH + Xwindows to remotely display unix programs like xclock, not native Windows apps like firefox. You need to see if you can get Firefox compiled for cygwin on X. I have no idea if it is even possible, you may want to search with keywords "firefox xwindows cygwin".
You may be able to do something with Remote Desktop, I'm not sure if it would interrupt your wife's work though. There's a write-up with using it over ssh here.