Incomplete AST for completion?
Milian Wolff
mail at milianw.de
Mon Mar 30 23:25:15 UTC 2009
Hi guys!
Would it be possible to use the AST when building the completion items? I
really dislike that we have to do so much string operations for evaluating the
type of completion. Yet the problem I see is that completion should still
(somewhat) work when the document is invalid.
So coul incomplete AST exist? Could we use these in the completion context?
Background:
Look at the following PHP snippets, assume that your cursor is at "..." and
you request the completion list. In all of these cases the uppercase
identifiers have to be filtered from the result:
should only show classes but not ASDF itself:
class ASDF extends ...
should only show interfaces but neither FOO nor BAR:
class asdf implements FOO, BAR, ...
should only show interfaces but neither FOO nor BAR nor ASDF:
interface FOO extends BAR, ASDF, ...
There are possibly far more examples like these. Assuming I'd have an
incomplete AST up to the position of the cursor, couldn't I then easily
traverse the tree to get whatever I need? Furthermore: Wouldn't I easily know
what kind of stuff the user is trying to write (compare with the "expected FOO
BAR" messages our parsers emit) - that kind of info would be very handy for
evaluation the list of completion items!
Any idea if this is at all possible?
--
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20090331/53230f5f/attachment.sig>
More information about the KDevelop-devel
mailing list