I installed laravel goto config extension in the remote containers and whenever I click on the link that extension generates and that should jump to another file vscode crashes and restarts
I've created the github issue with the extension creator but author doesn't have any experience with remote extensions. In the github issue I also linked github repository that you can use to reproduce the issue. Note that instead of
./vendor/bin/sail up -d --build
you can use
docker-compose up -d --build
to start the containers
Once containers start you can follow the readme or you can directly open example link below that crashes the vscode
vscode://ctf0.laravel-goto-config/var/www/html/config/app.php?name
File /var/www/html/config/app.php
exists in the docker container
I don't know too much about developing vscode extensions but I managed to find out that extension uses DocumentLink
and registerUriHandler
under the hood to generate the link to the file and to handle incoming links. I even downloaded the extensions and tried to debug the issue, but I only managed to get the debugger and breakpoints working when using vscode directly on the host. Once I connect to remote container debugging doesn't stop on breakpoints anymore and vscode crashes when I use the vscode://...
link
Is it possible to use vscode://...
with remote containers to open the files?
EDIT:
I found one example where opening files trough links work. In the file .devcontainer/devcontainer.json
when I hover on the files in the "dockerComposeFile": [...]
list I can see the link and when I click on it it will open the file. Hovering on the link shows following value
vscode-remote://dev-container+2f55...../<absolute-path-to-file>
but this handles link with vscode and not with registerUriHandler
I managed to pinpoint the issue. In the extension there was a line
vscode.commands.executeCommand('vscode.openFolder', vscode.Uri.file(path))
that was causing vscode to reload even if it's the same folder. This only happened in remote containers
Changing this line to
vscode.commands.executeCommand('vscode.open', vscode.Uri.file(path))
solved the issue.
Command vscode.openFolder
should be changed to vscode.open
I found more info about these commands in the docs