Teamscale Integration for Other IDEs and Editors
By using a small command-line client for developers (teamscale-dev) 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.
License Information
The teamscale-dev tool is licensed under the Apache 2.0 License. See the License section for details on licenses of third-party libraries distributed with it.
Installing teamscale-dev
If you haven't done so already, install the teamscale-dev command-line client for Linux, Windows, or macOS.
Configuring Your Projects Using .teamscale.toml Files
Before you can use teamscale-dev, your local projects need 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-dev from Different IDEs or Editors
Sublime Text
To use teamscale-dev conveniently from within Sublime Text, perform 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:
json{ "cmd": [ "teamscale-dev/bin/teamscale-dev", "pre-commit", "--user", "TODO Your username", "--accesskey", "TODO Your access key", "$file" ], "keyfiles": [ ".teamscale.toml" ], "file_regex": "^(.*):(\\d+):(\\d+):\\s+(?:error|warning):\\s+(.*)$" }Adapt the
cmdproperty to point to yourteamscale-devexecutable (bin/teamscale-dev.baton Windows,bin/teamscale-devon Linux and macOS).Adapt the
cmdproperty so that the--userand--accesskeyoptions use your credentials, i.e., your username and 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.
Vim/NeoVim
To use teamscale-dev conveniently from within Vim or NeoVim, we provide integration via a compiler plug-in.
Copy compiler/teamscale.vim to your
$VIMRUNTIME/compilerfolder, e.g.~/.config/nvim/compilerfor NeoVim.In your
.vimrc, you must at least define the variables mentioned in vimrc.vim to let the plug-in know your Teamscale credentials and whereteamscale-devis installed. Optionally, you can use the remaining commands in that file to define a convenient command:Precommitto run pre-commit for the current file and a keyboard mapping. Internally, this command selects Teamscale as the compiler, calls:make %, and then reverts to your previously set compiler to not interrupt your existing compiler/make workflow. Any findings are then shown in the quickfix window (:cw).
If you want pre-commit on-save, you can define a BufWritePost autocommand to call :Precommit whenever the current buffer is written.
XCode
To use teamscale-dev conveniently from within XCode, perform the following steps:
- Configure credentials (This step only needs to be performed once for all your XCode projects.):
- Create a file called
.teamscale-dev.argsin your home directory (i.e.,/Users/<username>/.teamscale-dev.args). - Configure an args file for supplying credentials.
- Create a file called
- Configure XCode project:
- Open your project in XCode.
- Select project in the Project navigator.
- Add new target called
Teamscale Pre-Commit:- In the TARGETS panel, click the + icon.
- Select Other > Aggregate and go to Next.
- Set the name Product Name to
Teamscale Pre-Commit.
- Add a new Run Script phase to the build of the new target:
- Go to the Build Phases tab of the Teamscale Pre-Commit target.
- Add a New Run Script Phase via the + icon in the top left corner.
- Set the Shell command to:shell
teamscale-dev pre-commit @"${HOME}/.teamscale-dev.args" --only-uncommitted-changes "${SRCROOT}"
Once this is configured you can select the Teamscale Pre-Commit target at the top and then run pre-commit by executing the active scheme via the play button at the top. This will execute pre-commit analysis on new or changed files that have not been committed yet.
