mirror of
https://github.com/neovim/neovim.git
synced 2025-12-11 17:12:40 +00:00
vim-patch:8d8c907: runtime(python): Highlight t-strings
- Highlight t-strings
- Update comments
- Add tests
closes: vim/vim#18679
8d8c9074c3
Co-authored-by: Rob B <github@0x7e.net>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
|
" Maintainer: Zvezdan Petkovic <zpetkovic@acm.org>
|
||||||
" Last Change: 2025 Sep 08
|
" Last Change: 2025 Sep 08
|
||||||
" 2025 Sep 25 by Vim Project: fix wrong type highlighting #18394
|
" 2025 Sep 25 by Vim Project: fix wrong type highlighting #18394
|
||||||
|
" 2025 Dec 03 by Vim Project: highlight t-strings #18679
|
||||||
" Credits: Neil Schemenauer <nas@python.ca>
|
" Credits: Neil Schemenauer <nas@python.ca>
|
||||||
" Dmitry Vasiliev
|
" Dmitry Vasiliev
|
||||||
" Rob B
|
" Rob B
|
||||||
@@ -168,27 +169,29 @@ syn region pythonRawString matchgroup=pythonTripleQuotes
|
|||||||
|
|
||||||
" Formatted string literals (f-strings)
|
" Formatted string literals (f-strings)
|
||||||
" https://docs.python.org/3/reference/lexical_analysis.html#f-strings
|
" https://docs.python.org/3/reference/lexical_analysis.html#f-strings
|
||||||
|
" Template string literals (t-strings)
|
||||||
|
" https://docs.python.org/3/reference/lexical_analysis.html#template-string-literals
|
||||||
syn region pythonFString
|
syn region pythonFString
|
||||||
\ matchgroup=pythonQuotes
|
\ matchgroup=pythonQuotes
|
||||||
\ start=+\cF\z(['"]\)+
|
\ start=+\c[FT]\z(['"]\)+
|
||||||
\ end="\z1"
|
\ end="\z1"
|
||||||
\ skip="\\\\\|\\\z1"
|
\ skip="\\\\\|\\\z1"
|
||||||
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,@Spell
|
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,@Spell
|
||||||
syn region pythonFString
|
syn region pythonFString
|
||||||
\ matchgroup=pythonTripleQuotes
|
\ matchgroup=pythonTripleQuotes
|
||||||
\ start=+\cF\z('''\|"""\)+
|
\ start=+\c[FT]\z('''\|"""\)+
|
||||||
\ end="\z1"
|
\ end="\z1"
|
||||||
\ keepend
|
\ keepend
|
||||||
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell
|
\ contains=pythonFStringField,pythonFStringSkip,pythonEscape,pythonUnicodeEscape,pythonSpaceError,pythonDoctest,@Spell
|
||||||
syn region pythonRawFString
|
syn region pythonRawFString
|
||||||
\ matchgroup=pythonQuotes
|
\ matchgroup=pythonQuotes
|
||||||
\ start=+\c\%(FR\|RF\)\z(['"]\)+
|
\ start=+\c\%([FT]R\|R[FT]\)\z(['"]\)+
|
||||||
\ end="\z1"
|
\ end="\z1"
|
||||||
\ skip="\\\\\|\\\z1"
|
\ skip="\\\\\|\\\z1"
|
||||||
\ contains=pythonFStringField,pythonFStringSkip,@Spell
|
\ contains=pythonFStringField,pythonFStringSkip,@Spell
|
||||||
syn region pythonRawFString
|
syn region pythonRawFString
|
||||||
\ matchgroup=pythonTripleQuotes
|
\ matchgroup=pythonTripleQuotes
|
||||||
\ start=+\c\%(FR\|RF\)\z('''\|"""\)+
|
\ start=+\c\%([FT]R\|R[FT]\)\z('''\|"""\)+
|
||||||
\ end="\z1"
|
\ end="\z1"
|
||||||
\ keepend
|
\ keepend
|
||||||
\ contains=pythonFStringField,pythonFStringSkip,pythonSpaceError,pythonDoctest,@Spell
|
\ contains=pythonFStringField,pythonFStringSkip,pythonSpaceError,pythonDoctest,@Spell
|
||||||
|
|||||||
Reference in New Issue
Block a user