Recommended Setup
Any relevant tool may be used with the remote workplace file system, but we recommend VS Code. Our ScriptRunner Connect web editor is based on it, and with the Natizyskunk SFTP extension, syncing files becomes a seamless process.
Known bug in SFTP extension
The third-party SFTP extension we recommend has a known bug where the SFTP connection can go stale. If this happens, then any FTP commands you may trigger will get stuck.
If this happens to you, try restarting VS Code; this usually resolves the issue.
VS Code forks
Demo
Recommended setup
1️⃣ Prepare
- Install Node.js v20+.
- Create a new folder in your local workspace and open it in VS Code.
- In VS Code, navigate to Extensions and install the SFTP extension.Be sure to use the one by "Natizyskunk," as it has received more updates than other forks.
2️⃣ Configure SFTP
- Open the command palette (F1) and select SFTP: Config.
This creates a default configuration file for the SFTP extension. - Ensure that Auto Save is off by going to the File menu and unchecking Auto Save if its enabled.
3️⃣ Sync it up
You'll need to enable the SFTP server for the workspace and generate credentials to complete this step.
- Replace the
host,username, andprivateKeyPathwith your personal values if you copied the file from here. If you copied the file from our web UI, thehostand theusernamevalues are already filled in for you, onlyprivateKeyPathneeds specifying in this case. - Open the command palette (F1) and click SFTP: Sync Remote, then select Local (type
syncto narrow it down). - Confirm the selected folder, and let the files download. This is important, if you don't select the folder, the operation will be cancelled.
4️⃣ Dependencies and IntelliSense
- Open the
scriptsfolder. - You may see red compilation error lines, indicating that NPM dependencies have not been installed yet.
- To fix this: Open the terminal (Terminal > New Terminal) and run:
npminstall. - Or if you're a Yarn user, run:
yarn.
- To fix this: Open the terminal (Terminal > New Terminal) and run:
- Restart VS Code if error lines persist, usually this is not required, but it can take couple of seconds for VS Code to pick up on the changes.
Once the red lines are gone, you should have full IntelliSense support.
Upload code
Save files with CTRL/CMD + S.
With
uploadOnSaveenabled, uploads happen automatically.Without automation: right-click, then select Upload File.
Switch to the web app, wait a few seconds, and the ScriptRunner Connect web-based workspace refreshes with your changes. If that doesn't happen after 20 seconds, try refreshing your workspace manually.
Continue testing scripts manually or externally via our web UI.
VCS setup
If your team uses Git or another VCS:
Clone/checkout the repo instead of downloading via SFTP, given someone has already pushed the workspace copy to VCS.
Add your own
.vscode/sftp.jsonfile (not stored in VCS).Proceed with the same workflow.
Tips and tricks 😎
Here are a few things to keep in mind:
- The SFTP extension adds an SFTP Explorer tab in VS Code once installed.
- You may need to restart VS Code for it to appear.
- This extension is helpful for exploring the remote copy without downloading files first and allows you to perform various actions by right-clicking on the files.
- To monitor the actions of the SFTP extension, go to the Output tab in the Console and select sftp from the dropdown menu. This is very handy for troubleshooting.
- Occasionally, the FTP session may get stuck and not automatically reconnect.
- Restarting VS Code can resolve the issue.
- Be aware of the limitations regarding deleting and renaming files.