The interface can be used for checking the context of a codeassist
request to determine
the correct processor that has to be created.
Change-Id: I47ddb05c46399566e27bae21711f11a3a4132c3f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Do not close already visible proposal widget if we get new results for
the same base position. Just replace the model of the widget and update
the prefix.
Change-Id: I298aba6eb8177edc17fea783189a2f987dbf15a2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
... and make use of them with clangd.
This way, users can get immediate feedback when a new proposal entry
has been found, rather than having to wait until all of them have been
collected.
Change-Id: I2adfe0153aa7a058f28eb3bd65c71dd30ea018e0
Reviewed-by: David Schulz <david.schulz@qt.io>
.... when following virtual function calls.
This brings us up to par with the built-in code model.
We do lose the icons, but they are of very little use in this context.
Change-Id: I29b27d538e7277d06a5af7acee07bddb6eb94c98
Reviewed-by: David Schulz <david.schulz@qt.io>
Since the FunctionHintProposalWidget is just a proxy witget that uses a
FakeToolTip it is not shown directly so we cannot check the visibility
with isVisible.
Fixes: QTCREATORBUG-25664
Change-Id: I6888e373afcfc79565ce8e3dad1bb05501d58200
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Use QCoreApplication::instance() as a context object for the
IAssistProposal deleter.
Change-Id: Idf8cd1955dca146a500da1ea036298455c8a5da1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This makes sure that the old proposal widget is disconnected from the
finalizeProposal slot and thus prevents resetting the currently shown
proposal.
Change-Id: I80d58d9a04831d464bea69697568359990ac5260
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Cleanup the proposal after an item is activated even if the proposal
widget is not visible anymore. Otherwise we might wrongly cleanup a
proposal that was triggered by a completion character while a completion
list was already open.
Change-Id: Ie95247de09313c5816cffd9a865b05183db02354
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
... while proposal is shown
amends 23d63dcc8b
Fixes: QTCREATORBUG-24225
Change-Id: Ie935c7c1d4786a4fd3cf338d7f1df52ae28de63b
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
It's unclear why that was done, and it threw off the clang code model by
introducing an unexpected sequence of events.
Fixes: QTCREATORBUG-18676
Change-Id: I4dabb56eb97e18141080c22be324c826202977ce
Reviewed-by: David Schulz <david.schulz@qt.io>
Adapt to QStringRef and QAbstractItemView::viewOptions() removal
Task-number: QTCREATORBUG-24098
Change-Id: Ia2d446312f68bd60143796284d31f5bba56aa0ed
Reviewed-by: David Schulz <david.schulz@qt.io>
... and support it in the ClangCodeModel.
This allows users to get function signature(s) displayed regardless of
where exactly the cursor is on the function call.
Fixes: QTCREATORBUG-19394
Change-Id: I033e8774db93680bfc3ee52610b817e0ef8ccc76
Reviewed-by: David Schulz <david.schulz@qt.io>
Set a null proposal has the potential to restart the processor
in combination with the invalidateCurrentRequestData from this
cancelCurrentRequest will result in a restarted processor that is not
tracked via m_asyncProcessor.
Change-Id: Ia0e0d49564170a1e705994933d07e00c23f24f5d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Currently the ownership of the processor is unknown to the codeassist
when running an async operation. Move the ownership of the processor to
the assist and delete the processor after the proposal was completed.
Change-Id: I6a2e023c47cbc876669dba866bee12b481447cb7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Fixes crash when the processor reports a result after the code assistant
was destroyed.
Change-Id: I8588d3d6acad69f1ec6302e8ba09d642ebbb77f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.
Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Previously, accepting an item from the completion pop-up triggered
another completion request, but the result of that request was never
displayed since the inserted text was a perfect match.
Now, trigger another completion request only if the inserted text
matches the activation characters.
Change-Id: Ic8ed4139efb10aadc8d41105634fcc856e0a15be
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Since
commit d61d29cf16
Introduce a basic client for the language server protocol
extra proprosals were requested in the fragile case on a change
notification, e.g. for function signature completion. Restrict this to
the language client proposal, as it was actually intended.
The language client does not support prefixes, so introduce this concept
for deciding whether to request new proposals or not.
Done-with: David Schulz
Change-Id: Ibc1ad82dbeeea93b85f279c59b8c7289fe6ec726
Reviewed-by: David Schulz <david.schulz@qt.io>
The language server protocol is used to transport language specific
information needed to efficiently edit source files. For example
completion, go to operations and symbol information. These information
are transferred via JSON-RPC. The complete definition can be found under
https://microsoft.github.io/language-server-protocol/specification.
This language server protocol support consists of two major parts, the
C++ representation of the language server protocol, and the client part
for the communication with an external language server.
The TypeScript definitions of the protocol interfaces are transferred to
C++ classes. Those classes have getter and setter for every interface
value. Optional values from the protocol are represented by
Utils::optional<ValueType>. The JSON objects that are used to transfer
the data between client and server are hidden by a specialized
JsonObject class derived from QJsonObject. Additionally this JsonObject
provides a validity check that is capable of creating a detailed error
message for malformed, or at least unexpected JSON representation of the
protocol.
The client is the interface between Qt Creator and language server
functionality, like completion, diagnostics, document and workspace
synchronization. The base client converts the data that is sent from/to
the server between the raw byte array and the corresponding C++ objects.
The transportat layer is defined in a specialized base client (this
initial change will only support stdio language server). The running
clients are handled inside the language client manager, which is also
used to connect global and exclusive Qt Creator functionality to the
clients.
Task-number: QTCREATORBUG-20284
Change-Id: I8e123e20c3f14ff7055c505319696d5096fe1704
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Update all identical snippet placeholder after selecting an item from
the completion proposal.
Change-Id: Iac4f4183c30517a8133269cc607edadce0c6bd23
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Use a qobject_cast to prevent accessing a not available function.
Task-number: QTCREATORBUG-20910
Change-Id: If2aa6b7b120379681e9590db80904c45a6d9bd55
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
warning: prefer using 'override' or (rarely) 'final' instead of
'virtual' [modernize-use-override]
Change-Id: I6dac7a62b627fa1353b4455e1af92f869c2571cc
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
Increasing readability by moving complex construct into own function.
Change-Id: I4cad1a279293e3348f550e7c423d356d9c79769f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Add completion based on words of the document. This provides basic
assistance for programming languages without a code model.
Task-number: QTCREATORBUG-13869
Change-Id: I3a9c59c741dfd6895442fc0524cfd1bd3b2b0111
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
It did not contain any functionality beyond the base IAssistProvider
anymore.
Change-Id: I0198b3d629f81be8c994ffed3904b5f12ee7f9b9
Reviewed-by: David Schulz <david.schulz@qt.io>
...when typing more arguments:
struct Foo {};
void f(int, int);
void f(Foo, Foo);
void f(char, char);
void c()
{
f( // 1. Trigger completion with Ctrl+Space
// 2. Chose item "f(Foo, Foo)"
// 3. Type: Foo(),
// OK, signature hint "f(Foo, Foo)" is displayed again
}
FunctionHintProposalWidget and IFunctionHintProposalModel are
instantiated for each calculation, so remember the selected hint in the
CodeAssist. Keep the latest 20 entries.
Task-number: QTCREATORBUG-11688
Change-Id: I579fc6d8a35dd8fa398e4b3170ddc05a85252d1a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
There is no need to trigger the automatic proposal timer anymore. This
was added to fix QTCREATORBUG-6052.
The removed code resulted in 3 completion requests when triggering a
function call: foo(. One is sufficient.
Change-Id: I3da6574bddaaaa101145ea607483e83620110c5f
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Also, add context to connect() expressions where we are or were
capturing "this".
Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Apply clang fix to the old code model
Do not replace the text after cursor if
the proposal does not contain it or
if proposal matches 100% the text after it
Task-number: QTCREATORBUG-18471
Change-Id: I662cb6e48a9e0ee14065594f5c823f114fff2474
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Make . to -> correction even in case code assistant
has no items to propose.
Change-Id: Ie16d317c1a55f05883d3de5ba9bd475d315c59a9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This fixes the following case for the ClangCodeModel:
1. Trigger non-member/non-prefix completion.
2. Choose the generic "class" snippet.
--> The snippet is inserted, cursor is right after "name", but it
also triggers another completion that proposes e.g. the "namespace"
snippet.
This does not happen with the built-in code model because at that cursor
position it provides "name" as completion result, which is a perfect
match and thus suppresses the completion list.
Change-Id: I2f797469b2a0952406b50c28f9704b113e19b16d
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
The model is not owned by the proposal.
For corner cases, we leaked here already for ages. Starting with
commit fab4dd068e
CodeAssist: Fix auto completion if function signature is shown
leaks happened also for a hot path: code completion results that does
not match any so far typed prefix. Due to auto completion turned on,
this triggers frequently when typing text.
Task-number: QTCREATORBUG-17752
Task-number: QTCREATORBUG-18326
Change-Id: I9df177723b31cf3df36e73ef1e7920d9aa5e16e5
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Complete includes when one choice exists.
Fix complete in the middle.
Task-number: QTCREATORBUG-15710
Change-Id: Iec794c17aabc8de47f981382f4b4286b9325827d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
This reverts
commit 3bf19030ab.
CodeAssist: Fragile proposals aren't closed by automatic proposals.
which fixed the case [1] but introduced the regression in case [2]. Re-
implement the fix for [1] in a different way: Check whether the new
proposal has any items to show before closing the function signature
hint.
Case [1]
void f(int);
void g()
{
f(bar // This is what we will have in the end. The steps are:
// 1. Type "f("
// --> OK, function signature pop up is shown.
// 2. Type "bar"
// --> OPS, function signature pop up is closed and no
// new completion list is shown because "bar" does
// not match any declarations.
}
Case [2]
int barman = 0;
void f(int);
void g()
{
f(bar // This is what we will have in the end. The steps are:
// 1. Type "f("
// --> OK, function signature pop up is shown.
// 2. Type "bar"
// --> OPS, no auto completion list for "barman" is
// proposed.
}
Task-number: QTCREATORBUG-16934
Change-Id: I8456275d951de9e6fc53285a5dbcbd448d49ad08
Reviewed-by: David Schulz <david.schulz@qt.io>
Keep the highlight as long as the cursor is directly behind the closing
character and the editor is the focus widget.
Change-Id: Ic1d4bac263e9d2f395791dad7ecdceb9d69635c5
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>