-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing the f-prefix on an f-string is hard to notice #65
Comments
I've had the same issue from time to time, so this would be a nice improvement. PR is welcome. |
Since I never use syn match pythonStrFormatNotFString "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonString
hi pythonStrFormatNotFString ctermbg=88 ctermfg=225 guibg=#870000 guifg=#ffd7ff
syn match pythonStrFormatRawString "{\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)\=\%(\.\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\[\%(\d\+\|[^!:\}]\+\)\]\)*\%(![rsa]\)\=\%(:\%({\%(\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*\|\d\+\)}\|\%([^}]\=[<>=^]\)\=[ +-]\=#\=0\=\d*,\=\%(\.\d\+\)\=[bcdeEfFgGnosxX%]\=\)\=\)\=}" contained containedin=pythonRawString
hi pythonStrFormatRawString ctermbg=94 ctermfg=229 guibg=#875f00 guifg=#ffffaf It's just copying the original |
is this solved or being worked on? |
I would consider looking at nvim that has treesitter integration natively. It doesn't have this issue. |
Related: #95 |
As python 3.6 gave us f-strings it's I've been using them more over the ol'
.format()
syntax.Sadly, the syntax is highlighting strings that have curly braces but have neither f-string prefix or
.format
suffix.The third statement (
"{hello}"
) shouldn't show the curly brace because that is not doing anything fancy with the string. It's just a string.This might lead me as a developer to miss putting the f-prefix before a string, as the curly braces are giving an indication that they are treated as some sort of templates.
Any thoughts on this?
The text was updated successfully, but these errors were encountered: