Sublime Text Integration
Our plugin for Sublime Text 3 enables you to interactively edit, evaluate and hear programs directly in your text editor.
Installation
The plugin is experimental, and the package is not in the Sublime package repository. You can grab the package from the Kronos source tree. You can put these files inside your Sublime Text packages folder in a folder called Kronos
.
Once the plugin is installed, you can open Package Settings
for Kronos
. Please kronos.krpc_path
at the binary for krpc
, the subprocess repl server in the native compiler suite.
{
"kronos.krpc_path": "krpc"
// default values for the runtime library loaded by krpc
// "kronos.core_library_repository": "repository-slug"
// "kronos.core_library_version": "repository-tag"
}
You should probably ignore the commented-out settings for non-standard runtime libraries.
Usage
Syntax highlighting should kick in automatically when you are editing a .k
file. The plugin adds a menu called Kronos
which contains the functions and keyboard shortcuts that operate krpc
.
By selecting the menu item Send to REPL
or by pressing the appropriate shortcut, your selection is sent to the REPL and its output is shown inline, instarepl-style. The selection is expanded to complete lines: if there's no selection, the line the caret is at is evaluated.
You can get sound out similarly to krepl
, by assigning to the special symbol snd
. Alternatively, you can use Instantiate in REPL
, which causes the selected expression to be instantiated as a signal processor. The instarepl bubble in that case has a clickable stop
command.
If you lose track of sounding instances, you can use the Panic!
command which should stop all running instances. Because the plugin is experimental, occasionally you might run into problems; you can restart the REPL with Kill the REPL Process
. Be advised that this loses state, as in the definitions you have sent to the REPL so far.
Language Server
If you have the LSP
package for Sublime Text 3, you can run an experimental language server for Kronos called klangsrv
. You can integrate it with LSP
with settings like this:
{
"only_show_lsp_completions": true,
"clients":
{
"kronos":
{
"command": ["klangsrv"],
"scopes": ["source.kronos"],
"syntaxes": ["Packages/Kronos/Kronos.tmLanguage"],
"languageId": "kronos"
}
}
}
If klangsrv
is not on your system path, edit command
to point at the executable.