Re: [Quanta] Class Variables autocompletion

Andrew Lowe <[email protected]> Fri, 09 Feb 2007 16:03:55 +1100
Newsgroups gmane.comp.kde.devel.quanta
Message-ID <[email protected]>
Andras Mantia wrote:

>Hm, partly yes, I think. The problem is that with the modification in 
>description.rc, variables are treated just like functions. In 
>Document::slotFilterCompletion you can see that 
>the "completionDTD->attrAutoCompleteAfter" is appended after the string 
>if the type of the completion is "script". And in 
>Document::getTagCompletions of course in case of PHP the type is set 
>to "script". The easiest way might be to add a hint in to the qTag 
>similar to className about the fact if it is a "function" 
>or "variable". Than in the filtering code, 
>the "completionDTD->attrAutoCompleteAfter" would be appended only for 
>functions. This would also make it possible to sort the completion list 
>(e.g variables first and methods later).
>
> Regarding the filtering, I see two solutions:
>
>1) add a field in description.rc for the variables about how they are 
>declared when they are member variables.
>2) ignore variables that are inside ( ). If this is generic enough, I'd 
>say it is better.
>
>So from what I see, it is rather simple to do this. Will you do it? :-)
>  
>
I have had a look at the Document::getTagCompletions and see some of how 
it works, and that it returns an array of KTextEditor::CompletionEntry.

The CompletionEntry has the following public variables:
QString type; (Holds XML or Script for Quanta)
QString text; (Holds the text to be inserted)
QString prefix; (Not used in Quanta?)
QString postfix; (Not Used in Quanta?)
QString comment; (Not currently used - however would be great for 
holding PHPDoc comments [Mentioned in previouse message] - as they are 
displayed next to the text)
QString userdata; (Currently holds a pipe ("|") in Quanta)

I was wondering where the best place to hold the tagType 
(Variable/Function) to pass back to filter the 
completionDTD->attrAutoCompleteAfter and for sorting?  I was thinking 
the userdata variable, however the pipe may be being used elsewhere?

Thanks

-- 
Andrew Lowe
    System Administrator & Programmer
        Information Technology
            Manildra Group

Email:   [email protected]
Phone:   02 4423 8270
Mobile:  04 1323 8270
Fax:     02 4421 7760