-- lx format
local format = require("core.format")

format.register({
	name = "Sass Style Sheet",
	shortname = "Sass",
	author = "liqube",
	extensions = { "scss", "sass" },

	patterns = {
		{ pattern = "\\.", type = "normal" },
		{ pattern = "//.-\n", type = "comment" },
		{ pattern = { "/%*", "%*/" }, type = "comment" },
		{ pattern = { '"', '"', "\\" }, type = "string" },
		{ pattern = { "'", "'", "\\" }, type = "string" },
		{ pattern = "$[%a_][%w_-]*", type = "keyword2" },
		{ pattern = "[%a][%w-]*%s*%f[:]", type = "keyword" },
		{ pattern = "#%x+", type = "string" },
		{ pattern = "-?%d+[%d%.]*p[xt]", type = "number" },
		{ pattern = "-?%d+[%d%.]*deg", type = "number" },
		{ pattern = "-?%d+[%d%.]*", type = "number" },
		{ pattern = "[%a_][%w_]*", type = "symbol" },
		{ pattern = "#[%a][%w_-]*", type = "keyword2" },
		{ pattern = "@[%a][%w_-]*", type = "keyword2" },
		{ pattern = "%.[%a][%w_-]*", type = "keyword2" },
		{ pattern = "[{}:;,]", type = "operator" },
	},

	outline_patterns = {
		{ pattern = "%s*[^@%s][^\n{}]-{%s*$", line_start = true },
		{ pattern = "%s*@[^{\n]-{%s*$", line_start = true },
	},

	symbols = {
		["@at-root"] = "keyword2",
		["@content"] = "keyword2",
		["@debug"] = "keyword2",
		["@each"] = "keyword2",
		["@else"] = "keyword2",
		["@error"] = "keyword2",
		["@extend"] = "keyword2",
		["@for"] = "keyword2",
		["@forward"] = "keyword2",
		["@function"] = "keyword2",
		["@if"] = "keyword2",
		["@import"] = "keyword2",
		["@include"] = "keyword2",
		["@media"] = "keyword2",
		["@mixin"] = "keyword2",
		["@return"] = "keyword2",
		["@supports"] = "keyword2",
		["@use"] = "keyword2",
		["@warn"] = "keyword2",

		["align-items"] = "keyword",
		["background"] = "keyword",
		["border"] = "keyword",
		["color"] = "keyword",
		["display"] = "keyword",
		["flex"] = "keyword",
		["font-size"] = "keyword",
		["gap"] = "keyword",
		["height"] = "keyword",
		["margin"] = "keyword",
		["padding"] = "keyword",
		["position"] = "keyword",
		["transform"] = "keyword",
		["transition"] = "keyword",
		["width"] = "keyword",
		["z-index"] = "keyword",
	},
})
