Home Assistant Community Add-on: Visual Studio Code

I have the copy paste issue with Vivaldi (Chromium) browser. Did you try a different browser?

you are correct. it’s a browser issue. i see that it works fine in chrome on mac, but not my usual safari. i would still like to find a fix for safari, but thanks for a workaround for now.

I wasn’t able to make it work on any of my computers. I did everything according to instructions (i.e. provided valid URL and access token) but I do not have get any auto completion. Any ideas how I can debug it?

You can put this in .vscode/tasks.json in the root folder.

{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Check config and restart HA",
            "type": "shell",
            "command": "hassio ha check; if [ $? -eq 0 ]; then echo \"config good, restarting\"; hassio ha restart; fi",
            "problemMatcher": []
        }
    ]
}

Then click on Terminal in top menu bar and click on Run Task, select Check config and restart HA.

:tada: Release v0.6.2

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades Material Design Icons VSCode extension to v1.5.1
  • :arrow_up: Upgrades keesschollaart.vscode-home-assistant to 1.0.2
  • :arrow_up: Upgrades add-on base image to v3.1.4
  • :arrow_up: Upgrades libnginx-mod-http-lua to 1.14.0-0ubuntu1.3
  • :arrow_up: Upgrades nginx to 1.14.0-0ubuntu1.3
  • :arrow_up: Upgrades openssl to 1.1.1-1ubuntu2.1~18.04.4
  • :arrow_up: Upgrades Hassio CLI to 2.3.0

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

@frenck Do you know a way this can be used in the standalone docker HA? What docker was originally used?

It’s based on code-server: https://github.com/cdr/code-server

Thanks, I tried it but the puid in the container is 1000 and my docker folder are owned by root. Cant seem to change it in the container.

:tada: Release v0.6.3

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Updates yamllint to v1.17.0 (#47)
  • :arrow_up: Upgrades lukas-tr.materialdesignicons-intellisense to 1.5.2
  • :arrow_up: Upgrades Hassio CLI to v3.0.0
  • :arrow_up: Upgrades nginx to 1.14.0-0ubuntu1.5

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades Hassio CLI to v3.1.0

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v0.6.5

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades add-on base image to v3.2.0
  • :hammer: Updates HA Auth URL in NGinx LUA sccript
  • :ambulance: Fixes path handling for SSL certificates
  • :arrow_up: Upgrades keesschollaart.vscode-home-assistant to 1.1.1
  • :arrow_up: Upgrades nginx to 1.14.0-0ubuntu1.6
  • :arrow_up: Upgrades libnginx-mod-http-lua to 1.14.0-0ubuntu1.6
  • :hammer: Use Hass.io DNS as NGinx resolver

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Got some issues with the vscode addon, was hoping someone could point me in the right direction…

Synology 1817+ DSM 6.2
Hassio verison 0.98.1
Installed via docker version 18.9.0-0505

Issue is something to do with permissions. I’m guessing this has something to do with the port number 8443. That is the same port as the Unifi Controller… Is there a way to change the port for Vscode to test this?

Config:

{
  "ssl": true,
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "packages": [],
  "init_commands": [],
  "disable_telemetry": false,
  "log_level": "info"
}

Log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 

-----------------------------------------------------------
[00:12:56] ERROR: Unable to authenticate with the API, permission denied
 Hass.io Add-on: 
 
-----------------------------------------------------------
 Add-on version: 
 You are running the latest version of this add-on.
[00:12:56] ERROR: Unable to authenticate with the API, permission denied
[00:12:56] ERROR: Unable to authenticate with the API, permission denied
 System:   ( / )
 Home Assistant version: 
 Supervisor version: 
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
Log level is set to INFO
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] code-server.sh: executing... 
[cont-init.d] code-server.sh: exited 0.
[cont-init.d] nginx.sh: executing... 
[00:13:14] ERROR: Unable to authenticate with the API, permission denied
[cont-init.d] nginx.sh: exited 0.
[cont-init.d] user.sh: executing... 
[cont-init.d] user.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[00:13:14] INFO: Starting the code server...
(node:404) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
INFO  code-server v1.1156-vsc1.33.1
INFO  Additional documentation: http://github.com/cdr/code-server
INFO  Initializing {"data-dir":"/data/vscode","extensions-dir":"/data/vscode/extensions","working-dir":"/config","log-dir":"/root/.cache/code-server/logs/20190902001316408"}
INFO  Starting webserver... {"host":"127.0.0.1","port":"8443"}
WARN  No certificate specified. This could be insecure.
WARN  Documentation on securing your setup: https://github.com/cdr/code-server/blob/0f1bbc31612f7c3bb621cecef8cce927f8a3e9c2/doc/security/ssl.md
WARN   
WARN  Launched without authentication.
INFO   
INFO  Started (click the link below to open):
INFO  http://localhost:8443/
INFO   
INFO  Starting shared process [1/5]...
[00:13:16] INFO: Starting NGinx...
nginx: [emerg] invalid number of arguments in "resolver" directive in /etc/nginx/includes/resolver.conf:1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

Edit: Disabled the Unifi container and attempted to start vscode again… No success.

:tada: Release v0.7.0

Full Changelog

This is a general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades keesschollaart.vscode-home-assistant to 1.2.4
  • :arrow_up: Upgrades add-on base image to v4.0.0
  • :arrow_up: Upgrades redhat.vscode-yaml to 0.5.3

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

:tada: Release v1.0.0

Full Changelog

:tada: 1.0.0 :tada:

Visual Studio Code for Home Assistant as a Hass.io add-on reached 1.0!

This version has a bunch of upgrades, mainly the code-server team has been working hard on making some major changes. The add-on now runs the second generation code-server, which is based on VSCode 1.39. Latest greatest!

Furthermore, Kees updated the VSCode extension for Home Assistant, yamllint had an upgrade, the latest Material design icons extension was added and…

:sparkles: The add-on now has the Indent Rainbow extension installed by default :tada:

This extension allows you to easily see how much your YAML is indented compared to the rest of the configuration. Thanks for suggesting this!

:hammer: Changes

  • :arrow_up: Updates yamllint to v1.18.0 (#53)
  • :arrow_up: Upgrades code-server to 2.1650-vsc1.39.2
  • :arrow_up: Upgrades keesschollaart.vscode-home-assistant to 1.3.0
  • :arrow_up: Upgrades lukas-tr.materialdesignicons-intellisense to 1.5.5
  • :sparkles: Adds Indent Rainbow extension by default
  • :ambulance: Match VSCode default config with latest code-server
  • :hammer: Modify code-server service with updated CLI arguments
  • :tada: Mark add-on as stable

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

2 Likes

:tada: Release v1.0.1

Full Changelog

This is general maintenance release.

:hammer: Changes

  • :arrow_up: Upgrades code-server to 2.1665-vsc1.39.2

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

Is there a way to specify our own extensions or sideload a vsix file from the config? I see the vscde.extensions file that has some of the defaults included by docker, but it would nice to have an alternate way to specify user selected extensions to install as well.

Is anyone experiencing high CPU usage with this add-on? I’m using an Intel i5 NUC with 16GB RAM and an M.2 SSD. With the add-on halted, the load average is around 0.1 to 0.5 so it’s basically idling. When I start the add-on, load average goes over 5 and I can hear the fan running at full speed.
My system is running Ubuntu server 18.04 with docker.

:tada: Release v1.1.0

Full Changelog

Now we are stable, the real fun starts! This version brings tons of new stuff, to improve the straight out of the box experience!

So what is new?

  • ESPHome support! Yes! :tada: The ESPHome project has released their VSCode extension, and is has been added and pre-configured for you! Please be sure to read the additional instructions in the add-on manual.

  • vscode-icons have been added. This gives all the files in the file tree a nice little icon that matches the file type. And yes: Home Assistant related files will have a tiny blue house :wink:

  • Support for syntax highlighting on log files! :sunglasses: This makes it darn easy on the eyes to read the Home Assistant log file.

  • Added the ErrorLens extension, that puts warnings and error right into VSCode, making it easy to spot issues and seeing the “WHY?!” in a blink of an eye. :100:

  • Somehow, the ping command was missing 🤷‍♂ So that is now available in the terminal within vscode.

:hammer: Changes

  • :sparkles: Adds ping commandline util
  • :arrow_up: Upgrades lukas-tr.materialdesignicons-intellisense to 1.5.6
  • :sparkles: Adds vscode icons pack
  • :sparkles: Adds support for syntax highlighting on Home Assistant log files
  • :sparkles: Adds the ErrorLens extension
  • :sparkles: Adds support for ESPHome

Questions? Join our Discord server! https://discord.me/hassioaddons
Enjoying my add-ons? Consider supporting my work: https://patreon.com/frenck

3 Likes

ooooo my god @frenck 10 out 10

this is looking so sexy

So with the new update do we need to save after changing config files. As the save button has moved. Good work on the update some much easier now :grinning::sun_with_face::nerd_face: