[Qt-creator] QTCREATORBUG-9464
Leandro T. C. Melo
ltcmelo at gmail.com
Tue Jul 9 23:13:53 CEST 2013
On Tue, Jul 9, 2013 at 12:15 PM, Thomas Meyer <public at meyer-thomas.com>wrote:
> Hi,
> is it possible, that there is no 'text' (snippets) completion for the
> plain text editor?
> I have found a small class in:
> C:\Qt\qt-creator-2.7.2-src\src\plugins\texteditor\snippets\
> SnippetAssistCollector.cpp
> which is used in C:\Qt\qt-creator-2.7.2-src\src\plugins\cpptools\
> cppcompletionassist.cpp
> ...
> void CppCompletionAssistProcessor::addSnippets()
> {
> m_completions.append(m_snippetCollector.collect());
> }
> ...
>
> I can't found something similar for the PlainTextEditor or better
> BaseTextEditor.
>
> For better understanding, I have tested in
> C:\Qt\qt-creator-2.7.2-src\src\plugins\texteditor\
> basetexteditor.cpp
> ...
> void BaseTextEditorWidget::keyPressEvent(QKeyEvent *e)
> ...
> case Qt::Key_Tab:
> case Qt::Key_Backtab:
> {
> ...
> if (d->m_snippetOverlay->isVisible() && !d->m_snippetOverlay->isEmpty())
> ...
>
> The snippet overlay is not visible and is empty (with all and without
> plugins).
> So my next thoughts are, that the snippets are not loaded.
> In the 'Text Editor' option page, the snippets are loaded. So, I think the
> settings works.
> Has the 'd->m_snippetOverlay' to do with the text snippets or is my
> assumption wrong?
>
>
Hi Thomas,
yes, the snippets are not available in the plain text editor. What you see
in the snippets page is the group to which a collection snippets belong:
C++, QML, and Text. The meaning of this latter one is that its content is
pure text and therefore available for both languages, and not that it's a
plain text editor snippet. But now that you say, I wonder whether this name
could be somehow misleading...
Essentially, the snippets work with the support from the code assist API.
The purpose of SnippetAssistCollector::collect is exactly to provide the
items - notice that those from the text group are always added. At a first
thought, I don't see any technical obstacle that would prevent one from
implementing the code assist interface for the plain text editor, but I'm
not sure of the value it would bring...
The snippet overlay is just the graphical bounding box you see when
iterating through the snippets variables.
--
Leandro
http://www.ltcmelo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20130709/94fcc3e6/attachment.html>
More information about the Qt-creator
mailing list