cw-lsp is a browser-side extension (implemented as a Tampermonkey userscript) that turns Codewars code editors into Language Server Protocol clients and enriches them with some basic IDE-like functionality. It currently supports:
- Language Server Protocol features: code completions, callable signatures, code diagnostics, documentation;
- Languages: JavaScript, Python, PHP, Rust;
- Codewars editors: currently, the only supported editor is the Solution editor in kata trainer.
To use code completion when training on a Codewars kata, only the client userscript is required:
- Install Tampermonkey extension for your browser.
- Install the user script with client side implementation. It can be found in
client/cw-lsp.user.js, and installed by clicking this link. Read TamperMonkey FAQ for help. Remember about enabling userscript permissions and/or Development Mode if your browser requires it! - Open kata trainer for one of supported languages.
- Start typing code in the
Solutioneditor. Use one of following key combinations:Shift-Spaceto trigger completion suggestions.Alt-Ato trigger signature hints.Alt-Hto present documentation help.
- Click the blue
LSPbutton to show or hide the floating LSP panel. The panel can be moved around and resized, and it will remember its position.
cw-lspcan see only code from the user solution editor in the kata trainer. It does not work in other code editors (sample tests, translations, kata editor), and it does not see code from preloaded snippet. If user solution references symbols from preloaded,cw-lspwill not see them, and can report errors related to them.- Currently, backend LSP process shuts down after 30 minutes of inactivity. It can be restarted by hard reload of the kata trainer.
- PHP: Snippets must start with
<?phpdirective. Old kata may be missing the directive in the solution setup, and it has to be added manually for LSP to work correctly. - Rust: Startup of language servers for Rust can take some time. Usually, it is ~10-20 seconds until it starts returning completion suggestions. Until the language server fully initializes, it may return no responses, or incomplete responses. It can also feel sluggish and responses can be returned with a noticeable delay. Readiness of Rust Analyzer can be roughly estimated by tracking the "Initializing" progress message in the log panel, and waiting until it gets marked with a green check mark.
Server does not have to be run locally to use cw-lsp. Client script is configured to use a publicly available service. However, anyone who wants to run it locally to get more resources for their language server, tinker with backend, or run it for development purposes, can follow instructions below.
With npm:
npm ci
npm run buildWith Docker:
docker build -t cw-lsp-app .With npm:
# make sure that LSP_TEMPLATES_DIR is set
npm startWith Docker:
docker run -p 3000:3000 cw-lsp-appcw-lsp is an experimental tool under active development.
- Features, behavior, and supported languages may change at any time.
- Backward compatibility is not guaranteed.
- The publicly available server is provided on a best-effort basis, has limited capacity, and may be unavailable, slow, or reset without notice.
- No uptime, performance, or data persistence guarantees are provided.
Use the tool with the expectation that occasional breakage or downtime may occur.