Tag Archives: Programming

Opening Files in VS Code Using vscode:// Links (Local, WSL, and Docker)

Visual Studio Code supports special vscode:// deep links that let you open specific files directly from a web page, email, document, or even another app.

This is especially handy if you work with Remote – Containers, WSL, or other remote development setups, because you can create links that jump straight to files inside those environments.


1. The Basic Local Format

For files on your local machine, the format is simple:

vscode://file/<absolute-path>

Example:

vscode://file/C:/Projects/app/index.js

Or on macOS/Linux:

vscode://file//home/dan/projects/app/index.js

Note: The double slash after file: is needed for Unix-style paths.


2. Linking to Files in WSL

When using Windows Subsystem for Linux, the remote-kind is wsl:

vscode://vscode-remote/wsl+<distro-name>/<absolute-path>

Example:

vscode://vscode-remote/wsl+Ubuntu-22.04/home/dan/project/app.js

How to find your distro name:

wsl -l -q

3. Linking to Files in a Remote Docker Container

When connected to a dev container, the remote-kind is dev-container (or attached-container if you attached to an existing one).

Format:

vscode://vscode-remote/dev-container+<identifier>/<absolute-path>

Example:

vscode://vscode-remote/dev-container+myproject//workspace/app/src/index.js

Notes:

  • <identifier> is usually the folder name from .devcontainer/devcontainer.json or the container name.
  • Use // before the workspace path to preserve the leading / from inside the container.
  • To find the exact identifier, open the Command Palette inside VS Code and run: Remote-Containers: Show Log Look for the string after dev-container+.

4. Special Case – Docker Inside WSL

If you’re running Docker inside WSL and open VS Code in a container from there, the format becomes nested:

vscode://vscode-remote/dev-container+<container-identifier>/home/dan/project/app.js

But the <container-identifier> may itself reference WSL internally — in practice, VS Code handles this automatically as long as you copy the URI from the Command Palette (Copy Path as vscode:// URI).


Summary Table

EnvironmentURI Format
Localvscode://file/<absolute-path>
WSLvscode://vscode-remote/wsl+<distro>/<absolute-path>
Dev Containervscode://vscode-remote/dev-container+<identifier>/<absolute-path>
Attached Containervscode://vscode-remote/attached-container+<identifier>/<absolute-path>

With these formats, you can make clickable links in documentation, tickets, or web apps that take you straight to the right file in VS Code — whether it’s local, in WSL, or inside a Docker container.

Laravel Telescope

Today I tried out Laravel Telescope. From the official Laravel Telescope page, it is designed to:

Telescope provides insight into the requests coming into your application, exceptions, log entries, database queries, queued jobs, mail, notifications, cache operations, scheduled tasks, variable dumps, and more.

https://laravel.com/docs/9.x/telescope

Installation

I was adding Telescope to in-progress app that I was developing in VSCode on Github.

These are the commands I followed to add to this existing project:

Firstly, I brought my local development Docker environment up, using Laravel Sail:

./vendor/bin/sail up -d

I followed the Local Only Installation instructions, so I added the Telescope dependency, for the dev environment, using Composer within Sail:

./vendor/bin/sail composer require laravel/telescope --dev

After installing Telescope, I published its assets using the telescope:install Artisan command. After installing Telescope, I also run the migrate command in order to create the tables needed to store Telescope’s data:

./vendor/bin/sail artisan telescope:install
./vendor/bin/sail artisan migrate

After running telescope:install, you need to remove the TelescopeServiceProvider service provider registration from your application’s config/app.php configuration file. Instead, manually register Telescope’s service providers in the register method of your App\Providers\AppServiceProvider class. We will ensure the current environment is local before registering the providers:

public function register()
    {
        //
        if ($this->app->environment('local')) {
            $this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
            $this->app->register(TelescopeServiceProvider::class);
        }
    }

Finally, you need to also prevent the Telescope package from being auto-discovered by adding the following to your composer.json file:

"extra": {
    "laravel": {
        "dont-discover": [
            "laravel/telescope"
        ]
    }
},

Configuration

After publishing Telescope’s assets, its primary configuration file will be located at config/telescope.php. This configuration file allows you to configure your watcher options. Each configuration option includes a description of its purpose, so be sure to thoroughly explore this file – all very well documented.

Accessing the Telescope UI

The Telescope dashboard may be accessed at the /telescope route. By default, you will only be able to access this dashboard in the local environment.

http://localhost/telescope

I’ve not had chance to fully explore Telescope yet, but at least the installation was very straight forward. I’m hoping it will be a very useful framework-level debug tool.

Laravel Telescope UI

My VSCode Extensions

me@machine:~$ code --list-extensions

alefragnani.project-manager
austin.code-gnu-global
cschlosser.doxdocgen
dbaeumer.vscode-eslint
felixfbecker.php-debug
felixfbecker.php-intellisense
felixfbecker.php-pack
formulahendry.vscode-mysql
kokororin.vscode-phpfmt
mechatroner.rainbow-csv
mrmlnc.vscode-apache
ms-azuretools.vscode-docker
ms-vscode-remote.remote-containers
ms-vscode-remote.remote-ssh
ms-vscode-remote.remote-ssh-edit
ms-vscode-remote.remote-wsl
ms-vscode-remote.vscode-remote-extensionpack
ms-vscode.cpptools
PKief.material-icon-theme
Shan.code-settings-sync
whatwedo.twig

Use Sync Settings (Shan.code-settings-sync) if you move between machines!

https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync

Git / GitHub Must-Dos

Setting your no-reply commit email address on GitHub

https://help.github.com/articles/setting-your-commit-email-address-on-github/

git config --global user.email "username@users.noreply.github.com"

Caching your GitHub password in Git

https://help.github.com/articles/caching-your-github-password-in-git/

git config --global credential.helper 'cache --timeout 9000'

 

Programming the ESP8266

To program my ESP8266 modules (ESP-07 mainly) I use:

And this schematic:

esp_to_serial

I don’t personally use DTR and RTS connections, as I usually have a flash and reset buttons on the board I’m working from.

The importance of the pins to get the bootloader into the correct mode is critical:

PIN Resistor Serial Adapter
VCC VCC (3.3V)
GND GND
TX or GPIO2* RX
RX TX
GPIO0 PullUp DTR
Reset* PullUp RTS
GPIO15* PullDown
CH_PD PullUp

Full details here: https://esp8266.github.io/Arduino/versions/2.1.0-rc1/doc/boards.html