Hello is there simple way to place comment tags around selection?
Hi,
AFAIK, CTRL+E will wrap the selected text as a comment appropriate for the filetype. If it does not work, check Edit > Preferences > Keybindings
HTH,
Robert
On Wed, Jan 31, 2018 at 12:21 PM, Vladimir Avshtolis via Users < users@lists.geany.org> wrote:
Hello is there simple way to place comment tags around selection?
-- BR Vladimir Avshtolis
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 31 January 2018 at 21:21, Vladimir Avshtolis via Users users@lists.geany.org wrote:
Hello is there simple way to place comment tags around selection?
Not sure what you mean by "comment tags" but the addons plugin can be taught to add any surrounding text on a keybinding.
Cheers Lex
-- BR Vladimir Avshtolis
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards
BR Vladimir Avshtolis
31.01.2018 14:49, Lex Trotman пишет:
On 31 January 2018 at 21:21, Vladimir Avshtolis via Users users@lists.geany.org wrote:
Hello is there simple way to place comment tags around selection?
Not sure what you mean by "comment tags" but the addons plugin can be taught to add any surrounding text on a keybinding.
Cheers Lex
-- BR Vladimir Avshtolis
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want ! But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
On 2 February 2018 at 18:43, Jérôme Andanson via Users users@lists.geany.org wrote:
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards
BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want !
I think that must only work for languages that do not have a line oriented comment configured.
But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Geany only supports files as one language, it can't handle mixed languages like PHP in HTML so you can only have one comment form per filetype.
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Le 02/02/2018 à 10:15, Lex Trotman a écrit :
On 2 February 2018 at 18:43, Jérôme Andanson via Users users@lists.geany.org wrote:
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards
BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want !
I think that must only work for languages that do not have a line oriented comment configured.
But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Geany only supports files as one language, it can't handle mixed languages like PHP in HTML so you can only have one comment form per filetype.
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
Sorry for my bad english and maybe misunderstanding, just for be more clear, the point here is : - in a php file (say test.php) - when filetypes.php setting is :
comment_single= comment_open=/* comment_close=*/
It will use the comment_open and comment_close defined in filetypes.html I understand mixed language complexity, but in this example it's a php file with php code
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
On 2 February 2018 at 19:34, Jérôme Andanson via Users users@lists.geany.org wrote:
Le 02/02/2018 à 10:15, Lex Trotman a écrit :
On 2 February 2018 at 18:43, Jérôme Andanson via Users users@lists.geany.org wrote:
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards
BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want !
I think that must only work for languages that do not have a line oriented comment configured.
But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Geany only supports files as one language, it can't handle mixed languages like PHP in HTML so you can only have one comment form per filetype.
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
Sorry for my bad english and maybe misunderstanding, just for be more clear, the point here is :
- in a php file (say test.php)
- when filetypes.php setting is :
comment_single= comment_open=/* comment_close=*/
It will use the comment_open and comment_close defined in filetypes.html I understand mixed language complexity, but in this example it's a php file with php code
Ahh, the problem is that there is an attempt to handle PHP embedded in html by switching the comment type to html any time the style says something other than php. Thats likely very fragile. Issue #1758 created.
Thanks Lex
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
On 02/02/18 09:15, Lex Trotman wrote:
On 2 February 2018 at 18:43, Jérôme Andanson via Users users@lists.geany.org wrote:
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards
BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want !
I think that must only work for languages that do not have a line oriented comment configured.
But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Geany only supports files as one language, it can't handle mixed languages like PHP in HTML so you can only have one comment form per filetype.
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
This seems unnecessarily restrictive. C has two comment formats : // and /**/ ; it would be good have a means of using either : presumably a secondary hot key. That could also cover OP's requirement.
Since the mechanism is there to parse the code and insert the edits, presumably this could be added fairly easily.
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
__
[...]
This seems unnecessarily restrictive. C has two comment formats : // and /**/ ; it would be good have a means of using either : presumably a secondary hot key. That could also cover OP's requirement.
Since the mechanism is there to parse the code and insert the edits, presumably this could be added fairly easily.
Certainly, but somebody has to do it, pull requests are welcome.
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration
__
Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Le 02/02/2018 à 02:44, j.dunn@piments.com a écrit :
On 02/02/18 09:15, Lex Trotman wrote:
[…]
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
This seems unnecessarily restrictive. C has two comment formats : // and /**/ ; it would be good have a means of using either : presumably a secondary hot key. That could also cover OP's requirement.
Geany will use multi-line comment style (with open and close sequences) if there's no single-line sequences defined for that filetype. The reason Geany prefers the single-line comments is that it's a lot more robust: for example, if in C you try to wrap the following with multi-line comments:
foo(); /* do something */
it will lead to
/* foo(); /* do something */ */
which is illegal syntax (the comment ends at the first "*/", not the last one. This is because C multi-line comments don't nest, and many languages have the same issue. However, single-line comments don't have that problem.
An even more interesting example could be
regex_replace(str, ".*/", "");
which would lead to the illegal and even more tricky
/* regex_replace(str, ".*/", ""); */
Also, the same problem applies to commenting a portion of a line, because you need to use the "/* */" kind and its problems. So supporting that, while very nice, would be tricky and very language-specific, and I can't even think of a perfect solution, as you'd have to replace the "*/" sequences inside the commented area with something else, yet restore it on uncommenting.
Anyway, that's a few reflection points :)
Cheers, Colomban
On 3 February 2018 at 04:24, Colomban Wendling lists.ban@herbesfolles.org wrote:
Le 02/02/2018 à 02:44, j.dunn@piments.com a écrit :
On 02/02/18 09:15, Lex Trotman wrote:
[…]
In fact the commenting code does not understand the language at all, it just applies the character sequences configured in the filetype as text, single line comments for preference (after all the menu items are "comment line") or open/close comments as a fallback.
This seems unnecessarily restrictive. C has two comment formats : // and /**/ ; it would be good have a means of using either : presumably a secondary hot key. That could also cover OP's requirement.
Geany will use multi-line comment style (with open and close sequences) if there's no single-line sequences defined for that filetype. The reason Geany prefers the single-line comments is that it's a lot more robust: for example, if in C you try to wrap the following with multi-line comments:
foo(); /* do something */
it will lead to
/* foo(); /* do something */ */
which is illegal syntax (the comment ends at the first "*/", not the last one. This is because C multi-line comments don't nest, and many languages have the same issue. However, single-line comments don't have that problem.
An even more interesting example could be
regex_replace(str, ".*/", "");
which would lead to the illegal and even more tricky
/* regex_replace(str, ".*/", ""); */
Also, the same problem applies to commenting a portion of a line, because you need to use the "/* */" kind and its problems. So supporting that, while very nice, would be tricky and very language-specific, and I can't even think of a perfect solution, as you'd have to replace the "*/" sequences inside the commented area with something else, yet restore it on uncommenting.
Anyway, that's a few reflection points :)
Although it probably shouldn't stop adding a dumb "comment/uncomment selection" as new menu items, using comment start/stop, that just does what its told and doesn't try to be smart.
It just needs "somebody" to do it.
Cheers Lex
Cheers, Colomban _______________________________________________ Users mailing list Users@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/users
Thank you for the advice, it is clear with comment tags. In development of the discussion it would be great to have possibility to place around selection any unsymmetrical structure like <div class=''>...</div> i.e. possibility to assign to hot key open tag and close tag separately. And good if it could be also assigned to an icon as well as to hot key and placed on special instrument panel. I test the Geany for a month and I can say it is really great project. Many thanks to authors and developers!
BR Vladimir Avshtolis
02.02.2018 11:43, Jérôme Andanson пишет:
Le 31/01/2018 à 13:10, Vladimir Avshtolis via Users a écrit :
Lex, Often I need to place /*..*/ or html <!--- ... ---> around selection. Addons plugin allow to define one letter only in beginning and in the end and finally doesn't work - just insert empty space before and after selection. May be I do something wrong? Regards BR Vladimir Avshtolis
Hello,
In a html file, use of [CTRL]+[e], nicely add/remove <!-- --> around selection ! as you want ! But for php file only single line comment works '//' I don't understand how it works, maybe cause of mixed language use html/js/php, they share some functionnality.
In documentation [1] it is written you can specify comment_open and comment_close in filetypes.php, so i try as follow : comment_open=/* comment_close=*/
Don't work :(, it is still single line comment '//' So, I add a line with blank value for comment_single, as follow : comment_single= After reloading configuration, commenting a block, in a php file, will append html/xml style comment (<!-- -->) and removing it with keybinding not working, changing comment_open and comment_close in filetypes.html with : comment_open=/* comment_close=*/ Works for php file, but the problem is now with html file comment, it will use /* and */ and can't remove it with keybinding :(
So, is it possible to use comment bloc with php and html filetype in the same time ?
Jérôme
[1] https://www.geany.org/manual/dev/#filetype-configuration