When viewing a php document, block comments are not foldable. If I change the language (under the Language menu) to C++ on the same document, I can fold the comments. I looked in langs.xml and the comments seem to be defined the same way.
Any ideas on how to fold block comments in PHP?
Thanks,
Tisur
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I asked the Scintilla project as suggested, and they've sent me back here - so I'm giving this thread another bump.
Since the bug report gave me a few more terms to try searching, I also found this suggestion which has some code in it, but I'm not sure if it's the necessary code, nor how to use it if it is. And another project also created a patch like this thread is asking for, just in case that's useful.
Could we get a patch/option for Notepad++, as well, so we could enable stream comment folding if we wish?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you have the Visual Studio C++ compiler (the free Express version is good enough), then you can apply patches to sources and customize your Notepad++ by recompiing it.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't have it (nor do I have a new enough computer/enough hard drive space/memory to install it), and as I mentioned, even if the code I linked is the proper code, I don't know what to do with it. If adding it into Notepad++ as a standard option really isn't possible, can there at least be a 'for Dummies' step-by-step explanation of how to do it myself?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
1/ Set up a development environment as per http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Compiling_Notepad%2B%2B . Several persons have reported this how-to to be useful.
2/Using WinMerge or a similar tool, use the Apply patch command to apply the code you linked in (which is a patch actually) and what you have set up in 1/
3/ Recompile the Notepad++ project in VS
4/ back up your executable (notepad++.exe) and replace with the one you just crafted.
The Apply patch instructions may depend to much on the tool you have, so I cannot really expand on them. Basically you open WinMerge in the root directory of the code to tweak, give it the path of our patch file, and it should be happy with this.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If you have to go the patch route, then yes, you need to update with every release. However, this may be a configurable feature of the lexer, hence not requiring patches. Please see http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Built%2Din Languages. While the page is still under construction, the property listing is accurate now. Look for HTML properties, as PHP, ASP and friends are all processed as HTML.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I haven't tried the patch yet, but not having to redo it with each release would be much nicer. So, I tried this:
* Installed NppExec and followed the NppExec instructions
* Saved 'sci_sendmsg SCI_SETPROPERTY "fold.hypertext.comment" "1"' as 'comment_folding.script' (Is there a specific extension it should have?) and set it to execute when N++ starts.
* Restarted N++… and it says the script's ready… but I still can't fold /* */ comments.
* Tried again with 'sci_sendmsg SCI_SETPROPERTY "property.fold.hypertext.comment" "1"' but nothing changed.
I suspect it's something really obvious and stupid, but what am I doing wrong?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Restarting N++ was the wrong thing to do. Whenever N++ starts, or changes lexer in a view, all the properties are reset to their default values, and you have to sctript again.
In my opinion, it would be a good thing that most, if not all, these properties' defaults could be set from a new Preferences tab. A tedious thing to do. Either Don dos it, or someone else makes a patch and he ha decides.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi There,
Would any one know how to specify a custom folding pair of keywords? (i.e. I would like to be able to fold anything between 'foldhere' and 'foldthere'.
Alternatively, do you know where these pairs are specified for a given language?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That was why I set the script to execute on start, so it would automatically run/set the property how I wanted each time I opened N++.
That aside, the script didn't seem to work before I restarted, either, which was why I restarted in the first place. So somewhere I'm just doing it wrong, because what's supposed to tell it to allow comment folding clearly isn't, with or without a restart.
As for custom folding keywords, I actually understood that to work in entirely the opposite way - user-defined languages could set keywords, whereas built-in ones couldn't. I'm not entirely sure about the built-in ones, but I am sure about user-defined ones, because I've done it.
In the menu, go to View > User-Defined Dialogue > Folder & Default tab. The 'Folder Open Keywords Settings' is to set the start keyword(s), and 'Folder Close Keywords Settings' is to mark where the folding should end. Multiple keywords are allowed, and are separated by spaces, I believe. Attach an extension (top right box) if you wish, save the settings, and either the extension will automatically apply the settings, or you can manually tell a file to use them via the Language menu option.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When viewing a php document, block comments are not foldable. If I change the language (under the Language menu) to C++ on the same document, I can fold the comments. I looked in langs.xml and the comments seem to be defined the same way.
Any ideas on how to fold block comments in PHP?
Thanks,
Tisur
This requires modifying the lexer for the PHP language, which is a Scintilla file. Try asking that project?
CChris
I meant stream comments, (I think?).
/**
*
* This won't fold in php but it will in css and c++
*
*/
I have no idea on how to fold block comments in PHP as well.
Notepad++ 5.4.5, built on 14 July 2009 still won't do it.
I asked the Scintilla project as suggested, and they've sent me back here - so I'm giving this thread another bump.
Since the bug report gave me a few more terms to try searching, I also found this suggestion which has some code in it, but I'm not sure if it's the necessary code, nor how to use it if it is. And another project also created a patch like this thread is asking for, just in case that's useful.
Could we get a patch/option for Notepad++, as well, so we could enable stream comment folding if we wish?
If you have the Visual Studio C++ compiler (the free Express version is good enough), then you can apply patches to sources and customize your Notepad++ by recompiing it.
CChris
I don't have it (nor do I have a new enough computer/enough hard drive space/memory to install it), and as I mentioned, even if the code I linked is the proper code, I don't know what to do with it. If adding it into Notepad++ as a standard option really isn't possible, can there at least be a 'for Dummies' step-by-step explanation of how to do it myself?
1/ Set up a development environment as per http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Compiling_Notepad%2B%2B . Several persons have reported this how-to to be useful.
2/Using WinMerge or a similar tool, use the Apply patch command to apply the code you linked in (which is a patch actually) and what you have set up in 1/
3/ Recompile the Notepad++ project in VS
4/ back up your executable (notepad++.exe) and replace with the one you just crafted.
The Apply patch instructions may depend to much on the tool you have, so I cannot really expand on them. Basically you open WinMerge in the root directory of the code to tweak, give it the path of our patch file, and it should be happy with this.
CChris
Late response, but thanks. I'll give that a try.
I assume I would have to do this again any time I update Notepad++, right? Or would the patch actually remain in place across versions?
If you have to go the patch route, then yes, you need to update with every release. However, this may be a configurable feature of the lexer, hence not requiring patches. Please see http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Built%2Din Languages. While the page is still under construction, the property listing is accurate now. Look for HTML properties, as PHP, ASP and friends are all processed as HTML.
CChris
I haven't tried the patch yet, but not having to redo it with each release would be much nicer. So, I tried this:
* Installed NppExec and followed the NppExec instructions
* Saved 'sci_sendmsg SCI_SETPROPERTY "fold.hypertext.comment" "1"' as 'comment_folding.script' (Is there a specific extension it should have?) and set it to execute when N++ starts.
* Restarted N++… and it says the script's ready… but I still can't fold /* */ comments.
* Tried again with 'sci_sendmsg SCI_SETPROPERTY "property.fold.hypertext.comment" "1"' but nothing changed.
I suspect it's something really obvious and stupid, but what am I doing wrong?
Restarting N++ was the wrong thing to do. Whenever N++ starts, or changes lexer in a view, all the properties are reset to their default values, and you have to sctript again.
In my opinion, it would be a good thing that most, if not all, these properties' defaults could be set from a new Preferences tab. A tedious thing to do. Either Don dos it, or someone else makes a patch and he ha decides.
CChris
Hi There,
Would any one know how to specify a custom folding pair of keywords? (i.e. I would like to be able to fold anything between 'foldhere' and 'foldthere'.
Alternatively, do you know where these pairs are specified for a given language?
Thanks
Some lexers that N++ v5.9 includes have this ability, please consult http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Built-in_Languages for details. User defined languages do not have it.
CChris
That was why I set the script to execute on start, so it would automatically run/set the property how I wanted each time I opened N++.
That aside, the script didn't seem to work before I restarted, either, which was why I restarted in the first place. So somewhere I'm just doing it wrong, because what's supposed to tell it to allow comment folding clearly isn't, with or without a restart.
As for custom folding keywords, I actually understood that to work in entirely the opposite way - user-defined languages could set keywords, whereas built-in ones couldn't. I'm not entirely sure about the built-in ones, but I am sure about user-defined ones, because I've done it.
In the menu, go to View > User-Defined Dialogue > Folder & Default tab. The 'Folder Open Keywords Settings' is to set the start keyword(s), and 'Folder Close Keywords Settings' is to mark where the folding should end. Multiple keywords are allowed, and are separated by spaces, I believe. Attach an extension (top right box) if you wish, save the settings, and either the extension will automatically apply the settings, or you can manually tell a file to use them via the Language menu option.