VS Code commands and settings
Every command and setting of the KScript extension for VS Code. Install it with kscript ide install. Everything the editor does as you type, such as completion and quick fixes, comes from the language server in kscript, so other editors get it too: see Editor support.
Commands
Run these from the Command Palette (Ctrl+Shift+P, or Cmd+Shift+P on macOS). In a workspace with several folders, the project commands use the folder of the file you have open, and save its changed files first.
| Command | Key | What it does |
|---|---|---|
| KScript: Open Install Guide | Opens the install guide. It works in an empty window, before KScript is installed. | |
| KScript: Restart Language Server | Restarts the language server, such as after changing a setting. It restarts by itself when kscript is updated. | |
| KScript: Show Language Server Output | Shows the language server's log. Clicking KScript in the status bar does the same. | |
| KScript: Run Script | Ctrl+F5 | Saves the open script and runs it in the terminal. Runtime errors link to the file and line. A new file that hasn't been saved yet runs too. |
| KScript: Debug Script | Saves the open script and runs it in the debugger, stopping at its breakpoints. F5 does the same, and Debug above a script's first line. See Debugging. | |
| KScript: Run Project (main.kscript) | Runs kscript run in the project's folder: its main script (app.main, main.kscript or index.kscript). Run Script does this too when no script is open. | |
| KScript: Run Tests | Runs kscript test for the project in a task. | |
| KScript: Run Tests in This File | Runs the tests in the open test file (*.test.kscript or *.test.ks.xml). Each test is also in the Testing view, where it can run on its own. | |
| KScript: Serve Site | Runs kscript serve in the project's folder. | |
| KScript: Check This File | Saves the open script, runs kscript check on it and lists what it finds in Problems. It works on a file outside a project too. | |
| KScript: Check Project | Runs kscript check on the whole project and lists what it finds in Problems. | |
| KScript: Format Project | Runs kscript fmt on the whole project. | |
| KScript: New Script | Opens a short script that runs as it is, as a place to start. Also in File > New File…. | |
| KScript: New Project… | Asks for a name and a folder, runs kscript make project and offers to open it. | |
| KScript: Open Docs | Runs kscript docs, which opens these docs in your browser. The Open docs link in a hover opens them on what the hover is about. | |
| KScript: Search Docs | Opens the KScript Docs pane in the activity bar, which searches these docs as you type. Click a result to open its page as a tab, with every example runnable. Cmd+click (Ctrl+click) on a built-in such as Shape, echo or ->count shows its docs in a popup at the word instead, with Open full page for the same tab. |
Settings
Change these in VS Code's settings (Ctrl+,), or in .vscode/settings.json for one project. The lint and format rules a project uses are in kscript.json instead, so everyone on the project gets the same ones.
| Setting | Default | What it does |
|---|---|---|
kscript.server.path | empty | The kscript executable that runs the language server. Leave empty to use the installed KScript (~/.kscript/bin, %LOCALAPPDATA%\Programs\kscript, then your PATH). A KScript.dll from a source build also works (run with dotnet). ~ and ${env:NAME} are expanded. |
kscript.server.args | ["lsp"] | Arguments that start the language server. |
kscript.pages.enabled | auto | Check KScript in .html and .md pages (sites run with kscript serve). One of auto (check .html and .md files in folders that look like a kscript serve site (_components/, _layout.html, _layouts/ or kscript.json)), always (always check .html and .md files), never (only check KScript scripts). |
kscript.trace.server | off | Log the messages between VS Code and the language server. One of off, messages, verbose. |
kscript.autoCloseTags | true | Add the end tag when you finish typing a start tag in a .ks.xml script: <echo> becomes <echo></echo>. |
kscript.blocks.dividers | true | Draw a thin line between the top-level blocks of a script (functions, loops and comment-headed sections), like cells in a notebook. |
kscript.problems.workspace | true | List problems for every KScript file in the project, as kscript check reports them, not only for open files. |
kscript.codeLens.enabled | true | Show Run above a script, Run test above each test and how many times each function is used. |