liuderchi / ide-html

:atom: Atom-IDE for HTML, Go Template, Mustache and other Templates

Home Page:https://atom.io/packages/ide-html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Doesn't play nice with PHP files

mallardduck opened this issue · comments

commented

Description

When this package is enabled it overrides the outline view for PHP based files. Sometimes this is ok, when the PHP file is mostly HTML with inlined PHP (i.e. WordPress template files).

However, it outright breaks PHP files that are only PHP. So when working on PHP package development ide-html would have to be disabled. For PHP classes such as SslCertificate.php it just shows a single item ? and overrides ide-php or orther php parsers for Atom.

Expected Behavior

For PHP files that are mostly HTML with inline PHP, it would be best for the outline to just show something like <?php indicating that there's a block of php code. Basing the depth on the surrounding HTML.

For PHP files that are only PHP code - ideally the outline will just come from the ide-php or ide-seranata package and not be affected by the this one.

Visual Examples:
The real outline of an all PHP walker-nav file:
walker-nav-real-outline

And a mock up of the mostly HTML template file:
screen shot 2019-01-28 at 7 38 11 am
Note: Image adjusted to 'fix' the current issue being described.

Actual Behavior

See images here:

This an all PHP file, same one as above:
walker-nav-outline

And this is from the common header.php file for wordpress themes:
screen shot 2019-01-28 at 7 34 31 am
The only issue being that the PHP tags included add artficial depth to the a.brand-text tag. And that they could potentially be better represented by <?php rather than ?.

Possible Fix

Make PHP an optional extension to outline for - or improve interop with other ide-* parsers though that may not be as realistic. I'm not very familiar with Atom APIs so I'm not sure if such interop is possible.

Steps to Reproduce

  1. Have ide-html enabled.
  2. Open a .php file
  3. Try to use outline.

Context

In order to properly debug real PHP files of any type I have to disable ide-html. Even in the PHP packages I maintain such as mallardduck/ssl-certificate.

Your Environment

commented

Just realized that the mockup I created didn't actually get uploaded correctly. I'll try to dig up the correct file and replace the image.

commented

OP comment updated with new images for WordPress header.php examples.