bsegraves / custom-folds

Atom plugin for defining custom markers for foldable regions.
MIT License
24 stars 9 forks source link

Doesn't fold inside <?php ?> tags #42

Open vadim-on-github opened 6 years ago

vadim-on-github commented 6 years ago

Works like a charm in JS files though. Thanks for the great plugin!

theking2 commented 6 years ago

this would be great for PHP as well certainly when writing large object libraries. Assuming it is nothing more than adding an extension, could someone enlighten me where to do this?

legoktm commented 6 years ago

I'm using Atom 1.30.0, and this plugin worked fine in my PHP project.

theking2 commented 6 years ago

I'm using Atom 1.30.0 x64 with custom-folds 1.9.5 and it doesn't offer collapsing of <editor-fold ... marked areas.

bsegraves commented 6 years ago

Works fine for me using Atom 1.30.0 on a PHP file. Does Atom recognize your file as PHP?

image

If you're still having issues, can you post an example file that I can test with?

vadim-on-github commented 6 years ago

@bsegraves yes, it certainly does

php

js

vadim-on-github commented 6 years ago

@bsegraves ouuu, i did just notice that it works with a different kind of comment in a PHP file lol definitely would be great if it worked with both :)

php2

bsegraves commented 6 years ago

lol, glad to hear it.

By the way, you can go into the settings and change the prefix to be whatever you want.

vadim-on-github commented 6 years ago

@bsegraves so what I thought might've been a bug turned into a feature request. Do you think you'd want to make it into a new feature in the future (to be able to fold with different kinds of comments in the same file)?

bsegraves commented 6 years ago

Unless I'm misunderstanding, it's already there! Check the settings:

image

vadim-on-github commented 6 years ago

@bsegraves yeah, i'm pretty sure you're misunderstanding :) It is currently not possible to make a custom foldable region inside the <?php and ?> tags. You can only make them outside of them as illustrated in the picture of my comment

I guess this is a current workaround:

php3

I just think it's a bit cumbersome to be breaking out of the <?php and ?> tags every time a code fold is needed :)

bsegraves commented 6 years ago

Ah, I get what it now. Interesting - the plugin is based on the language's syntax for comments. I'm not really sure why the comments within the php block, though clearly identified by the syntax color as comments, aren't picked up by the plugin as such.

vadim-on-github commented 6 years ago

@bsegraves very interesting indeed :) With PHP files having 2 possible languages in 1 file, who knows which language the plugin will pick. Would be great if it picked up both and worked with both. But anyways, glad you understand now. Cheers!

vadim-on-github commented 6 years ago

12 thus becomes related :)

theking2 commented 6 years ago

So, yes, no, it doesn't work

On 14 September 2018 at 06:31, Vadim H notifications@github.com wrote:

12 https://github.com/bsegraves/custom-folds/issues/12 thus becomes

related :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bsegraves/custom-folds/issues/42#issuecomment-421227868, or mute the thread https://github.com/notifications/unsubscribe-auth/ABiZeO6F-rUAV-Gu3iDz8lKDx_VK5-KWks5uazEkgaJpZM4WMiBU .

vadim-on-github commented 6 years ago

@bsegraves would you like to reopen this issue?

bsegraves commented 6 years ago

Yep, makes sense.

ThomasLandauer commented 6 years ago

It's also not working on pure php files. If I save this as fold.php I don't get folding:

<?php

// <editor-fold>
    echo 'foo';
// </editor-fold>

Note 1: The file is recognized as PHP in Atom's status bar. Note 2: There's no ?> here, cause today's best practice is to omit it.

However, the following is working for the folding - but it's not valid PHP syntax!!

<?php

<!-- <editor-fold>
    echo 'foo';
<!-- </editor-fold>

So there's certainly the wrong comment detection mechanism at work.

This is clearly a bug to me. You should fix it in any case - even if you can't find a solution for the two-languages-in-one-file problem, since today it's more common to have pure php files than <?php blocks inside html files.