Commit Graph

18 Commits

Author SHA1 Message Date
Christian Kandeler
b55825a420 ProjectExplorer: Clean up variables
Global variables with names such as "CurrentProject*", "CurrentKit*" etc
are harmful, because the term "current project" as used in Qt Creator
does not refer to the "active project", but simply stands for the
project that contains the node that is currently selected in the project
tree, which in turn may or may not correspond to the current editor
document, depending on the "sync with editor" setting. In other words,
the "current project" is almost a random value with little meaning
outside the project tree itself.
Therefore, we remove "CurrentProject*" and friends, except the ones that
are currently intentionally in use. The latter get renamed to
"CurrentDocument:Project*", so their purpose becomes clear. Their old
names are kept around for backward compatibility, but are not suggested
by the variable chooser anymore, so new usages are unlikely and we can
remove them at some point.
We also add some ActiveProject* variants that have been requested in the
past.
Also remove the "CurrentSession" prefix that was deprecated six years
ago.

Fixes: QTCREATORBUG-12724
Fixes: QTCREATORBUG-24606
Change-Id: Ibba5d0e0ce3d2beb444a5eec01fbb9b745d90a1d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-10-02 07:49:08 +00:00
Christian Kandeler
53b4d6975d C++: Fix highlighting Q_PROPERTY with template types
We override the Q_PROPERTY macro in our own header. This appears to have
two effects:
  1) The macro arguments are properly highlighted.
  2) There is no completion from libclang for Q_PROPERTY, meaning our
     own helpful snippet is the only completion candidate.
I don't understand the reason for either of these; they seem to be more
or less random effects of parsing peculiarities.

As it turns out, our macro redefinition breaks if the type of the
property is based on a template class, leading to false errors in the
code model. Removing our macro redefinition fixes the code model, but
also removes the aforementioned effects. Turning the macro into a
variadic macro fixes the code model and keeps effect 1), but not effect
2). Therefore, we also update the snippet to provide an extra string
that makes it clear this it's a helpful snippt, rather than just a
normal completion.

Fixes: QTCREATORBUG-24243
Change-Id: I4044d5e633af3ebdba36032d5efd3333b5a36214
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-07-08 14:41:11 +00:00
Nikolai Kosjar
9a5de9cdcd Snippets: Add snippet range-based for
Change-Id: Ie412875dd42ccd24daf83fd5a5abe32248ee23bd
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-01-29 09:14:47 +00:00
David Schulz
61e93a0524 Snippets: Add snippet for namespace with closing comment
Change-Id: Id0f0110ac427b3a6460eeae2891cd1c5c65fc6a3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-03-13 10:17:12 +00:00
Nikolai Kosjar
1f7403797a Snippets: Add struct snippet
Change-Id: I8c1e486d752ac0eaddbb1d7909a0e9b50382cc87
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-06-12 09:36:57 +00:00
Tobias Hunger
38cce7eb83 Update License according to agreement with Free Qt Foundation
* Update all files in share folder

Change-Id: I8a82c3eb2eb614d4339dd4c4e690f54b5f29d813
Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
2016-01-19 16:05:29 +00:00
Tobias Hunger
0cda81a99c Snippets: Add license snippets
Change-Id: If3b3d9b4f602848ffe39c72a90d4b0f1275eb828
Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
2015-10-19 08:43:27 +00:00
Tobias Hunger
ee47b652a6 Snippets: Allow lowercase/titlecase/uppercase modifiers for variables
Use the same syntax already used in the custom wizard to denote
variables that are modified to be lower-/title-/uppercase:

 $tESt:u$ will become TEST
 $tESt:c$ will become TESt
 $tESt:l$ will become test

The snippet will be inserted without any name mangling happening.
Once the editing is done the name mangling is applied to all fields.

Change-Id: I7c1f5a1ad2bb5acf1b88b54de51bb39391c64763
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-08-20 14:49:17 +02:00
Sergio Martins
01252c53df Remove semicolon from Q_PROPERTY snipplet.
Change-Id: I3e5ae3eb17701c7c0dceca53011ab9998449f531
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-07-16 13:57:30 +02:00
Christian A. Reiter
8be991b1ba add $type$ variable to Q_PROPERTY cpp snippet
Task-Number: QTCREATORBUG-7368
Change-Id: I7201a552baa7b9c92e129dcc2cc63cb1a4524dbd
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
2013-03-27 09:11:02 +01:00
Nikolai Kosjar
660afe2a63 Editor: Add snippet for main function
Change-Id: Iec778663351a866432a215cb9ab90d6261763141
Reviewed-by: hjk <hjk121@nokiamail.com>
2013-02-19 01:25:13 +01:00
Tobias Hunger
3f85291282 Add snippet for Q_PROPERTY
Change-Id: I7dd40f8da1ebd108748eb89fc84f7fbfce90e36b
Reviewed-by: David Schulz <david.schulz@digia.com>
2013-02-12 15:43:43 +01:00
Yuchen Deng
237ddd0f91 Snippets: Add 'switch' trigger for C++ code snippets
Change-Id: Id8f860e1469d7e01e42fb39d3273817623aeded6
Merge-request: 2207
Reviewed-on: http://codereview.qt-project.org/6166
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-10-06 16:46:18 +02:00
Yuchen Deng
625b0ae6eb Snippets: Put the cursor in a more useful final position
e.g.
for (int $var$ = 0; $var$ &lt; $total$; ++$var$) {
$$
}

In final, we need put the cursor at the $$ position.
This makes the code easier to write.

Change-Id: Ied1e6f6bc15277dae43d3052bfb2543124afcb82
Merge-request: 2207
Reviewed-on: http://codereview.qt-project.org/6165
Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com>
2011-10-06 16:45:56 +02:00
Leandro Melo
898bc97cce Snippets: Make it flexible for adding builtin snippets
Instead of in one XML embedded as a resource, now builtin
snippets can be specified on any XML distributed under share.
2010-12-08 17:22:14 +01:00
Leandro Melo
7528c6d617 Snippets: Feature enhancement start...
Provide an interface so users can create/edit/remove snippets.
2010-12-08 17:22:07 +01:00
Leandro Melo
769b2103a3 Snippets: Add more templates. 2010-09-27 10:31:41 +02:00
Leandro Melo
cafcce0c37 Add support for C++ snippets. 2010-09-24 20:22:03 +02:00