-
Notifications
You must be signed in to change notification settings - Fork 590
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
PHP code folding #3561
Comments
PHP folding on Not surprised C lexer does not work for PHP, its a different language. |
First things first: Thanks for reply. :)
Yes. Works for me too, and that's default. But the thing is that PHP is C-style but is using HTML definitions for styling and keywords (which is, to be sincere, nowadays - wrong), therefore, when I add
.. or When I modify On top of that .. with any other C or C-alike lexer that provides working fold points for all "pairs" ( Standard So, to summarize .. when I modify original PHP lexer in order to enable fold points just like for lets say .. Javascript files, the best I can get is one color for all PHP related keywords (including If You have some spare time, simply open any php file with some populated array/hashmap defined inside. You won't see folding point for that array. Change to Javascript or C or D filetype, and You'll get folding points. The thing is that PHP in Geany shares HTML lexer and it is very hard to "hack" that in order to behave like it is supposed to. Arrays as well as function parameters that span accross multiple lines. Those are very common thing in PHP and scrolling or navigating via symbols is not that much elegant sometimes, especially when particular source file is not tiny, but has 1000+ lines of code. |
To be clear, identification of lexical elements for highlighting and folding is done by pieces of C++ code specific to the source language being analysed. The C lexer is different code to the PHP lexer to the shell lexer etc. The features and facilities that one lexer has is irrelevant to another lexer, so the fact that the C lexer (also used for Javascript) folds on most bracket like constructs has no implication on what the PHP lexer folds on. There is little or no documentation on what the lexers do, but from the code PHP (and embedded JS) only folds on The lexers are from the Lexilla project, to change or add features they should be added there and they will be imported into Geany when it is updated to the relevant version. |
So, there's nothing else that can be done but to use custom filetypes.php and get the partially working results until some Geany version comes out .. with improved/updated syntax for particular file types .. that depends on another .. project. "Ok". :/ |
As a volunteer project with people doing things in their own time Geany would not support more than 40 filetypes as it does without being able to leverage the excellent work of other projects like Lexilla and its associated project Scintilla, and Universal CTAGS. |
Yes .. I know a lots about Geany. There's no better free IDE if You ask me. Been using it since Windows 7. Last Windows I used as my daily driver. Last windows I used in general. Since early announcments of windows 8.0 .. I switched to linux - 100%. Then, I discovered Crunchbang Linux .. and Geany was there. As default editor for everything. I was looking for decent replacement for Notepad++ in those days .. and as soon as I realized how small, fast and configurable Geany is .. I forgot everything about Np++. That is .. Geany is my best co-worker .. for approx. 10yrs. And I don't want to change it. Nuff' said. This issue I have with PHP files .. I am aware of that for a long time already .. noticed .. a long time ago, but I am also aware how things work (partially, to be honnest) and how many smart people are involved in the project .. so I never bragged and complained until yesterday. If this gets fixed, it will get fixed and I am 101% satisfied. Now, I am 99..99% satistfied and .. well, I can (continue to) live like this. ;) Symbols tree is there (much better than the one from Kate or VSCode for that matter), can compensate lack of code folding in a need of jumping and hopping trough code to a particular spot. |
You need to modify lexilla's code, to get the () and [] code folding support for PHP:
You should give a feedback to Scintilla project. |
Why PHP files do have code folding available only for curly braces ? If I inherit direct C style rendering into custom/user filetypes.php, it works, but then, I need to add all the keywords manually, which is not a problem. It works. But then, again,
^$
(variables) are not painted ... unless I put that as well intoprimary
keywords line ... but, then - again - I cannot change the color of the$variable
, the same as other words/keywords and language constructs. In C style, no other keywords thanprimary
is taken into account. Is there any workaround for this instead of using/importing C style filedef ?The text was updated successfully, but these errors were encountered: