<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Vs-Code on blog.iankulin.com</title><link>https://blog.iankulin.com/tags/vs-code/</link><description>Recent content in Vs-Code on blog.iankulin.com</description><generator>Hugo</generator><language>en-AU</language><lastBuildDate>Sat, 10 Jan 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://blog.iankulin.com/tags/vs-code/index.xml" rel="self" type="application/rss+xml"/><item><title>VS Code Dev Containers</title><link>https://blog.iankulin.com/vs-code-dev-containers/</link><pubDate>Sat, 10 Jan 2026 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/vs-code-dev-containers/</guid><description>&lt;h3 id="remote-ssh"&gt;Remote-SSH&lt;/h3&gt;
&lt;p&gt;One of the things I&amp;rsquo;ve done a bit in Visual Studio Code is using it&amp;rsquo;s ability to work on a different machine over SSH. I have a couple of LXCs on a server set up for different languages - one for C++ and another for Rust. They are things I don&amp;rsquo;t work in often, and I didn&amp;rsquo;t want to set them up on my laptop, but thought I might want them again sometime in the future.&lt;/p&gt;
&lt;p&gt;This is straightforward in VS Code - You install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh"&gt;remote ssh extension&lt;/a&gt; locally, then choose &lt;code&gt;Remote-SSH: Connect to Host&lt;/code&gt; in the command palette. A few seconds later, it appears that you&amp;rsquo;re working locally, but actually you are working in a remote session on the server your VS Code instance is SSH&amp;rsquo;d into (a small indicator in the bottom left is the tell). You need to clone your project from git since you&amp;rsquo;re working in the server&amp;rsquo;s file system, and there&amp;rsquo;s some complexity with extensions since you&amp;rsquo;re sort of working in a new VS Code instance, but apart from that it feels the same as working locally.&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/architecture-ssh.png" width="968" alt="Remote SSH VS Code architecture from https://code.visualstudio.com/docs/remote/ssh"&gt;
&lt;p&gt;The official docs for &lt;a href="https://code.visualstudio.com/docs/remote/ssh"&gt;Remote Development using SSH are here.&lt;/a&gt;&lt;/p&gt;
&lt;h3 id="why-now"&gt;Why now?&lt;/h3&gt;
&lt;p&gt;The reason I&amp;rsquo;ve been interested in this again lately is to provide a more secure environment for using AI agentic coding tools like Claude Code. If it&amp;rsquo;s running in it&amp;rsquo;s own server (that I can easily recreate from a snapshot) I don&amp;rsquo;t have to worry about dramas like having &lt;a href="https://www.theregister.com/2025/12/01/google_antigravity_wipes_d_drive/"&gt;my hard drive deleted&lt;/a&gt; by Gemini.&lt;/p&gt;
&lt;p&gt;But what if you don&amp;rsquo;t have the ability to spin up an environment on your homelab? There&amp;rsquo;s a few options, but probably the easiest for VS Code users is to work in a &amp;lsquo;Dev Container&amp;rsquo;.&lt;/p&gt;
&lt;h3 id="dev-containers"&gt;Dev Containers&lt;/h3&gt;
&lt;p&gt;Working in a Dev Container is basically the same as remoting into another server with VS Code, but in this case the other server is a container spun up in Docker.&lt;/p&gt;
&lt;img src="https://blog.iankulin.com/images/architecture-containers.png" width="968" alt="VS Code Dev Container architecture. From https://code.visualstudio.com/docs/devcontainers/containers"&gt;
&lt;p&gt;There&amp;rsquo;s a couple of important differences from working on a remote server:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;we&amp;rsquo;re working on our local files;&lt;/li&gt;
&lt;li&gt;Dev containers are an important system for sharing repeatable development environments, so it&amp;rsquo;s well integrated into VS Code - the tooling is nice.&lt;/li&gt;
&lt;li&gt;You need Docker/Docker desktop running locally.&lt;/li&gt;
&lt;li&gt;You need a container image to work with, and a &lt;code&gt;devcontainer.json&lt;/code&gt; file to tell VS Code how to manage all this.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The rest of this post will focus on the basics of working in a Dev Container. There is also a good explanation of all this in the &lt;a href="https://code.visualstudio.com/docs/devcontainers/tutorial"&gt;VS Code docs&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id="the-container"&gt;The Container&lt;/h2&gt;
&lt;p&gt;After you&amp;rsquo;ve installed the VS Code &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers"&gt;extension&lt;/a&gt;, and set up your local Docker environment, you&amp;rsquo;re going to need a Docker container to work in. There&amp;rsquo;s a &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers"&gt;big list of existing containers&lt;/a&gt; that cover most scenarios, but I prefer to roll my own. This is achieved by writing a Dockerfile.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;FROM node:24-bookworm

# Use non-root user for development
USER node

# Development environment
ENV NODE_ENV=development

# Default command
CMD [&amp;#34;npm&amp;#34;, &amp;#34;start&amp;#34;]
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I&amp;rsquo;m going to name this &lt;code&gt;Dockerfile.dev&lt;/code&gt; and put it in the &lt;code&gt;.devcontainer&lt;/code&gt; directory - later we&amp;rsquo;ll point to it from our &lt;code&gt;devcontainer.json&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-09-at-16.57.06.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The Dockerfile describes the system that we&amp;rsquo;ll be working in when we&amp;rsquo;re working on our project - it&amp;rsquo;s like the specification of our remote &amp;lsquo;server&amp;rsquo;. Sometimes you might want to install other stuff here - for example if you are a vim enthusiast, you might &lt;code&gt;apt install vim&lt;/code&gt; in the Dockerfile, but generally you should keep it reasonably generic.&lt;/p&gt;
&lt;h3 id="devcontainerjson"&gt;devcontainer.json&lt;/h3&gt;
&lt;p&gt;Next we need to tell VS Code how to work in the container we&amp;rsquo;ve specified.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
 &amp;#34;name&amp;#34;: &amp;#34;Node.js Dev Container&amp;#34;,
 &amp;#34;build&amp;#34;: {
 &amp;#34;dockerfile&amp;#34;: &amp;#34;Dockerfile.dev&amp;#34;
 },
 &amp;#34;forwardPorts&amp;#34;: [
 3000
 ],
 &amp;#34;postCreateCommand&amp;#34;: &amp;#34;npm install&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This goes in the .devcontainer directory. It&amp;rsquo;s almost all self explanatory - we tell the extension what container we&amp;rsquo;re using - in this case building it from &lt;code&gt;Dockerfile.dev&lt;/code&gt;, export the port we&amp;rsquo;re running on, and run a command in the terminal of our new system once it exists.&lt;/p&gt;
&lt;h3 id="whats-missing"&gt;What&amp;rsquo;s missing?&lt;/h3&gt;
&lt;p&gt;Alert readers will have noticed there&amp;rsquo;s a couple of things that we need which are missing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;VS Code Server - the way that VS Code is working in this configuration is that it&amp;rsquo;s running on our local machine, but connecting to a &amp;ldquo;VS Code Server&amp;rdquo; inside the container.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Bind mounts to our local directory - Once we load up the dev container, all our local files will need to be available in VS Code somehow.&lt;/p&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;So how to these get in the container? We don&amp;rsquo;t have to do anything to deal with these two issues. This is part of the magic that the VS Code Dev Container extension is doing for us. After the container is created, the extension:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;installs the server binary, and starts it&lt;/li&gt;
&lt;li&gt;bind mounts the local workspace to &lt;code&gt;/workspaces/&amp;lt;your-folder-name&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;And sets that as the WORKDIR in the container&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="lets-go"&gt;Let&amp;rsquo;s go&lt;/h3&gt;
&lt;p&gt;Okay, with the &lt;code&gt;Dockerfile.dev&lt;/code&gt; and &lt;code&gt;devcontainer.json&lt;/code&gt; in place, we&amp;rsquo;re now ready to launch our devcontainer.&lt;/p&gt;
&lt;p&gt;In the VSCode command pallet, run &lt;code&gt;Dev Containers: Reopen in container&lt;/code&gt;. The first run will take a few moments since the container has to be built first, but then it should look something like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-09-at-17.49.40.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;The big clue that you&amp;rsquo;re in the dev container now is the blue message in the bottom left corner. Most everything that we could do in the local environment we can do here in the container - for example editing code and running it.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-09-at-17.54.43.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-09-at-17.54.53.png" alt=""&gt;&lt;/p&gt;
&lt;h3 id="extensions"&gt;Extensions&lt;/h3&gt;
&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-09-at-18.05.45.png" width="427" alt=""&gt;
&lt;p&gt;If you have a look at your VS Code extensions while working in this dev container, you&amp;rsquo;ll see that some are still installed, but others are now greyed out. Some extensions only effect the UI (&amp;ldquo;UI Extensions&amp;rdquo; - listed under &amp;ldquo;Local - Installed&amp;rdquo;) so they live in the local VS Code, others have functionality that needs to run in the workspace environment so they (&amp;ldquo;Workspace extensions&amp;rdquo;) need to live in the VS Code server part.&lt;/p&gt;
&lt;p&gt;Any UI Extensions you had installed before will still be there since they live in the local VS Code, but they others will be greyed out and unavailable unless you install them into the dev container.&lt;/p&gt;
&lt;p&gt;In the image here you can see my &amp;ldquo;vscode-icons&amp;rdquo; and &amp;ldquo;vscode-pdf&amp;rdquo; which only effect how things are displayed are both still available, but &amp;ldquo;Beancount&amp;rdquo; &amp;amp; &amp;ldquo;Cline&amp;rdquo; that need access to files need to be installed in the container if I want to use them on this project.&lt;/p&gt;
&lt;p&gt;We can click on the &amp;ldquo;Install in Dev Container&amp;rdquo; button for any of these, and it will be installed into the dev container. I need ESLint for this project so I&amp;rsquo;ll could that - then it will appear in the &amp;lsquo;Dev Container&amp;rsquo; tab. This is a good way of mimicking the normal workflow for users, but this extension is only persisted in the container while it exists - If we make any changes to the &lt;code&gt;dockerfile&lt;/code&gt; or &lt;code&gt;devcontainer.json&lt;/code&gt; VS Code will rebuild the container and the extension will be gone again.&lt;/p&gt;
&lt;p&gt;If we want a workspace extension, a more persistent way to install it is to add it to our &lt;code&gt;devcontainer.json&lt;/code&gt;&lt;/p&gt;
&lt;h3 id="adding-extensions-to-devcontainerjson"&gt;Adding extensions to devcontainer.json&lt;/h3&gt;
&lt;p&gt;Extensions added this way will be the same for anyone who uses our dev container definition (which is what I&amp;rsquo;m calling the combined &lt;code&gt;dockerfile&lt;/code&gt; and &lt;code&gt;devcontainer.json&lt;/code&gt;), including if they just clone the project from git. In fact, this was the original intention of dev containers - to have a fully reproducible development environment that is stored with its project.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add a couple of extensions.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;{
 &amp;#34;name&amp;#34;: &amp;#34;Node.js Dev Container&amp;#34;,
 &amp;#34;build&amp;#34;: {
 &amp;#34;dockerfile&amp;#34;: &amp;#34;Dockerfile.dev&amp;#34;
 },
 &amp;#34;customizations&amp;#34;: {
 &amp;#34;vscode&amp;#34;: {
 &amp;#34;extensions&amp;#34;: [
 &amp;#34;dbaeumer.vscode-eslint&amp;#34;,
 &amp;#34;esbenp.prettier-vscode&amp;#34;
 ]
 }
 },
 &amp;#34;forwardPorts&amp;#34;: [
 3000
 ],
 &amp;#34;postCreateCommand&amp;#34;: &amp;#34;npm install&amp;#34;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you make these changes in VS Code, it will probably pop up and ask you if it can rebuild the container, otherwise open the command palette and select &amp;ldquo;Dev Containers: Rebuild Container&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;You might be wondering where we get the extension id&amp;rsquo;s from (like &lt;code&gt;dbaeumer.vscode-eslint&lt;/code&gt;) The easiest way to to right click on one in the extension list and select &amp;ldquo;Copy Extension ID&amp;rdquo;. It&amp;rsquo;s also listed on the extension web page.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screenshot-2026-01-10-at-15.23.47.jpg" alt=""&gt;&lt;/p&gt;
&lt;h3 id="finally"&gt;Finally&lt;/h3&gt;
&lt;p&gt;So that&amp;rsquo;s the basics of getting a simple dev container set up. The code for this is on &lt;a href="https://github.com/IanKulin/devcont-demo"&gt;GitHub here&lt;/a&gt;. There&amp;rsquo;s a crucial issue we haven&amp;rsquo;t solved though - how to pull in your ssh keys for pushing the code to external repositories. We&amp;rsquo;ll deal with that in a future post.&lt;/p&gt;</description></item><item><title>Use VS Code to work on remote files</title><link>https://blog.iankulin.com/use-vs-code-to-work-on-remote-files/</link><pubDate>Thu, 21 Sep 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/use-vs-code-to-work-on-remote-files/</guid><description>&lt;p&gt;If you&amp;rsquo;ve got a script, or some code to work on, and it&amp;rsquo;s on a VM somewhere, you can always &lt;code&gt;ssh&lt;/code&gt; in and use &lt;code&gt;nano&lt;/code&gt; or &lt;a href="https://blog.iankulin.com/bloody-vim/"&gt;&lt;code&gt;vim&lt;/code&gt;&lt;/a&gt; to make your edits. Like a caveman. With an archaic editor, no intellisense, and no spell checking.&lt;/p&gt;
&lt;p&gt;Or&amp;hellip;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.50.15-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.50.15-pm.png" width="900" alt="VS Code connected to a remote server over SSH"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This magic - of editing a files on a remote server over SSH is achieved by using a Microsoft plugin for VS Code - &amp;ldquo;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh"&gt;Remote - SSH&lt;/a&gt;&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh"&gt;&lt;img src="https://blog.iankulin.com/images/untitled.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;How the plugin works is that it installs a copy of &lt;a href="https://code.visualstudio.com/docs/remote/vscode-server"&gt;VS Code Server&lt;/a&gt; on the remote machine, then connects to it over SSH.&lt;/p&gt;
&lt;p&gt;The experience is pretty great, once it&amp;rsquo;s installed (which I&amp;rsquo;ll run through below) it&amp;rsquo;s as if you are natively on the remote machine - the terminal is in the current directory on the remote machine, you can navigate around your files, edit them, use git, drag local files in and drop them in your remote folder and run your code.&lt;/p&gt;
&lt;h3 id="setup"&gt;Setup&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;You need to be able to SSH into the remote machine, preferably with keys if you want a smooth experience. I&amp;rsquo;ve &lt;a href="https://blog.iankulin.com/ssh-key-login-on-vps/"&gt;talked about this&lt;/a&gt; before if that&amp;rsquo;s new to you.&lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-ssh"&gt;Remote-SSH&lt;/a&gt; plugin&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.29.05-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.29.05-pm.png" width="825" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Once that&amp;rsquo;s done, there will be a &amp;ldquo;Remote Explorer&amp;rdquo; icon over on the left edge of the VS Code window. If you click on that, the explorer area will show a list of machines you&amp;rsquo;ve configured. There&amp;rsquo;s a + to add a new one.&lt;/li&gt;
&lt;li&gt;If you click on that, it will ask you to enter the SSH command to access a machine.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.31.49-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-3.31.49-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;When you hit enter on that, it will ask you where to save the config file - I just chose the top one since that&amp;rsquo;s where I usually go to edit &lt;code&gt;known_hosts&lt;/code&gt; etc.&lt;/p&gt;
&lt;p&gt;You can get back to this config file later by clicking on the gear icon next to SSH in the remote explorer. That&amp;rsquo;s what I&amp;rsquo;ve done in the screenshot below to change the server name to something a bit more memorable.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With that all set up, just click on the &amp;ldquo;Connect in New Window&amp;rdquo; icon next to the server you want to work on.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-4.59.30-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-4.59.30-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Once the connection is established, new VS Code window will open up, with the files in the remote directory loaded ready for work. The status of the connection is shown in the bottom left corner of the window.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-5.04.18-pm.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-08-13-at-5.04.18-pm.png" width="900" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If anything here didn&amp;rsquo;t make sense, there&amp;rsquo;s a &lt;a href="https://code.visualstudio.com/docs/remote/ssh-tutorial"&gt;good tutorial on the Visual Studio Code website&lt;/a&gt;, or if you&amp;rsquo;re more of a video person, this overenthusiastic guy has a &lt;a href="https://www.youtube.com/watch?v=7kum46SFIaY"&gt;good quick summary&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Hide 'Problems' for a file in VS Code</title><link>https://blog.iankulin.com/hide-problems-for-a-file-in-vs-code/</link><pubDate>Fri, 25 Aug 2023 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/hide-problems-for-a-file-in-vs-code/</guid><description>&lt;p&gt;I&amp;rsquo;m interested in trying out &lt;a href="https://picocss.com/"&gt;Pico CSS&lt;/a&gt; - a lightweight CSS library, but when I tossed it into my project, the linter found and reported 29 problems. One of my processes is to just keep that problems tab clear as I work, so I&amp;rsquo;d like that to go away.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-20-at-6.54.06-am.jpg" alt="Screenshot of VS Code showing 29 problems detected."&gt;&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s possible, but only by &amp;rsquo;excluding&amp;rsquo; the file from your project - it won&amp;rsquo;t show up in the file view either. That&amp;rsquo;s fine with me, I never want to deal with the file so we&amp;rsquo;ll do that, although it might confuse me in seven years if I come back to this project, so I&amp;rsquo;ll drop a link in my .git_ignore as a clue for future me (excluding the file in VS Code doesn&amp;rsquo;t affect git finding it).&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-20-at-7.03.25-am.png" alt="screenshot of .gitignore file including public/pico.min.css"&gt;&lt;/p&gt;
&lt;p&gt;Workspace settings (such as excluding a file) are stored in &lt;code&gt;./vscode/settings.json&lt;/code&gt; - this has some other bits and pieces such as spelling corrections etc. It&amp;rsquo;s worth letting this into your repository so your workspace is recreated when you clone the repo. The fragment you need to add is:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt; &amp;#34;files.exclude&amp;#34;: {
 &amp;#34;**/pico.min.css&amp;#34;: true
 }
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This will remove it from the files, and it will stop it being processed by your extensions including any linters. If the problems don&amp;rsquo;t disappear instantly, click into a different file for a second and they should go, or occasionally, you&amp;rsquo;ll need to close and open VSCode.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://blog.iankulin.com/images/screen-shot-2023-07-20-at-6.54.47-am.png"&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2023-07-20-at-6.54.47-am.png" width="800" alt="Screenshot of VS Code showing settings.json and zero problems in the problems tab."&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Running Javascript in VS Code</title><link>https://blog.iankulin.com/running-javascript-in-vs-code/</link><pubDate>Tue, 27 Dec 2022 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/running-javascript-in-vs-code/</guid><description>&lt;p&gt;&lt;img src="https://blog.iankulin.com/images/screen-shot-2022-12-21-at-11.08.17-am.png" alt=""&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve been using the &lt;a href="https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer"&gt;Live Server&lt;/a&gt; plugin to see HTML &amp;amp; CSS updated as I edit, and that will also be useful when I start using Javascript for web development, but as you can see above, I&amp;rsquo;m not quite up to that. It seemed there should be a way to run JS in VS Code, and it turns out it&amp;rsquo;s easy.&lt;/p&gt;
&lt;p&gt;You just need something installed that can run Javascript. Node.js is the obvious choice, and you&amp;rsquo;re going to need it later in your development journey. Just i&lt;a href="https://nodejs.org/en/download/"&gt;nstall Node.js&lt;/a&gt; then the first time you try to run some JS in VS code, it will ask you what to use, select Node and you&amp;rsquo;re in business.&lt;/p&gt;
&lt;p&gt;I found out about this &lt;a href="https://linuxhint.com/javascript-visual-studio-code/"&gt;from here&lt;/a&gt;. I didn&amp;rsquo;t worry about Code Runner - just using Node.js worked for me without any fiddling beyond installing it (this is on Mac though - your Windows mileage may vary).&lt;/p&gt;
&lt;p&gt;While I&amp;rsquo;m doing handy hints for dev tools, I discovered last night that the baby webserver that Live Server is running, isn&amp;rsquo;t just available on the local machine, it&amp;rsquo;s available to anyone on your network. Instead of using 127.0.0.1:5500, use the IP address of your development machine (but still port 5500 if that&amp;rsquo;s what you&amp;rsquo;re using). It&amp;rsquo;s an excellent way to look at your layout on phones etc, or, I guess, to see what other devs at your company are working on :- )&lt;/p&gt;</description></item><item><title>Who is Emmet?</title><link>https://blog.iankulin.com/who-is-emmet/</link><pubDate>Wed, 14 Dec 2022 00:00:00 +0000</pubDate><guid>https://blog.iankulin.com/who-is-emmet/</guid><description>&lt;p&gt;&lt;a href="https://www.piqsels.com/en/public-domain-photo-ircsa"&gt;&lt;img src="https://blog.iankulin.com/images/css-hacks.jpg" width="728" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I knew there was some magical way of entering all the the &lt;HTML&gt; boilerplate in Visual Studio Code as I&amp;rsquo;d seen it happen in several videos, and assumed is was some sort of macro expansion thing in the editor. Fast forward a few blog post readings and youtube viewings and I keep seeing tangential references to someone called Emmet. Turns out they&amp;rsquo;re the same thing, and it&amp;rsquo;s pretty cool.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s not a new idea to have functionality in code editors to insert snippets of code. &lt;a href="https://docs.emmet.io/"&gt;Emmet&lt;/a&gt; goes a bit further than that - and like many tools made by programmers for programmers it goes way to technical to the point where you need to memorise ridiculous amounts of combos to to some awesome stuff (I&amp;rsquo;m looking at you whoever made it possible to use vi commands in VS Code). Nevertheless, Emmet is extremely handy even at my n00b level.&lt;/p&gt;
&lt;p&gt;The key thing to know, is that it borrows from the CSS selector syntax. So if you want to insert &lt;code&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt; you enter &lt;code&gt;div&lt;/code&gt; and press tab.&lt;/p&gt;
&lt;p&gt;Want a div with a class named &amp;ldquo;container&amp;rdquo;?&lt;/p&gt;
&lt;p&gt;&lt;code&gt;div.container&lt;/code&gt; becomes &lt;code&gt;&amp;lt;div class=&amp;quot;container&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The same trick works for an id - Enter&lt;/p&gt;
&lt;p&gt;&lt;code&gt;div#emmet&lt;/code&gt; becomes &lt;code&gt;&amp;lt;div id=&amp;quot;emmet&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Would you like a div, with a heading inside? The greater than sign nests elements, so &lt;code&gt;div&amp;gt;h4&lt;/code&gt; becomes:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
 &amp;lt;h4&amp;gt;&amp;lt;/h4&amp;gt;
&amp;lt;div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you&amp;rsquo;d like some text up in there, try div&amp;gt;h4{Hello world}&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;div&amp;gt;
 &amp;lt;h4&amp;gt;Hello world&amp;lt;/h4&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;You can repeat things numbers of times, so to create a list with three items, try &lt;code&gt;ul&amp;gt;li*3&lt;/code&gt; to get:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;&amp;lt;ul&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;
 &amp;lt;li&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;That&amp;rsquo;s about as complex as I&amp;rsquo;d want to get, though of course it gets more complex. It&amp;rsquo;s a super handy feature that quickly becomes second nature.&lt;/p&gt;</description></item></channel></rss>