Kobo Language Support
Kobo Language Support brings .kobo language support to Visual Studio Code. It starts the Kobo language server to provide semantic syntax highlighting and diagnostics for Kobo source files. The language server reports transform errors in the editor; this extension does not compile or run the generated C#.
Requirements
- Visual Studio Code 1.85 or later
- The .NET 11 runtime
The extension launches the language server with dotnet. If dotnet is not on your PATH, set Kobo: Server Dotnet Path (kobo.server.dotnetPath) to the path of your .NET CLI executable.
Getting started
Open or create a file with the .kobo extension. VS Code activates Kobo language support for that file. Errors reported by the language server appear in the editor and the Problems panel. For server startup or runtime details, open View → Output and select Kobo Language Server.
Language basics
Kobo is a compact, C#-like language that the KoboLang project transforms into C#. A simple file can look like this:
import System
module Example/Math
[public] class:Calculator
{
[public, static] function:int Add(int left, int right)
{
return left + right
}
}
Some core syntax:
- Imports and modules: Write namespace segments with
/, as in import System/Net/Http and module Example/Math.
- Types: Declare types with a colon after the keyword:
class:Name, struct:Name, or interface:Name. Use square brackets for modifiers and attributes, such as [public, abstract].
- Functions: Use
function:<return-type> <name>(<parameters>), for example function:void Print(string message). Put modifiers before function, such as [static].
- Variables and constants: Use
var:Type name = value for an explicitly typed variable, var name = value for an inferred variable, and const:Type name = value for a constant.
- Properties: Use
property:Type Name { get; set; } or an expression-bodied property such as property:int Doubled => Value * 2.
- Lambdas and delegates:
x => x + 1 is a lambda. Delegate types can be written as (int)->int or (string)->void.
- Optional semicolons: Semicolons are generally optional at the end of single-line statements.
Kobo also supports constructs such as generics, trailing-lambda calls, scope(expr) member shorthand, and extension(Type value) blocks. For a fuller language reference and more examples, see the KoboLang repository README.
Developing the extension
From the Kobo.Lang.VSCode directory, run npm install and then npm run package to build the client and package the language server into a VSIX. Packaging requires the .NET 11 SDK.
License
MIT. See LICENSE.txt.