From 84452785889691ab9c63c873a420fa3e303cc1a3 Mon Sep 17 00:00:00 2001 From: Andy Miller Date: Mon, 22 Dec 2025 10:24:39 -0700 Subject: [PATCH] fix(grammar): support bare property declarations at top level Add `#rule-list-innards` to the top-level patterns array to enable proper syntax highlighting for CSS custom properties (variables) when used outside of rule blocks. This fixes an issue where code blocks containing bare CSS variable declarations (e.g., `--my-color: #fff;`) are incorrectly marked as invalid syntax. This is particularly useful for documentation and code examples that show individual property declarations without surrounding selectors. Example that now highlights correctly: ```css --primary-color: #3498db; --secondary-color: rgb(52, 73, 94); color: var(--primary-color); ``` --- grammars/css.cson | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/grammars/css.cson b/grammars/css.cson index 6256e55..6e23e36 100644 --- a/grammars/css.cson +++ b/grammars/css.cson @@ -16,6 +16,10 @@ (?=\\s|:|$) ''' 'patterns': [ + { + # Allow bare property declarations (CSS variables) at top level for code blocks + 'include': '#rule-list-innards' + } { 'include': '#comment-block' }