Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SCSS language support #3074

Merged
merged 7 commits into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
| rust | ✓ | ✓ | ✓ | `rust-analyzer` |
| scala | ✓ | | ✓ | `metals` |
| scheme | ✓ | | | |
| scss | ✓ | | | `vscode-css-language-server` |
| solidity | ✓ | | | `solc` |
| sql | ✓ | | | |
| sshclientconfig | ✓ | | | |
Expand Down
13 changes: 13 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ indent = { tab-width = 2, unit = " " }
name = "css"
source = { git = "https://github.com/tree-sitter/tree-sitter-css", rev = "94e10230939e702b4fa3fa2cb5c3bc7173b95d07" }

[[grammar]]
name = "scss"
source = { git = "https://github.com/serenadeai/tree-sitter-scss.git", rev = "c478c6868648eff49eb04a4df90d703dc45b312a" }
jharrilim marked this conversation as resolved.
Show resolved Hide resolved

[[language]]
name = "scss"
scope = "source.scss"
injection-regex = "scss"
file-types = ["scss"]
roots = []
language-server = { command = "vscode-css-language-server", args = ["--stdio"] }
indent = { tab-width = 2, unit = " " }

[[language]]
name = "html"
scope = "text.html.basic"
Expand Down
89 changes: 89 additions & 0 deletions runtime/queries/scss/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
(comment) @comment

(tag_name) @tag
(nesting_selector) @tag
(universal_selector) @tag

"~" @operator
">" @operator
"+" @operator
"-" @operator
"*" @operator
"/" @operator
"=" @operator
"^=" @operator
"|=" @operator
"~=" @operator
"$=" @operator
"*=" @operator

"in" @operator
"and" @operator
"or" @operator
"not" @operator
"only" @operator

(attribute_selector (plain_value) @string)
(pseudo_element_selector (tag_name) @attribute)
(pseudo_class_selector (class_name) @attribute)

(identifier) @variable
(class_name) @variable
(id_name) @variable
(namespace_name) @variable
(property_name) @variable.other.member
(feature_name) @variable
(variable) @variable
(variable_name) @variable.other.member
(variable_value) @variable.other.member
(argument_name) @variable.parameter
(selectors) @variable.other.member

(attribute_name) @attribute

(function_name) @function

((property_name) @variable
(match? @variable "^--"))
((plain_value) @variable
(match? @variable "^--"))
jharrilim marked this conversation as resolved.
Show resolved Hide resolved



(to) @keyword
(from) @keyword
(important) @keyword

(string_value) @string
(color_value) @string.special

(integer_value) @number
(float_value) @number
jharrilim marked this conversation as resolved.
Show resolved Hide resolved
(unit) @type

"@apply" @constant.builtin
"@at-root" @constant.builtin
"@charset" @constant.builtin
"@debug" @constant.builtin
"@each" @keyword.control.repeat
"@else" @keyword.control.conditional
"@error" @constant.builtin
"@extend" @constant.builtin
"@for" @keyword.control.repeat
"@forward" @keyword.control.import
"@function" @function.method
"@if" @keyword.control.conditional
"@import" @keyword.control.import
"@include" @keyword.control.import
"@keyframes" @constant.builtin
"@media" @constant.builtin
"@mixin" @constant.builtin
"@namespace" @namespace
"@return" @keyword.control.return
"@supports" @constant.builtin
"@use" @keyword.control.import
"@warn" @constant.builtin
"@while" @keyword.control.repeat

"#" @punctuation.delimiter
"," @punctuation.delimiter
2 changes: 2 additions & 0 deletions runtime/queries/scss/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))