1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at info@qt.nokia.com.
31 **************************************************************************/
33 #include "iassistproposal.h"
35 using namespace TextEditor;
39 \title Code Assist for Editors
41 Code assist is available in the form of completions and refactoring actions pop-ups
42 which are triggered under particular circumstances. This group contains the classes
43 used to provide such support.
45 Completions can be of a variety of kind like function hints, snippets, and regular
46 context-aware content. The later are usually represented by semantic proposals, but
47 it is also possible that they are simply plain text like in the fake vim mode.
49 Completions also have the possibility to run asynchronously in a separate thread and
50 then not blocking the GUI. This is the default behavior.
54 \class TextEditor::IAssistProposal
55 \brief The IAssistProposal class acts as an interface for representing an assist proposal.
58 Known implenters of this interface are FunctionHintProposal and GenericProposal. The
59 former is recommended to be used when assisting function call constructs (overloads
60 and parameters) while the latter is quite generic so that it could be used to propose
61 snippets, refactoring operations (quickfixes), and contextual content (the member of
62 class or a string existent in the document, for example).
64 This class is part of the CodeAssist API.
66 \sa IAssistProposalWidget, IAssistModel
69 IAssistProposal::IAssistProposal()
72 IAssistProposal::~IAssistProposal()
76 \fn bool TextEditor::IAssistProposal::isFragile() const
78 Returns whether this is a fragile proposal. When a proposal is fragile it means that
79 it will be replaced by a new proposal in the case one is created, even if due to an
84 \fn int TextEditor::IAssistProposal::basePosition() const
86 Returns the position from which this proposal starts.
90 \fn bool TextEditor::IAssistProposal::isCorrective() const
92 Returns whether this proposal is also corrective. This could happen in C++, for example,
93 when a dot operator (.) needs to be replaced by an arrow operator (->) before the proposal
98 \fn void TextEditor::IAssistProposal::makeCorrection(BaseTextEditor *editor)
100 This allows a correction to be made in the case this is a corrective proposal.
104 \fn IAssistModel *TextEditor::IAssistProposal::model() const
106 Returns the model associated with this proposal.
108 Although the IAssistModel from this proposal may be used on its own, it needs to be
109 consistent with the widget returned by createWidget().
115 \fn IAssistProposalWidget *TextEditor::IAssistProposal::createWidget() const
117 Returns the widget associated with this proposal. The IAssistProposalWidget implementor
118 recommended for function hint proposals is FunctionHintProposalWidget. For snippets,
119 refactoring operations (quickfixes), and contextual content the recommeded implementor
120 is GenericProposalWidget.