[Geany] pasting into phpdoc

Lex Trotman elextr at xxxxx
Sat Dec 4 01:41:19 UTC 2010


2010/12/4 Krzysztof Żelechowski <giecrilj at stegny.2a.pl>:
> Geany is smart enough to add phpdoc prefix on line feed.  Example:


Well no, it isn't that smart actually, this is a language independent
feature that adds the continuation to any line that the lexer has
identified as a multiline comment when you press return, its only PHP
dependent in as much as the PHP lexer identifies that the current
position is within a multiline comment.  It also works for C, C++,
Java etc.

>
> <?php
> /**
>  * one two three four|
>
> Press Return.
>
> <?php
> /**
>  * one two three four
>  * |
>
> So far so good.  But that the same trick does not work with paste:

No, because all the text is pasted first then the lexer is run to
decide how it should be highlighted.  So when the return is pasted it
doesn't know that its part of a multiline comment.  To make it work,
you would have to paste a character, run the lexer, paste a character,
run the lexer etc for each character in the paste text which would
make it unacceptably slow for large pastes.

>
> <?php
> /**
>  * one two three four Lorem ipsum
> dolor sit amet
>
> whereas I would expect
>
> <?php
> /**
>  * one two three four Lorem ipsum
>  * dolor sit amet
>
> The comment function does not work in phpdoc either.

As above.

>
> Anticipating your answer, I agree that phpdoc syntax is a failure.  But that
> is what I have, and I have to deal with it.

To make this work you would need a version of paste that is language
(PHP in your case) specific.  You might be able to write a language
specific plugin to check pastes or to rescan afterward.

Cheers
Lex

>
> Any thoughts?
> Chris
>
>
> _______________________________________________
> Geany mailing list
> Geany at uvena.de
> http://lists.uvena.de/cgi-bin/mailman/listinfo/geany
>



More information about the Users mailing list