Skip to content

New Command⚓︎

The New Command command allows developer to add commands to the Live Command Palette which may be committed along with the source code and shared and used by other developers.

Parameters⚓︎

  • name: The name of the command.

Usage⚓︎

1
new command hello world

Example: new command hello world⚓︎

File path: .spp/commands/hello-world.kts

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
import spp.plugin.*
import spp.command.*
import spp.jetbrains.sourcemarker.PluginUI.*

class HelloWorldCommand : LiveCommand() {
    override val name = "hello-world"
    override val description = "<html><span style=\"color: ${getCommandTypeColor()}\">" +
            "My custom live command" + "</span></html>"

    override fun trigger(context: LiveCommandContext) {
        show("Hello world")
    }
}

registerCommand(HelloWorldCommand())

Last update: July 11, 2022