Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,12 @@ jobs:
- name: Generate docs
run: cargo xtask docgen

- name: All highlight queries keys are statically known
run: cargo xtask theme-keys-check

- name: Check uncommitted documentation changes
run: |
git diff
git diff-files --quiet \
|| (echo "Run 'cargo xtask docgen', commit the changes and push again" \
&& exit 1)

203 changes: 203 additions & 0 deletions book/src/generated/theme-table.md

Large diffs are not rendered by default.

171 changes: 4 additions & 167 deletions book/src/themes.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,173 +150,10 @@ We use a similar set of scopes as
[Sublime Text](https://www.sublimetext.com/docs/scope_naming.html). See also
[TextMate](https://macromates.com/manual/en/language_grammars) scopes.

- `attribute` - Class attributes, HTML tag attributes

- `type` - Types
- `builtin` - Primitive types provided by the language (`int`, `usize`)
- `enum`
- `variant`
- `constructor`

- `constant` (TODO: constant.other.placeholder for `%v`)
- `builtin` Special constants provided by the language (`true`, `false`, `nil` etc)
- `boolean`
- `character`
- `escape`
- `numeric` (numbers)
- `integer`
- `float`

- `string` (TODO: string.quoted.{single, double}, string.raw/.unquoted)?
- `regexp` - Regular expressions
- `special`
- `path`
- `url`
- `symbol` - Erlang/Elixir atoms, Ruby symbols, Clojure keywords

- `comment` - Code comments
- `line` - Single line comments (`//`)
- `block` - Block comments (e.g. (`/* */`)
- `documentation` - Documentation comments (e.g. `///` in Rust)

- `variable` - Variables
- `builtin` - Reserved language variables (`self`, `this`, `super`, etc.)
- `parameter` - Function parameters
- `other`
- `member` - Fields of composite data types (e.g. structs, unions)

- `label`

- `punctuation`
- `delimiter` - Commas, colons
- `bracket` - Parentheses, angle brackets, etc.
- `special` - String interpolation brackets.

- `keyword`
- `control`
- `conditional` - `if`, `else`
- `repeat` - `for`, `while`, `loop`
- `import` - `import`, `export`
- `return`
- `exception`
- `operator` - `or`, `in`
- `directive` - Preprocessor directives (`#if` in C)
- `function` - `fn`, `func`
- `storage` - Keywords describing how things are stored
- `type` - The type of something, `class`, `function`, `var`, `let`, etc.
- `modifier` - Storage modifiers like `static`, `mut`, `const`, `ref`, etc.

- `operator` - `||`, `+=`, `>`

- `function`
- `builtin`
- `method`
- `macro`
- `special` (preprocessor in C)

- `tag` - Tags (e.g. `<body>` in HTML)
- `builtin`

- `namespace`

- `special`

- `markup`
- `heading`
- `marker`
- `1`, `2`, `3`, `4`, `5`, `6` - heading text for h1 through h6
- `list`
- `unnumbered`
- `numbered`
- `bold`
- `italic`
- `link`
- `url` - URLs pointed to by links
- `label` - non-URL link references
- `text` - URL and image descriptions in links
- `quote`
- `raw`
- `inline`
- `block`

- `diff` - version control changes
- `plus` - additions
- `minus` - deletions
- `delta` - modifications
- `moved` - renamed or moved files/changes

#### Interface

These scopes are used for theming the editor interface:

- `markup`
- `normal`
- `completion` - for completion doc popup UI
- `hover` - for hover popup UI
- `heading`
- `completion` - for completion doc popup UI
- `hover` - for hover popup UI
- `raw`
- `inline`
- `completion` - for completion doc popup UI
- `hover` - for hover popup UI


| Key | Notes |
| --- | --- |
| `ui.background` | |
| `ui.background.separator` | Picker separator below input line |
| `ui.cursor` | |
| `ui.cursor.normal` | |
| `ui.cursor.insert` | |
| `ui.cursor.select` | |
| `ui.cursor.match` | Matching bracket etc. |
| `ui.cursor.primary` | Cursor with primary selection |
| `ui.cursor.primary.normal` | |
| `ui.cursor.primary.insert` | |
| `ui.cursor.primary.select` | |
| `ui.gutter` | Gutter |
| `ui.gutter.selected` | Gutter for the line the cursor is on |
| `ui.linenr` | Line numbers |
| `ui.linenr.selected` | Line number for the line the cursor is on |
| `ui.statusline` | Statusline |
| `ui.statusline.inactive` | Statusline (unfocused document) |
| `ui.statusline.normal` | Statusline mode during normal mode ([only if `editor.color-modes` is enabled][editor-section]) |
| `ui.statusline.insert` | Statusline mode during insert mode ([only if `editor.color-modes` is enabled][editor-section]) |
| `ui.statusline.select` | Statusline mode during select mode ([only if `editor.color-modes` is enabled][editor-section]) |
| `ui.statusline.separator` | Separator character in statusline |
| `ui.popup` | Documentation popups (e.g. Space + k) |
| `ui.popup.info` | Prompt for multiple key options |
| `ui.window` | Borderlines separating splits |
| `ui.help` | Description box for commands |
| `ui.text` | Command prompts, popup text, etc. |
| `ui.text.focus` | |
| `ui.text.inactive` | Same as `ui.text` but when the text is inactive (e.g. suggestions) |
| `ui.text.info` | The key: command text in `ui.popup.info` boxes |
| `ui.virtual.ruler` | Ruler columns (see the [`editor.rulers` config][editor-section]) |
| `ui.virtual.whitespace` | Visible whitespace characters |
| `ui.virtual.indent-guide` | Vertical indent width guides |
**Note**: not all language keys are applicable to all languages, you can have a look at the `runtime/queries/*/highlights.scm` files to see what is defined or not for your language of choice.

| `ui.virtual.inlay-hint` | Default style for inlay hints of all kinds |
| `ui.virtual.inlay-hint.parameter` | Style for inlay hints of kind `parameter` (LSPs are not required to set a kind) |
| `ui.virtual.inlay-hint.type` | Style for inlay hints of kind `type` (LSPs are not required to set a kind) |
| `ui.virtual.wrap` | Soft-wrap indicator (see the [`editor.soft-wrap` config][editor-section]) |
| `ui.menu` | Code and command completion menus |
| `ui.menu.selected` | Selected autocomplete item |
| `ui.menu.scroll` | `fg` sets thumb color, `bg` sets track color of scrollbar |
| `ui.selection` | For selections in the editing area |
| `ui.selection.primary` | |
| `ui.cursorline.primary` | The line of the primary cursor ([if cursorline is enabled][editor-section]) |
| `ui.cursorline.secondary` | The lines of any other cursors ([if cursorline is enabled][editor-section]) |
| `ui.cursorcolumn.primary` | The column of the primary cursor ([if cursorcolumn is enabled][editor-section]) |
| `ui.cursorcolumn.secondary` | The columns of any other cursors ([if cursorcolumn is enabled][editor-section]) |
| `warning` | Diagnostics warning (gutter) |
| `error` | Diagnostics error (gutter) |
| `info` | Diagnostics info (gutter) |
| `hint` | Diagnostics hint (gutter) |
| `diagnostic` | Diagnostics fallback style (editing area) |
| `diagnostic.hint` | Diagnostics hint (editing area) |
| `diagnostic.info` | Diagnostics info (editing area) |
| `diagnostic.warning` | Diagnostics warning (editing area) |
| `diagnostic.error` | Diagnostics error (editing area) |

[editor-section]: ./configuration.md#editor-section

{{#include generated/theme-table.md}}
4 changes: 2 additions & 2 deletions runtime/queries/bass/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
(list . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))
(cons . (symbol) @function.macro (#match? @function.macro "^(op|fn|current-scope|quote|let|provide|module|or|and|->|curryfn|for|\\$|linux)$"))

(list . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
(cons . (symbol) @keyword.builtin (#match? @keyword.builtin "^(do|doc)$"))
(list . (symbol) @keyword (#match? @keyword "^(do|doc)$"))
(cons . (symbol) @keyword (#match? @keyword "^(do|doc)$"))

(list . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
(cons . (symbol) @keyword.control.import (#match? @keyword.control.import "^(use|import|load)$"))
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/c-sharp/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@

(parameter_list
(parameter
name: (identifier) @parameter))
name: (identifier) @variable.parameter))

(parameter_list
(parameter
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/cairo/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

(comment) @comment

"*" @special
"*" @punctuation.special
(type) @type

[
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/dhall/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

;; Imports
(local_import) @string.special.path
(http_import) @string.special.url
(http_import) @string.special.uri.url
(env_import) @keyword
(env_variable) @string.special
(import_hash) @string.special
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/gdscript/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@

[
"func"
] @keyword.control.function
] @keyword.function

[
"export"
Expand Down
6 changes: 3 additions & 3 deletions runtime/queries/graphql/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@

(string_value) @string

(int_value) @constants.numeric.integer
(int_value) @constant.numeric.integer

(float_value) @constants.numeric.float
(float_value) @constant.numeric.float

(boolean_value) @constants.builtin.boolean
(boolean_value) @constant.builtin.boolean

; Literals
;---------
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/hare/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
";"
] @punctuation.delimiter

"..." @special
"..." @punctuation.special

(comment) @comment

Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/kotlin/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(multi_line_string_literal
"${" @punctuation
(interpolated_expression) @none
"}" @punctuation.)
"}" @punctuation)

; NOTE: `interpolated_identifier`s can be highlighted in any way
(line_string_literal
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/latex/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
path: (curly_group_path) @string)
(biblatex_include
"\\addbibresource" @include
glob: (curly_group_glob_pattern) @string.regex)
glob: (curly_group_glob_pattern) @string.regexp)

(graphics_include
command: _ @keyword.control.import
Expand Down
6 changes: 3 additions & 3 deletions runtime/queries/lean/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"catch"
"finally"
"try"
] @exception
] @keyword.control.exception

((apply
name: (identifier) @exception)
Expand All @@ -186,13 +186,13 @@
"mut"
] @keyword

[(true) (false)] @boolean
[(true) (false)] @constant.builtin.boolean

(number) @constant.numeric.integer
(float) @constant.numeric.float

(comment) @comment
(char) @character
(char) @constant.character
(string) @string
(interpolated_string) @string
; (escape_sequence) @string.escape
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/matlab/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function_name: (identifier) @function

(function_definition end: (end) @keyword)

["return" "break" "continue"] @keyword.return
["return" "break" "continue"] @keyword.control.return

(
(identifier) @constant.builtin
Expand Down
4 changes: 2 additions & 2 deletions runtime/queries/python/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@
"try"
"except"
"finally"
] @keyword.control.except
(raise_statement "from" @keyword.control.except)
] @keyword.control.exception
(raise_statement "from" @keyword.control.exception)
"import" @keyword.control.import

(for_statement "in" @keyword.control)
Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/rust/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@
; Remaining Identifiers
; -------

"?" @special
"?" @punctuation.special

(type_identifier) @type
(identifier) @variable
Expand Down
6 changes: 3 additions & 3 deletions runtime/queries/scheme/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

(list
.
((symbol) @keyword.conditional
(#match? @keyword.conditional "^(if|cond|case|when|unless)$"
((symbol) @keyword.control.conditional
(#match? @keyword.control.conditional "^(if|cond|case|when|unless)$"
)))

(list
Expand Down Expand Up @@ -67,7 +67,7 @@
(list
.
(symbol) @_f
(#eq? @_f "quote")) @string.symbol
(#eq? @_f "quote")) @string.special.symbol

; library

Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/svelte/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
[
"{"
"}"
] @punctuation.brackets
] @punctuation.bracket

"=" @operator

Expand Down
2 changes: 1 addition & 1 deletion runtime/queries/swift/highlights.scm
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
(switch_entry "case" @keyword)
(switch_entry "fallthrough" @keyword)
(switch_entry (default_keyword) @keyword)
"return" @keyword.return
"return" @keyword.control.return
(ternary_expression
["?" ":"] @keyword.control.conditional)

Expand Down
1 change: 1 addition & 0 deletions xtask/src/docgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::fs;

pub const TYPABLE_COMMANDS_MD_OUTPUT: &str = "typable-cmd.md";
pub const LANG_SUPPORT_MD_OUTPUT: &str = "lang-support.md";
pub const THEME_TABLE_MD_OUTPUT: &str = "theme-table.md";

fn md_table_heading(cols: &[String]) -> String {
let mut header = String::new();
Expand Down
Loading