<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://barcavin.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://barcavin.github.io/" rel="alternate" type="text/html" /><updated>2025-06-17T10:45:43-07:00</updated><id>https://barcavin.github.io/feed.xml</id><title type="html">Kaiwen ‘Kevin’ Dong</title><subtitle>Senior AI Research Scientist at Intuit</subtitle><author><name>Kaiwen Dong</name><email>kaiwen_dong@intuit.com</email></author><entry><title type="html">Visual Studio Code on Remote Server</title><link href="https://barcavin.github.io/posts/2021/09/19/vscode-ssh" rel="alternate" type="text/html" title="Visual Studio Code on Remote Server" /><published>2021-09-19T00:00:00-07:00</published><updated>2021-09-19T00:00:00-07:00</updated><id>https://barcavin.github.io/posts/2021/09/19/vscode-ssh</id><content type="html" xml:base="https://barcavin.github.io/posts/2021/09/19/vscode-ssh"><![CDATA[<!-- python extension
ssh configuration setup
what if vs code server crash
rsync -->

<p><a href="https://code.visualstudio.com/">Visual Studio Code</a> has become my favorite all-in-one editor since it has a list of excellent extensions which allow accomplishing all my work in one place. For instance, it supports Jupyter Notebook (I love its variable explorer), LaTex writing, Jira Integration (No need to go back and forth between editor and browser), and Python Debugger tool (Save me huge amount of time debugging). Recently, its <a href="https://code.visualstudio.com/docs/remote/remote-overview">remote development tools</a> really catch my heart on its simple setup but powerful functionality. </p>

<p>The remote development can be via ssh or container. We just cover ssh part here. As there are also a lot of other great tutorials about setting it up so I’d like to go through it more with my personal tips and tricks.</p>

<p><img src="/images/mohammad-rahmani-Y5yxdx2a4PI-unsplash.jpg" alt="VS Code" /></p>

<h1 id="what-i-like-about-it">What I like about it</h1>

<blockquote>
  <p>VS Code provide a local-quality development experience - including full IntelliSense (completions), code navigation, and debugging - regardless of where your code is hosted.</p>
</blockquote>

<ol>
  <li>Have a file explorer for the remote server</li>
  <li>Git integration</li>
  <li>Code completion and Class/Method Signature</li>
  <li>Debug just like local</li>
  <li>Jupyter Notebook via Jupyter Server</li>
  <li>Python Extension works the same on the server side</li>
</ol>

<h1 id="visual-studio-code-ssh-setup">Visual Studio Code SSH Setup</h1>
<p>In general, one can follow the <a href="https://code.visualstudio.com/docs/remote/ssh">official document</a> about setting up the VS Code server.</p>

<h1 id="ssh-configuration-setup">SSH configuration Setup</h1>
<p>If you have some hosts used a lot, or your ssh command is more than just <code class="language-plaintext highlighter-rouge">ssh user@hostname</code>, you
may want to use the <a href="https://code.visualstudio.com/docs/remote/ssh#_remember-hosts-and-advanced-settings">advanced settings</a> for ssh connection.</p>

<p>My setup of SSH config:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>Host crc
  HostName crcfe01.crc.nd.edu
  User &lt;username&gt;
  ProxyJump &lt;username&gt;@jumpbox.nd.edu
</code></pre></div></div>

<p>If the ssh server has a jump server as the bridge to access, one can set up the ProxyJump in SSH config.</p>

<h1 id="what-if-the-vs-code-server-crash">What if the VS Code Server crash?</h1>
<p>Occasionally, my VS Code cannot connect to the remote server even though I have successfully set up
the connection before. Often, the issue can disapper after a while, but there are some cases that
you need to uninstall the VS Code server on the remote side and reinstall it.</p>

<p>The officially suggested way is to run the VS Code command palette and call <code class="language-plaintext highlighter-rouge">Remote-SSH: Uninstall VS Code Server from Host...</code>. However, as it fails to connect, one can’t run the command.</p>

<p>The other way is to remove the entire VS Code server folder on the remote server if your SSH connection
from terminal still works.</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>rm -rf ~/.vscode-server
</code></pre></div></div>

<p>If the VS Code server is still running on the host server, the file in <code class="language-plaintext highlighter-rouge">.vscode-server</code> may not be deleted as it uses the resource. Another way to restart the VS Code server is:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>lsof +D .vscode-server/
kill -9 
ps uxa | grep &lt;username&gt;/.vscode-server | awk '{print $2}' | xargs kill -9
</code></pre></div></div>

<h1 id="file-sync-to-local-machine">File sync to local machine</h1>
<p>Even though I always use Git to manage the source code on the remote server, there still can be a chance that
you want to sync the file on the remote side to local machine. <a href="https://code.visualstudio.com/docs/remote/troubleshooting#_using-rsync-to-maintain-a-local-copy-of-your-source-code">Rsync</a> can be your pal here!</p>]]></content><author><name>Kaiwen Dong</name><email>kaiwen_dong@intuit.com</email></author><category term="Visual Studio Code" /><category term="Tool" /><summary type="html"><![CDATA[]]></summary></entry></feed>