After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 723956 - Highlight PHP and then ignore the PHP sections for highlighting HTML, JavaScript, etc
Highlight PHP and then ignore the PHP sections for highlighting HTML, JavaScr...
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Context engine
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2014-02-09 12:57 UTC by Sébastien Wilmet
Modified: 2019-11-29 17:02 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testcase for PHP highlighting in Script, Style and Attributes. (567 bytes, text/plain)
2014-06-28 19:56 UTC, Lewis Goddard
Details

Description Sébastien Wilmet 2014-02-09 12:57:30 UTC
See https://bugzilla.gnome.org/show_bug.cgi?id=565524#c12

The PHP sections (between <?php and ?>) should be parsed in priority, wherever they occur. And then for the HTML, JavaScript, CSS, etc highlighting, the PHP sections should be completely ignored.

Currently the embedded-lang-hook context must be referenced at a lot of places, and there will always be missing places, where PHP is not highlighted correctly (inside a JavaScript or CSS context for example).

I don't know if the syntax highlighting engine of GtkSourceView is able to do that.
Comment 1 Lewis Goddard 2014-06-28 19:56:03 UTC
Created attachment 279507 [details]
Testcase for PHP highlighting in Script, Style and Attributes.
Comment 2 Sébastien Wilmet 2014-06-28 21:41:33 UTC
I think Bluefish has a better support for PHP/HTML/JavaScript etc. Unfortunately Bluefish doesn't use GtkSourceView.

The implementation of the Bluefish syntax highlighting is described here:
http://oli4444.wordpress.com/2010/08/14/bluefish-editor-widget-design/

If one day Bluefish wants to use GtkSourceView, it should be feasible (but it's a lot of work) to implement a custom engine (see gtksourceengine.h).

In the meantime I think it's better to use Bluefish for web development, it is also based on GTK+ and GtkTextView, and is specialized for web development.
Comment 4 Sébastien Wilmet 2014-09-07 16:25:33 UTC
The GtkSourceView syntax highlighting engine doesn't support that, so it's quite difficult to fix. The syntax highlighting engine needs to be extended. AFAIK, it's not possible to fix this bug only by modifying the XML files describing the syntax of PHP, HTML, etc.

But if Bluefish already ignores PHP sections to highlight the HTML parts, then another solution is to include the syntax highlighting engine of Bluefish into GtkSourceView. With some code refactoring to create utility classes that both engines can use.
Comment 5 Christian Hergert 2019-11-29 16:48:35 UTC
A proposed MR is available here

https://gitlab.gnome.org/GNOME/gtksourceview/merge_requests/110#note_658438