slint/tools/lsp/sublime/SixtyFPS.sublime-syntax
Jocelyn Turcotte 0292afa325 LSP Sublime Text: Fix '%YAML indicator is required'
This only happened to me on Linux yet for some reason, but
moving the %YAML indicator to the first line above the license
header fixed it.
2021-09-11 17:20:18 +02:00

109 lines
3.3 KiB
YAML

%YAML 1.2
---
# LICENSE BEGIN
# This file is part of the SixtyFPS Project -- https://sixtyfps.io
# Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
# Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
#
# SPDX-License-Identifier: GPL-3.0-only
# This file is also available under commercial licensing terms.
# Please contact info@sixtyfps.io for more information.
# LICENSE END
# See http://www.sublimetext.com/docs/3/syntax.html
name: SixtyFPS
file_extensions:
- '60'
scope: source.sixtyfps
contexts:
# The prototype context is prepended to all contexts but those setting
# meta_include_prototype: false.
prototype:
- include: comments
main:
# The main context is the initial starting point of our syntax.
# Include other contexts from here (or specify them directly).
- include: property
- include: color
- include: types
- include: constants
- include: keywords
- include: numbers
- include: symbols
- include: strings
property:
- match: '[a-zA-Z_][a-zA-Z_\-0-9]*:'
scope: variable.sixtyfps
- match: '[a-zA-Z_][a-zA-Z_\-0-9]* *<?=>'
scope: variable.sixtyfps
color:
- match: '#[0-9a-fA-F]+'
scope: constant.other.color.sixtyfps
types:
- match: '\b(int|float|duration|string|image|brush|color|length|logical_length)\b'
scope: storage.type.sixtyfps
constants:
- match: '\b(blue|red|green|yellow|red|black|ease|ease_in|ease_out|ease_in_out)\b'
scope: support.constant.sixtyfps
keywords:
# Note that blackslashes don't need to be escaped within single quoted
# strings in YAML. When using single quoted strings, only single quotes
# need to be escaped: this is done by using two single quotes next to each
# other.
- match: '\b(import|from)\b'
scope: keyword.sixtyfps
- match: '\b(property|callback|animate|states|transitions)\b'
scope: keyword.other.sixtyfps
- match: '\b(if|for|return)\b'
scope: keyword.control.sixtyfps
numbers:
- match: '\b[0-9]+\.?[0-9]*[a-z%]*\b'
scope: constant.numeric.sixtyfps
symbols:
- match: '[\!\&\|]+'
scope: keyword.operator.logical.sixtyfps
- match: '[\<\=\>]+'
scope: keyword.operator.comparison.sixtyfps
- match: '[\:\<\=\>]+'
scope: keyword.operator.assignment.sixtyfps
- match: '[\!\%\&\(\)\+\,\-\/\*\<\=\>\?\[\]\|\;]+'
scope: keyword.operator.sixtyfps
strings:
# Strings begin and end with quotes, and use backslashes as an escape
# character.
- match: '"'
scope: punctuation.definition.string.begin.sixtyfps
push: inside_string
inside_string:
- meta_include_prototype: false
- meta_scope: string.quoted.double.sixtyfps
- match: '\.'
scope: constant.character.escape.sixtyfps
- match: '"'
scope: punctuation.definition.string.end.sixtyfps
pop: true
comments:
# Comments begin with a '//' and finish at the end of the line.
- match: '//'
scope: punctuation.definition.comment.sixtyfps
push:
# This is an anonymous context push for brevity.
- meta_scope: comment.line.double-slash.sixtyfps
- match: $\n?
pop: true
- match: '/\*'
push:
- meta_scope: comment.line
- match: '\*/'
pop: true