Comments (6)
Thanks for reporting! I can reproduce the issue and will look into it.
Thanks for this great plugin btw, I cannot live without it now. :D
Great to hear someone's using it in their daily workflow.
from semshi.
Unfortunately this appears to be another bug in Python's ast
module, similar to #31. In this case, in a multi-line f-string, the syntax tree reports incorrect positions on lines beyond the first one.
Code example:
(
f'aaa{foo}bbb'
f'ccc{bar}ddd'
f'eee{baz}fff'
)
Relevant part of the syntax tree:
JoinedStr(
lineno=2,
col_offset=4,
values=[
Str(lineno=2, col_offset=4, s='aaa'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=10, id='foo', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='bbbccc'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=5, id='bar', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='dddcccaaaaaaaaaaaaaa'),
FormattedValue(
lineno=2,
col_offset=4,
value=Name(lineno=2, col_offset=5, id='baz', ctx=Load()),
conversion=-1,
format_spec=None,
),
Str(lineno=2, col_offset=4, s='ddd'),
],
),
The reported position for foo
is correct (2,10), but not for bar
(2,5) and baz
(2,5).
I'm not sure there is an elegant workaround for this, but I'm open for suggestions. Also, I might introduce a switch to disable highlighting in f-strings.
I'll probably add this example to the Python bug report. Let's hope they will patch it at some point.
from semshi.
In my neovim, the color of "Sec
is blue, just as name
. And the length of the blue area is equal to the length of the variable name
, that is, if I rename name
to _name
, the next char, u
, will turn blue.
Hope you can reproduce this on your end.
Thanks for this great plugin btw, I cannot live without it now. :D
from semshi.
I also have the same issue. Seems to me to be the only thing I miss from python-syntax
right now.
from semshi.
Duplicate of #31
from semshi.
The switch would be nice because I'm also having issues with f-strings.
from semshi.
Related Issues (20)
- Disable all syntax coloring expect selection?
- SemshiTextChanged Error when enter completion from compe-nvim in nvim 0.5? HOT 14
- AttributeError: 'NoneType' object has no attribute 'viewport' HOT 1
- How to use semshi in venv? HOT 2
- Semshi enable command not recognised HOT 2
- Highlights out of sync after reloading buffer
- Unresolved Global Yellow Underline When Importing * HOT 1
- Does this work with vim or just neovim? HOT 3
- Semshi produces errors with __future__ annotations HOT 11
- Way to disable syntax error highlighting in insert mode? HOT 2
- `and` and `or` how to highlight? HOT 1
- hi semshiLocal is ineffective at changing the highlight for local variables
- Error detected while processing function <SNR>52_filetype_changed HOT 1
- Any plans to python 3.10 new syntax support? HOT 3
- Is there a license for this project?
- Is there any chance of implementing new tree sitter functionality? HOT 3
- Semshi starts to highlight only after call :PlugInstall HOT 4
- Support for fenced codeblocks in markdown
- Is this repository still actively maintained? HOT 1
- error when using ipdb HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from semshi.