{"id":586,"date":"2024-04-09T16:14:14","date_gmt":"2024-04-09T20:14:14","guid":{"rendered":"https:\/\/sites.bu.edu\/marcom-team\/?page_id=586"},"modified":"2025-12-01T10:44:02","modified_gmt":"2025-12-01T15:44:02","slug":"vs-code","status":"publish","type":"page","link":"https:\/\/sites.bu.edu\/marcom-team\/departments\/interactive-design\/role-specific-info\/designers-developers\/dev-setup\/sftp-code-editors\/vs-code\/","title":{"rendered":"VS Code Code Editor"},"content":{"rendered":"<h2>SFTP Set Up<\/h2>\n<p>There are many benefits in switching to VS Code but the biggest improvement is the SFTP integration. A more robust solution in comparison to Sublime without the need to open all compiled files or the need to close\/reopen when switching remote paths. SFTP for VS Code offers the ability to setup profiles for different remote paths and an easy switching method when required to sync files in multiple locations.<\/p>\n<p>Creating a new SFTP connection is straight-forward and easy but requires a few steps to ensure a secure connection. First, you&#8217;ll need to add an SFTP extension. While there are many different extensions we will be focusing on using <strong>natizyskunk\u00a0SFTP\/FTP<\/strong> extension for Visual Studio Code for our example. To begin you&#8217;ll need to download and install the extension<\/p>\n<ol>\n<li>In VS Code, navigate to the Extensions panel and search for &#8220;SFTP&#8221; then select the <em>natizyskunk<\/em>\u00a0version.<\/li>\n<li>Open or create the folder you wish to sync with the remote server<\/li>\n<li><strong>Ctrl+Shift+P<\/strong> on Windows\/Linux or <strong>Cmd+Shift+P<\/strong> on a Mac to open the command palette, run <code>SFTP: config<\/code> command.<\/li>\n<li>A basic configuration file will appear named <code>sftp.json<\/code> under the <code>.vscode\/<\/code> directory. Edit the parameters to match your setup.<\/li>\n<\/ol>\n<p>For detailed usage on using n<span>atizyskunk<\/span> SFTP please visit the <a href=\"https:\/\/marketplace.visualstudio.com\/items?itemName=Natizyskunk.sftp\">extension wiki<\/a>.<\/p>\n<h3>SFTP Configurations<\/h3>\n<p>A simple setup to get you coding immediately.<\/p>\n<pre><code style=\"display: block; white-space: pre-wrap; padding: 1rem;\">{\r\n    \"name\": \"CONFIG_NAME\",\r\n    \"host\": \"NAME_OF_REMOTE_HOST\",\r\n    \"protocol\": \"sftp\",\r\n    \"port\": 22,\r\n    \"username\": \"USERNAME\",\r\n    \"remotePath\": \"\/var\/www\/sandboxes\/SANDBOX_NAME\/current\/wp-content\/themes\/THEME_NAME\",\r\n    \"password\": \"PASSWORD\",\r\n    \"uploadOnSave\": true,\r\n    \"watcher\": {\r\n        \"files\": \"**\/*.{js,css,map,php}\",\r\n        \"autoUpload\": true,\r\n        \"autoDelete\": false\r\n    },\r\n    \"ignore\": [\r\n        \".vscode\",\r\n        \".git\",\r\n        \".DS_Store\",\r\n        \"node_modules\",\r\n        \"sftp.json\",\r\n        \".github\",\r\n        \"sass-cache\",\r\n        \"css_dev\",\r\n        \"js_dev\"\r\n    ]\r\n}\r\n<\/code><\/pre>\n<p><em>You should <strong>NEVER<\/strong> include your password in the SFTP configuration file and is strongly recommended to edit before continuing. To capitalize on using SSH and obscure your password make sure to follow the instructions on using the <code>agent<\/code> setting indicate the path to ssh-agent&#8217;s UNIX socket for ssh-agent-based user authentication.<\/em><\/p>\n<h2>SSH Key and Agent Setup for VS Code<\/h2>\n<p><strong>A better, safer setup to get you coding like a boss.<\/strong><\/p>\n<p>In the following configuration we&#8217;ll setup a file that uses SSH authentication, creates multiple remote server profiles and watch all relevant file changes.<\/p>\n<p>You&#8217;ll also need to have a SSH key and add it to the dev servers to make a connection and authenticate. If you haven&#8217;t already setup a SSH key please refer to Github&#8217;s <a href=\"https:\/\/help.github.com\/articles\/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent\/\">Generating a new SSH key and adding it to the ssh-agent<\/a> instructions.<\/p>\n<p><em>When adding the SSH key to your local SSH agent using macOS Sierra 10.12.2 or later, you&#8217;ll need to add\/modify your <code>~\/.ssh\/config<\/code> file to automatically load keys into the ssh-agent and store passphrases in your keychain.<\/em><\/p>\n<ol>\n<li>In a new OS Finder\/File Explorer window, enable access to Hidden Files:\n<ul>\n<li>Mac OS X: <code>CMD + SHIFT + .<\/code><\/li>\n<li>Windows 10: <code>ALT + H<\/code><span> to access the &#8220;View&#8221; tab, and an additional <code>H<\/code>.<\/span><\/li>\n<li>Windows 11: <code>ALT + V<\/code><span> to access the &#8220;View&#8221; tab, and an additional <code>H<\/code><\/span><span>.<\/span><\/li>\n<\/ul>\n<\/li>\n<li>Navigate to the <code>~\/.ssh\/config<\/code> file directory using Mac OS X: <code>CMD + SHIFT + G<\/code>\u00a0or Windows: <code>WINDOWS KEY + R<\/code>).<\/li>\n<li>Open the <code>config<\/code> file with your code editor(in this case, VS Code) and add <code>AddKeysToAgent yes<\/code> to resemble:<\/li>\n<\/ol>\n<pre><code style=\"display: block; white-space: pre-wrap; padding: 1rem;\">Host *\r\n  AddKeysToAgent yes\r\n  UseKeychain yes\r\n  IdentityFile ~\/.ssh\/id_rsa\r\n<\/code><\/pre>\n<p>The following instructions assume the key files are named <code>id_rsa<\/code> and <code>id_rsa.pub<\/code> however, instructions are the same for <code>id_ed25519<\/code> and <code>id_ed25519.pub<\/code> pairs.<\/p>\n<ol>\n<li>Using Terminal: Install key on dev servers <code class=\"inline\">ssh-copy-id -i ~\/.ssh\/id_rsa.pub <strong>yourBU-Username<\/strong>@ist-wp-app-dv01.bu.edu<\/code>, replacing <strong>yourBU-Username<\/strong> with yours.<\/li>\n<li>Configure and save your <code>SFTP.json<\/code> file using the following configuration or one customized to your environment and liking. The important settings revolve around the <code>agent<\/code> and <code>defaultProfile<\/code> strings.<\/li>\n<\/ol>\n<pre><code style=\"display: block; white-space: pre-wrap; padding: 1rem;\">{\r\n    \"name\": \"CONFIG_NAME\",\r\n    \"protocol\": \"sftp\",\r\n    \"port\": 22,\r\n    \"username\": \"USERNAME\",\r\n    \"agent\": \"$SSH_AUTH_SOCK\",\r\n    \"watcher\": {\r\n        \"files\": \"**\/*.{js,css,map,php}\",\r\n        \"autoUpload\": true,\r\n        \"autoDelete\": false\r\n    },\r\n    \"profiles\": {\r\n        \"PROFILE1_NAME\": {\r\n            \"host\": \"ist-wp-app-dv01.bu.edu\",\r\n            \"remotePath\": \"\/var\/www\/sandboxes\/SANDBOX1_NAME\/current\/wp-content\/themes\/THEME_NAME\",\r\n            \"uploadOnSave\": true\r\n        },\r\n        \"PROFILE2_NAME\": {\r\n            \"host\": \"ist-wp-app-dv01.bu.edu\",\r\n            \"remotePath\": \"\/var\/www\/sandboxes\/SANDBOX2_NAME\/current\/wp-content\/themes\/THEME_NAME\",\r\n            \"uploadOnSave\": true\r\n        }\r\n    },\r\n    \"defaultProfile\": \"DEFAULT_PROFILE_NAME\",\r\n    \"ignore\": [\r\n        \".vscode\",\r\n        \".git\",\r\n        \".DS_Store\",\r\n        \"node_modules\",\r\n        \"sftp.json\",\r\n        \".github\",\r\n        \"sass-cache\",\r\n        \"css_dev\",\r\n        \"js_dev\"\r\n    ]\r\n}\r\n<\/code><\/pre>\n<p>Now open the SFTP Explorer and you should see your remote repository and branches.<\/p>\n<div class=\"bu_collapsible_container \" aria-live=\"polite\" data-customize-animation=\"false\"><h2 class=\"bu_collapsible\" aria-expanded=\"false\"tabindex=\"0\" role=\"button\">Recommended Extensions<\/h2><div class=\"bu_collapsible_section\" style=\"display: none;\"><\/p>\n<p>VS Code has a great repository of <a href=\"https:\/\/github.com\/zed-industries\/extensions\">editor extensions<\/a>. Here are some recommended ones:<\/p>\n<p>Name: GitHub Pull Requests<br \/>\nId: GitHub.vscode-pull-request-github<br \/>\nDescription: Pull Request and Issue Provider for GitHub<br \/>\nVersion: 0.94.0<br \/>\nPublisher: GitHub<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=GitHub.vscode-pull-request-github<\/p>\n<p>Name: SFTP<br \/>\nId: Natizyskunk.sftp<br \/>\nDescription: SFTP\/FTP sync<br \/>\nVersion: 1.16.3<br \/>\nPublisher: Natizyskunk<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=Natizyskunk.sftp<\/p>\n<p>Name: SCSS IntelliSense<br \/>\nId: mrmlnc.vscode-scss<br \/>\nDescription: Advanced autocompletion and refactoring support for SCSS<br \/>\nVersion: 0.10.0<br \/>\nPublisher: mrmlnc<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=mrmlnc.vscode-scss<\/p>\n<p>Name: PHP Intelephense<br \/>\nId: bmewburn.vscode-intelephense-client<br \/>\nDescription: PHP code intelligence for Visual Studio Code<br \/>\nVersion: 1.12.2<br \/>\nPublisher: Ben Mewburn<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=bmewburn.vscode-intelephense-client<\/p>\n<p>Name: WordPress Hooks IntelliSense<br \/>\nId: johnbillion.vscode-wordpress-hooks<br \/>\nDescription: IntelliSense and autocompletion for WordPress hooks, actions, and filters<br \/>\nVersion: 1.4.0<br \/>\nPublisher: johnbillion<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=johnbillion.vscode-wordpress-hooks<\/p>\n<p>Name: CSS Alphabetize<br \/>\nId: PolymerMallard.css-alphabetize<br \/>\nDescription: Alphabetizes the properties of CSS structures.<br \/>\nVersion: 0.4.1<br \/>\nPublisher: Polymer Mallard<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=PolymerMallard.css-alphabetize<\/p>\n<p>Name: Sort lines<br \/>\nId: Tyriar.sort-lines<br \/>\nDescription: Sorts lines of text<br \/>\nVersion: 1.11.0<br \/>\nPublisher: Daniel Imms<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=Tyriar.sort-lines<\/p>\n<p>Name: indent-rainbow<br \/>\nId: oderwat.indent-rainbow<br \/>\nDescription: Makes indentation easier to read<br \/>\nVersion: 8.3.1<br \/>\nPublisher: oderwat<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=oderwat.indent-rainbow<\/p>\n<p>Name: \ud83e\udde0 Logical Properties<br \/>\nId: coderfin.logical-properties<br \/>\nDescription: Identify and replace CSS \ud83d\udcaa physical properties with \ud83e\udde0 logical properties.<br \/>\nVersion: 0.1.16<br \/>\nPublisher: coderfin<br \/>\nVS Marketplace Link: https:\/\/marketplace.visualstudio.com\/items?itemName=coderfin.logical-properties<\/p>\n<p><\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"<p>SFTP Set Up There are many benefits in switching to VS Code but the biggest improvement is the SFTP integration. A more robust solution in comparison to Sublime without the need to open all compiled files or the need to close\/reopen when switching remote paths. SFTP for VS Code offers the ability to setup profiles [&hellip;]<\/p>\n","protected":false},"author":12906,"featured_media":0,"parent":534,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/pages\/586"}],"collection":[{"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/users\/12906"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/comments?post=586"}],"version-history":[{"count":13,"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/pages\/586\/revisions"}],"predecessor-version":[{"id":2570,"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/pages\/586\/revisions\/2570"}],"up":[{"embeddable":true,"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/pages\/534"}],"wp:attachment":[{"href":"https:\/\/sites.bu.edu\/marcom-team\/wp-json\/wp\/v2\/media?parent=586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}