Skip to content
The latest ArchivesSpace release version

Using the VS Code editor

ArchivesSpace provides a VS Code settings file that makes it easy for contributors using VS Code to follow the code style of the project and work with the end-to-end tests. Using this tool chain in your editor helps fix code format and lint errors before committing files or running tests. In many cases such errors will be fixed automatically when the file being worked on is saved. Errors that can’t be fixed automatically will be highlighted with squiggly lines. Hovering your cursor over these lines will display a description of the error to help reach a solution.

  1. Node.js
  2. Ruby
  3. VS Code
  1. ESLint
  2. Prettier
  3. Rubocop
  4. Stylelint
Terminal window
gem install rubocop

See https://docs.rubocop.org/rubocop/installation.html for further information, including using Bundler.

Run the following command from the ArchivesSpace root directory.

Terminal window
npm install

See package.json for further details on how these tools are used in ArchivesSpace.

Add the following extensions via the VS Code command palette or the Extensions panel. (See this documentation for installing and managing extensions).

  1. ESLint (dbaeumer.vscode-eslint)
  2. Prettier (esbenp.prettier-vscode)
  3. Ruby Rubocop Revised (LoranKloeze.ruby-rubocop-revived)
  4. Stylelint (stylelint.vscode-stylelint)

Optional — for enhancing work with the end-to-end tests:

  1. Cucumber (CucumberOpen.cucumber-official) — see End-to-end test integration, especially step-definition navigation.

It’s important to note that since these extensions work in tandem with the VS Code settings file, these settings only impact your ArchivesSpace VS Code Workspace, not your global VS Code User settings.

The extensions should now work out of the box at this point providing error messages and autocorrecting fixable errors on file save!

The ArchivesSpace repository includes optional VS Code workspace configuration that integrates the Cucumber end-to-end test suite with the editor. The files .vscode/example.tasks.json and .vscode/example.settings.json are not enabled by default, so they do not override your personal editor configuration.

Enable the tasks

Copy the example tasks file to .vscode/tasks.json. This adds a task that runs the e2e test suite with the correct working directory, Ruby environment, and environment variables. Run it via Terminal → Run Task… → Cucumber: Run e2e-test (the same command as in the e2e test documentation). You may optionally supply a feature file path, file.feature:line.

Step-definition navigation

Integrate the contents of example.settings.json into your existing .vscode/settings.json (do not replace the existing file, but merge the Cucumber-related settings if you desire to use them so your current workspace settings are preserved).

This configures the Cucumber extension for e2e-tests/**/*.feature and shared Ruby step definitions, enabling jump-to-definition, undefined-step detection, and discovery of shared steps. This simplifies contributing new end-to-end tests.