kOS Syntax for VS Code
This plugin enables syntax highlighting for kOS scripts .ks
in Visual Studio Code.
It leverages whatever VS Code theme you have enabled, so it should work with any theme you choose.
For a version of Visual Studio Code without Microsoft's telemetry, you can check out VSCodium.
Installation
Using the Visual Studio Code Marketplace:
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X
(or Cmd + Shift + X
on macOS).
- Search for
kOS Syntax Highlighting | Kerbal Space Program
.
- Click Install.
You can also find the extension on the Visual Studio Marketplace
Manual Installation:
- Download the latest release from the releases page
- Open Visual Studio Code.
- Go to the Extensions view by clicking on the Extensions icon in the Activity Bar on the side of the window or by pressing
Ctrl+Shift+X
(or Cmd + Shift + X
on macOS).
- Click on the
...
menu in the top right corner of the Extensions view and select Install from VSIX....
- Select the
.vsix
file you downloaded.
- Click Install.
Previews:
Will be added soon.
Custom Colors
If you want to customise the colours for a specific kOS syntax scope, here's how you can do it:
Open VS Code.
Find the Scope Name:
- Open the
kos.tmLanguage.json
file.
- Press
Ctrl + F
and search for the keyword you want to colour.
- Copy the scope name (e.g.,
support.function.kos
) directly above the keyword.
Open the VS Code Settings JSON file:
- In VS Code, Press
Ctrl + Shift + P
(or Cmd + Shift + P
on macOS) and type Preferences: Open Settings (JSON)
.
Add the following configuration to your settings.json
file:
{
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "support.function.kos",
"settings": {
"foreground": "#FF0000" // Replace with your desired color
}
}, //<-- Remove this comma if it's the last item in the list
]
}
}
Replace the scope
and foreground
values:
- Use the scope name you copied from the
kos.tmLanguage.json
file.
- Replace the
foreground
value with your desired colour.
Save the settings.json
file.
How to Build
You will need to have Node.js installed to build this extension.
If you have to install Node.js, you can download it from the official website. This may require a restart of your computer to add the node
and npm
commands to your PATH. If you can't see the node
and npm
commands in your terminal, try restarting your computer.
You can build the VSIX file for this extension using the vsce
package. Here's how to do it:
Install vsce
:
npm install -g vsce
Navigate to the VS Code Folder:
It should be the folder that contains the Package.json
folder.
cd path\to\VSCode
cd path/to/VSCode
Build the VSIX File:
vsce package
This should output a VSIX file in the root of the project folder, from which you can install the extension manually.