Skip to content
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

Update pygments monkeypatch for compatibility with Pygments 2.0 #6878

Merged
merged 2 commits into from Nov 11, 2014

Conversation

takluyver
Copy link
Member

Closes gh-6877

I spent a while looking for a better way to achive this, to get rid of the monkeypatch, but none occurred to me, so I went with Carlos' suggestion of just updating it.

@ccordoba12
Copy link
Member

I think there's no way out of this one because one of the limitations of the Pygments RegexLexer is that only works on one line at a time. I discovered that while trying to use it to highlight rst files in Spyder.

So +1 from me.

@takluyver
Copy link
Member Author

I think pygments can handle more than one line, the tricky bit here is that the Qt console is only giving us one line at a time. I was looking into whether we could highlight the block as a whole, and concluded that there wasn't an easy way to achieve it.

It's also annoying that Pygments has an ExtendedRegexLexer which does allow this state to be stored externally without a monkeypatch - but only a handful of the lexers inherit from that, so there doesn't seem to be a practical way to use it as we want.

@ccordoba12
Copy link
Member

Ups, sorry. Then the problem is with highlightBlock in Qt. I didn't remember which one was the culprit.

takluyver added a commit that referenced this pull request Nov 11, 2014
Update pygments monkeypatch for compatibility with Pygments 2.0
@takluyver takluyver merged commit b2cf998 into ipython:master Nov 11, 2014
@minrk minrk modified the milestone: 3.0 Nov 14, 2014
@takluyver takluyver modified the milestones: 2.4, 3.0 Nov 19, 2014
@minrk minrk modified the milestones: 2.4, 2.4.1 Feb 9, 2015
minrk added a commit that referenced this pull request Feb 9, 2015
… Pygments 2.0

Closes gh-6877

I spent a while looking for a better way to achive this, to get rid of the monkeypatch, but none occurred to me, so I went with Carlos' suggestion of just updating it.
pankajp pushed a commit to pankajp/pyface that referenced this pull request Mar 20, 2015
Changes same as done in ipython project
ipython/ipython#6878
(IPython's highlighter is same as this)
pankajp pushed a commit to enthought/pyface that referenced this pull request Jul 20, 2015
Changes same as done in ipython project
ipython/ipython#6878
(IPython's highlighter is same as this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Qt console doesn't work with pygments 2.0rc1
4 participants