Add syntax highlighting for .env files

This commit is contained in:
ema
2025-07-10 06:46:54 +08:00
parent b27ff01eff
commit 8dcb09cf84
2 changed files with 150 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<SyntaxDefinition name="ENV" extensions=".env;.env.local;.env.development;.env.production;.env.test;.env.example">
<Environment>
<Default color="#D4D4D4" bgcolor="#1E1E1E"/>
</Environment>
<Properties>
<Property name="LineComment" value="#"/>
</Properties>
<Digits name="Digits" color="#B5CEA8"/>
<RuleSets>
<RuleSet ignorecase="false">
<Delimiters>&amp;|\/"',;=:-</Delimiters>
<!-- Comments starting with # -->
<Span name="LineComment" stopateol="true" color="#608B4E" bold="false" italic="true">
<Begin>#</Begin>
</Span>
<!-- Double quoted strings with escape character support -->
<Span name="DoubleQuotedString" stopateol="true" color="#CE9178" bold="false" italic="false" escapecharacter="\">
<Begin>"</Begin>
<End>"</End>
</Span>
<!-- Single quoted strings -->
<Span name="SingleQuotedString" stopateol="true" color="#CE9178" bold="false" italic="false">
<Begin>'</Begin>
<End>'</End>
</Span>
<!-- Variable expansion ${VAR} or $VAR -->
<Span name="VariableExpansion" color="#DCDCAA" bold="true" italic="false">
<Begin>${</Begin>
<End>}</End>
</Span>
<!-- Environment variable names (before =) -->
<MarkPrevious color="#4FC1FF" bold="true" italic="false">=</MarkPrevious>
<!-- Simple variable reference $VAR -->
<MarkFollowing color="#DCDCAA" bold="true" italic="false">$</MarkFollowing>
<!-- Boolean values -->
<KeyWords name="BooleanValues" color="#569CD6" bold="true" italic="false">
<Key word="true"/>
<Key word="false"/>
<Key word="TRUE"/>
<Key word="FALSE"/>
<Key word="yes"/>
<Key word="no"/>
<Key word="YES"/>
<Key word="NO"/>
<Key word="on"/>
<Key word="off"/>
<Key word="ON"/>
<Key word="OFF"/>
</KeyWords>
<!-- null values -->
<KeyWords name="NullValues" color="#569CD6" bold="true" italic="false">
<Key word="null"/>
<Key word="NULL"/>
<Key word="nil"/>
<Key word="NIL"/>
</KeyWords>
</RuleSet>
</RuleSets>
</SyntaxDefinition>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<SyntaxDefinition name="ENV" extensions=".env;.env.local;.env.development;.env.production;.env.test;.env.example">
<Environment>
<Default color="#000000" bgcolor="#FFFFFF"/>
</Environment>
<Properties>
<Property name="LineComment" value="#"/>
</Properties>
<Digits name="Digits" color="#098658"/>
<RuleSets>
<RuleSet ignorecase="false">
<Delimiters>&amp;|\/"',;=:-</Delimiters>
<!-- Comments starting with # -->
<Span name="LineComment" stopateol="true" color="#008000" bold="false" italic="true">
<Begin>#</Begin>
</Span>
<!-- Double quoted strings with escape character support -->
<Span name="DoubleQuotedString" stopateol="true" color="#A31515" bold="false" italic="false" escapecharacter="\">
<Begin>"</Begin>
<End>"</End>
</Span>
<!-- Single quoted strings -->
<Span name="SingleQuotedString" stopateol="true" color="#A31515" bold="false" italic="false">
<Begin>'</Begin>
<End>'</End>
</Span>
<!-- Variable expansion ${VAR} or $VAR -->
<Span name="VariableExpansion" color="#795E26" bold="true" italic="false">
<Begin>${</Begin>
<End>}</End>
</Span>
<!-- Environment variable names (before =) -->
<MarkPrevious color="#0000FF" bold="true" italic="false">=</MarkPrevious>
<!-- Simple variable reference $VAR -->
<MarkFollowing color="#795E26" bold="true" italic="false">$</MarkFollowing>
<!-- Boolean values -->
<KeyWords name="BooleanValues" color="#0000FF" bold="true" italic="false">
<Key word="true"/>
<Key word="false"/>
<Key word="TRUE"/>
<Key word="FALSE"/>
<Key word="yes"/>
<Key word="no"/>
<Key word="YES"/>
<Key word="NO"/>
<Key word="on"/>
<Key word="off"/>
<Key word="ON"/>
<Key word="OFF"/>
</KeyWords>
<!-- null values -->
<KeyWords name="NullValues" color="#0000FF" bold="true" italic="false">
<Key word="null"/>
<Key word="NULL"/>
<Key word="nil"/>
<Key word="NIL"/>
</KeyWords>
</RuleSet>
</RuleSets>
</SyntaxDefinition>