Both Lua and Typescript strategy scripts are linted and tested to perform some basic validity and style checks. For Lua, linting is done by luacheck, for Typescript by eslint. python2 is required for some additional checks.
To run the unit tests and linter, execute the following in your build folder
make check
Typescript linting is done with a project local installation of eslint. IntelliSense is provided by tsserver.
To make use of those, you first need to install npm which is usually distributed
alongside NodeJS. On most modern Linux Systems, it should
be possible to insall it with your distributions respective package manager. If
you choose to install it manually, it is necessary to add Node's binary
folder to your PATH
.
- Linux & MacOS: Run the
install_typescript_language_tools.sh
script located atdata/scripts
Windows:
- Open a Command Line and change directory to
strategy/typescript
- Run
npm install
- Copy the contents of
libs/tsc/built/local
tostrategy/typescript/node_modules/typescript/lib
and overwrite the existing files
Visual Studio Code has a Typescript plugin installed by default.
If you make sure to open the strategy/typescript
folder (not the base
software
folder) in VS Code, it should automatically use the project-local
node_modules
folder. You can verify this, check the Microsoft docs
If not you can change the TypeScript version by clicking on the curly braces
next to the "TypeScript" Button on the bottom left. Click on it then click
select version and select the workspace version.
There are multiple plugins providing language server integration for Vim but I use and recommend coc.nvim
. For the setup:
- Install
coc.nvim
- Run
:CocInstall coc-tsserver coc-json
- (optional) If coc-tsserver detects a global installation of TypeScript it will use that first, but that can be avoided by setting "tsserver.useLocalTsdk": true in the coc settings (which can be easily accessed with the :CocConfig command)
- Install the typescript-language-server in a way that it's in your PATH. Recommended: npm install -g typescript typescript-language-server The global TypeScript installation is required here, but it's automatically in the PATH. Alternatively install the language server locally: npm install typescript-language-server and add the local strategy/typescript/node_modules/.bin/ to your PATH.
- Add a config file under strategy/typescript/.helix/languages.toml with the following contents: [[language]] name = "typescript" config = { tsserver = { "path" = "node_modules/.bin/tsserver" } } but use the absolute path of the node_modules, e.g. "/home/user/robotics/software/strategy/typescript/node_modules/.bin/tsserver"
Install according to the following platform dependent instructions. Alternatively, the source files are available at https://github.com/mpeterv/luacheck .
Install luarocks and use it to install luacheck
sudo apt-get install luarocks
sudo luarocks install luacheck
On Ubuntu 14.04 it may be necessary to use
luacheck -q **/*.lua
Install luarocks and use it to install luacheck
brew install lua
luarocks install luacheck
- Download the prebuilt luacheck package from https://www.robotics-erlangen.de/downloads/libraries/luacheck-0.18.7z .
- Extract the contained luacheck folder and move it to
%APPDATA%
(enter path in Explorer). The luacheck.bat in the bin folder should now be located at<USER>\AppData\Roaming\luacheck\bin\luacheck.bat
. - Open the Control Panel (Systemsteuerung), open User Account (Benutzerkonten), then Change own Environment Variables.
Add to User variables:
PATH
=%APPDATA%\luacheck\bin
(Fertiges Ra für Windows unter: https://project.robotics-erlangen.de/robocup/software/wikis/ra-builds )
Install the linter-luacheck package.
Install Package Control. Then use it to install
- SublimeLinter
- SublimeLinter-luacheck