# Teamscale Integration for Other IDEs and Editors
By using a small command-line client (teamscale-cli
) Teamscale can be integrated into other IDEs or editors for which no dedicated plug-in exists.
This makes it possible to use Teamscale, for example, from within Visual Studio Code or Sublime Text.
# Installing teamscale-cli
The CQSE website offers both the latest version and older versions of the teamscale-cli
client for download.
Moreover, you can choose between platform-specific (for Windows, Linux, macOS) and platform-independent downloads.
While the former downloads are self-contained, the latter requires a Java runtime environment to be installed on your machine.
- Download for Windows (x86):
- Latest Version: https://www.cqse.eu/download/teamscale/ide/cli/latest/teamscale-cli-windows-x86_64.zip (opens new window)
- Older Version: https://www.cqse.eu/download/teamscale/ide/cli/vM.N.x/teamscale-cli-windows-x86_64.zip (opens new window) (replacing
M.N
by the feature version you need but keeping the.x
, e.g.,7.8.x
)
- Download for Linux (x86):
- Latest Version: https://www.cqse.eu/download/teamscale/ide/cli/latest/teamscale-cli-linux-x86_64.zip (opens new window)
- Older Version: https://www.cqse.eu/download/teamscale/ide/cli/vM.N.x/teamscale-cli-linux-x86_64.zip (opens new window) (replacing
M.N
by the feature version you need but keeping the.x
, e.g.,7.8.x
)
- Download for macOS (x86):
- Latest Version: https://www.cqse.eu/download/teamscale/ide/cli/latest/teamscale-cli-macos-x86_64.zip (opens new window)
- Older Version: https://www.cqse.eu/download/teamscale/ide/cli/vM.N.x/teamscale-cli-macos-x86_64.zip (opens new window) (replacing
M.N
by the feature version you need but keeping the.x
, e.g.,7.8.x
)
- Download for macOS (ARM):
- Latest Version: https://www.cqse.eu/download/teamscale/ide/cli/latest/teamscale-cli-macos-aarch64.zip (opens new window)
- Older Version: https://www.cqse.eu/download/teamscale/ide/cli/vM.N.x/teamscale-cli-macos-aarch64.zip (opens new window) (replacing
M.N
by the feature version you need but keeping the.x
, e.g.,7.8.x
)
- Platform-independent download (requires a Java runtime environment)
- Latest Version: https://www.cqse.eu/download/teamscale/ide/cli/latest/teamscale-cli.zip (opens new window)
- Older Version: https://www.cqse.eu/download/teamscale/ide/cli/vM.N.x/teamscale-cli.zip (opens new window) (replacing
M.N
by the feature version you need but keeping the.x
, e.g.,7.8.x
)
To install teamscale-cli
, simply download the appropriate .zip
archive and extract it.
# Configuring Your Projects Using .teamscale.toml
Files
Before you can use teamscale-cli
, your local projects needs to be configured to map to projects on the Teamscale server.
This is done using one or more .teamscale.toml
configuration files in a simple, uniform file format (.teamscale.toml
).
In the simplest case, place a file like the following in the root directory of your project:
root = true
[project]
id = "example"
[server]
url = "https://example.com/teamscale/"
For more advanced cases, please refer to the documentation of the file format.
# Invoking teamscale-cli
from Different IDEs or Editors
# Visual Studio Code
To use Teamscale from within Visual Studio Code (opens new window) (VS Code), perform the following steps:
Add a new task (Terminal > Configure Tasks... > Create tasks.json file from template > Others).
Copy (or download) and paste the following snippet in VS Code's
tasks.json
format (opens new window):{ "version": "2.0.0", "tasks": [ { "label": "Upload File to Teamscale for Pre-Commit Analysis", "type": "process", // TODO Point to your teamscale-cli(.sh) executable. "command": "teamscale-cli/bin/teamscale-cli", "args": [ "pre-commit", "--show-links-to-findings", "--server", // TODO Point to your Teamscale server and insert your credentials. "https://username:accesskey@example.com/teamscale/", "${file}" ], "group": { "kind": "build", "isDefault": true }, "presentation": { "panel": "dedicated", "reveal": "never", "revealProblems": "onProblem" }, "problemMatcher": { "fileLocation": "absolute", "owner": "Teamscale", "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] }
Adapt the
command
property to point to yourteamscale-cli
executable (bin/teamscale-cli.bat
on Windows,bin/teamscale-cli
on Linux and macOS).Adapt the
args
property so that the--server
option points to your Teamscale server and uses your credentials, i.e., your username and IDE access key. (See the documentation of the command-line client for further ways to supply your credentials.)
Running the task from within VS Code via Terminal > Run Task... > Upload File to Teamscale for Pre-Commit Analysis now opens the Problems panel whenever the file being currently edited contains any findings. You can also assign a keyboard shortcut (opens new window) to this task.
# Sublime Text
To use Teamscale from within Sublime Text (opens new window), peform the following steps:
Add a new build system (Tools > Build System > New Build System...)
Copy (or download) and paste the following snippet in Sublime Text's build-system format (opens new window):
{ "cmd": [ "teamscale-cli/bin/teamscale-cli", "pre-commit", "--server", "https://username:accesskey@example.com/teamscale/", "$file" ], "keyfiles": [ ".teamscale.toml" ] "file_regex": "^(.*):(\\d+):(\\d+):\\s+(?:error|warning):\\s+(.*)$" }
Adapt the
cmd
property to point to yourteamscale-cli
executable (bin/teamscale-cli.bat
on Windows,bin/teamscale-cli
on Linux and macOS).Adapt the
cmd
property so that the--server
option points to your Teamscale server and uses your credentials, i.e., your username and IDE access key. (See the documentation of the command-line client for further ways to supply your credentials.)
Executing a build with the pre-commit build system will now show any findings for the current file.