o
odinpkg.dev
packages / library / odin-lang-template

odin-lang-template

830f986library

Odin language template

BSD-3-Clause · updated 2 years ago

odin-lang-template

Odin language template

Features

Editor Configuration

Editor configuration for Sublime Text

Build

Contents of %APPDATA%\Sublime Text\Packages\User\Odin.sublime-build

{
	"selector": "source.odin",
	"file_regex": "^(.+)\\(([0-9]+):([0-9]+)\\) (.+)$",
	"file_patterns": ["*.odin"],
	"shell_cmd": ["odin check ."],
	"variants": [
		// build 
		{"name":"build", "shell_cmd":"odin build ."},
		// check
		{"name":"check", "shell_cmd":"odin check ."},
		// run
		{"name":"run", "shell_cmd":"odin run ."},
		// test
		{"name":"test", "shell_cmd":"odin test ."},
	]
}

LSP

Contents of %APPDATA%\Sublime Text\Packages\User\LSP.sublime-settings

// Settings in here override those in "LSP/LSP.sublime-settings"
{
	"clients": {
		"odin": {
			"command": [
				"C:\\path\\ols\\ols.exe"
			],
			"enabled": false, // true for globally-enabled, but not required due to 'Enable In Project' command
			"selector": "source.odin",
			"initializationOptions": {
				"enable_semantic_tokens": true,
				"enable_document_symbols": true,
				"enable_hover": true,
				"enable_snippets": true,
				"enable_format": true,
			}
		}
	}
}

Set ODIN_ROOT environment variable to path of Odin directory (which contains core and vendor libraries).

# from Windows cmd prompt
rundll32 sysdm.cpl,EditEnvironmentVariables

Sources