GitGutter: Diff Popup code highlight not working in PHP file

Diff Popup shows plain code without highlight in PHP file

This may be caused by PHP syntax need <?php to work.

When modified part contains <?php at first line, Diff Popup code highlight works like normal

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

mdpopups provides code highlighting out of the box. Therefore source which is known by mdpopups is highlighted in the diff popup as well as it is automatically put into a <div class=highlight> tag. To do that mdpopups relies on two methods. The legacy one uses pygments and the one we were discussing about here is to use an output_panel of ST to put the snippet into, apply the correct syntax and read out the highlighted code as html. It works quite well for known syntaxes if you set "mdpopups.use_sublime_highlighter": true

The only drawback is what the initial post intends to state. Some syntaxes rely on contexts, which might not be part of the code snippet which is to be displayed in the popup. Therefore highlighting fails.

So we made up our mind how to possibly solve this issue with the existing techniques and strategies being in use already.

There is no concrete plan to implement it at the moment. See mdpopups issues … it’s low priority and more or less a kind of study.

It will not become part of GitGutter if it will create any performance hit or comes with other possible side effects. I already did a lot of studies which have been dismissed without even proposing them due to too many disadvantages. 😉

A absolutely agree with you not to bloat the packages or create any cross references between packages or even fight against the core API. We’ll just need to have a short look into the forum to see what it results in after a bigger update. Several such proposals were already declined.

Any of such a bigger change will be proposed as a PR with the chance to discuss or decline it.