On Tue, Jul 9, 2013 at 12:15 PM, Thomas Meyer <[email protected]>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
_______________________________________________
Qt-creator mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qt-creator