[Geany-Users] <DKIM> Re: How to place comment tags /* ... */ around selection ?

j.dunn at piments.com j.dunn at xxxxx
Fri Feb 2 10:44:44 UTC 2018


On 02/02/18 09:15, Lex Trotman wrote:
> On 2 February 2018 at 18:43, Jérôme Andanson via Users
> <users at 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
>>
>> __



More information about the Users mailing list