Skip to content

Commit 3c453b3

Browse files
SimonSapinalexcrichton
authored andcommitted
Gedit/gtksourceview language spec: add raw strings
… and color (raw) strings as such in attributes. This fixes cases where a string contains ] inside an attribute: that ] used to incorrectly end the attribute coloring. For large (many lines) doc comments, I’ve found preferable to use `#![doc = r#"..."#]` to avoid prefixing every line with `//!`.
1 parent 02d12e5 commit 3c453b3

File tree

1 file changed

+11
-0
lines changed
  • src/etc/gedit/share/gtksourceview-3.0/language-specs

1 file changed

+11
-0
lines changed

src/etc/gedit/share/gtksourceview-3.0/language-specs/rust.lang

+11
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,14 @@
269269
<match>\\\%{common_escape}</match>
270270
</context>
271271

272+
<context id="raw-string" style-ref="string" class="string" class-disabled="no-spell-check">
273+
<start>r(#*)"</start>
274+
<end>"\%{1@start}</end>
275+
<include>
276+
<context ref="def:line-continue"/>
277+
</include>
278+
</context>
279+
272280
<context id="string" style-ref="string" class="string" class-disabled="no-spell-check">
273281
<start>"</start>
274282
<end>"</end>
@@ -287,6 +295,8 @@
287295
<end>\]</end>
288296
<include>
289297
<context ref="def:in-comment"/>
298+
<context ref="string"/>
299+
<context ref="raw-string"/>
290300
</include>
291301
</context>
292302

@@ -305,6 +315,7 @@
305315
<context ref="number"/>
306316
<context ref="scope"/>
307317
<context ref="string"/>
318+
<context ref="raw-string"/>
308319
<context ref="char"/>
309320
<context ref="lifetime"/>
310321
<context ref="attribute"/>

0 commit comments

Comments
 (0)