We optimal indexer is only reindexing if the index would be changed. This
patch is a step in that direction. We only reindex now if the file or
project has changed. It fixes some typos too.
Task-number: QTCREATORBUG-21150
Change-Id: I6ea1c13282fbcd70253b9b2939aed37580dbd160
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Sometimes we start generation of PCHs but not finish it. In that case we
should redo it at the next start of the backend process. So we now
remove the old precompiled header if we add the task to the queue.
If we successfully generated the PCH it will be set again. But if we
did not it will be read from the database and set to false.
Task-number: QTCREATORBUG-22035
Change-Id: Id53c2b4e4f501fc5ef7830558085607baa6a49f1
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Unify continuation and new statement to get less false indentations.
Handle one-statement if/else as a special case.
Properly handle empty lines after
- includes
- preprocessor directives
- beginning of the file
- if/else
Fixes: QTCREATORBUG-22238
Change-Id: Ic334eeca7de47d9fcb74963d2e31711838d04bde
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
The project part ids are now already created very early in the database.
This removes some checks because we can assume that an id already exists.
The project part are now completely persistent, so we can read them from
the database and compare them with new generated from a new creator
session. This should help to not recreate the same PCH again and again.
Task-number: QTCREATORBUG-21151
Change-Id: Iced818ff9f7431eaed3e37978087cc0a43b9afda
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Static members have a variable declaration kind so
we need to check their access specifiers in order to
provide proper information about tokens.
Fixes: QTCREATORBUG-22082
Change-Id: If455174bd346398a2df3499fa6cf1ea2b4e26965
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
... and tweak continuation dummy text to fix the indentation
for the line with existing text inside parenthesis.
Change-Id: Iaebd2f58823fcbeed24bb7e47769af53261c18ca
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
If empty lines follow each other it makes sense to use
the empty comment as dummy text for all but the last one of them.
This prevents increasing indentation lengths after if (foo) when
there are multiple new empty lines inserted.
Change-Id: I4c948161b674b3af0a131bfb85e7a45a80ed3fb0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Sometimes the curly brace also requires indentation.
These are the cases when it comes directly after the
comma, for example inside the initializer list.
Lets handle such cases in the similar way we do it for
the closing parenthesis.
Change-Id: Ia0d25fa08f7224567dd41dd17f9757d9d8b27362
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
The text to fill the empty line mostly depends not on the
fact of being inside parenthesis or not but rather on the
last preceding meaningful character.
Let's check for this character and sometimes for the following
one to better understand the current context and pick the
proper dummy text.
With this behavior improvement we can better indent empty lines
inside initializer lists with empty lines inside.
Change-Id: Id2f27454ef56dfdf8c15b5efb14c4d09242908a9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Improve detection of the cases when the empty line is inside
the parenthesis to get more proper indentation.
Change-Id: I4aa37c29b17bedcd0e4a781d12c7066e818a07f3
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Check that extra whitespace does not prevent the indentation
and that indentation is the same for the consecutive empty lines.
Change-Id: I04aa12c4cd31aaf07daf9320c98d2eea7afcc9a8
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Sort includes only in modes when all replacements are
used (manual indentation with "Format instead of indent" selected
and saving with "Format on save" activated).
Change-Id: I73dfa1d3211760269fe7d33a141f4d831ff65c15
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
We do now tag and save them. So we can reliably track them.
Task-number: QTCREATORBUG-22035
Change-Id: I49aaeeb76150b7e2d77b863eeb0aedefc9ab50f4
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We want to use the cached values in the database because it is faster than
to parse the the files again.
Task-number: QTCREATORBUG-22035
Change-Id: I7ada7073887b1d89a06332fdb617701cb69ccd68
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Insert dummy text into empty lines also for the electic characters
not to remove empty lines when only indentation is intended.
Fixes: QTCREATORBUG-22050
Change-Id: Ife5374459feb510a0587880a6772c90a2d68d70e
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
In the concept that behavior seemed fine but in practive it
looks quite strange.
Add comma to the dummy text inserted into the empty line to have
a proper indentation for the following empty lines.
Change-Id: I770af02a475e6489bdc8f44d9f84eb3c5e7398d7
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
We need some directory where we save the index database and the precompiled
headers. This files should be persistent but the user can delete them
if he wants because we will rebuild them.
Task-number: QTCREATORBUG-22012
Change-Id: I9f25eb48a9992d6385a96427ef9c10bc739a3567
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
It went for historical reasons in the symbol storage.
Change-Id: If05edb868901884f3951d0eb2f152566e99b4d1a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Fix the insetred text position for such cases.
In the 'smart indentation mode" do not indent empty lines above
the current one but apply the formatting for them instead.
Change-Id: I4cfe7f9778bac5e311aa339e2fcfc717f436cb20
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Sometimes the messages are not send immediately, so we force it.
Task-number: QTCREATORBUG-21957
Change-Id: I9526cb4b4e3dd8b7a02e15f77bffdc51917d47c8
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Otherwise the ClangTool complains that it does not see them.
Change-Id: Ib616058584f8f95229213224cec98fa6b6f7522b
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Amends dcf763c7ee.
Change the logic in empty lines modification to properly
indent all empty lines.
Change-Id: Id945cf66915dfd192216660543594a7905426761
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Some project parts should not be built as well as some files
can be inactive inside project part.
We should not try to build pch-s or index them.
Change-Id: I8e62365b817a424ae38a0df94b6703820a4cde9d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Check the context related stuff and remove the restriction
to format after the stream operator.
Change-Id: Iaa2d32c9bffe7a0eeb7e8ade39f109b529e1eab0
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
'reformat' function in LibFormat accepts mutilple ranges.
Let's provide the ranges for the same file together when
formatting on save and formatting after fix-its.
Change-Id: I27789da83a1efc27beb57acf238508a191562bb9
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
We want the include paths from outside the project handled as system
include paths. This is speeding up the PCH creation.
Task-number: QTCREATORBUG-21955
Change-Id: Ic80102f46f5a14897c7ef43da5efd4c0f88abbbc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
For the indexer we want to filter every not builtin include search path to
as system include search path which is not inside of the project or build
directory.
Change-Id: I33663a1f3eb53ec39d5b16a8ca64b57d1b57bd9c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We forgot to remove the duplicates for used macros.
Task-number: QTCREATORBUG-21955
Change-Id: I051b8199ba5dd0a173d80c9e526bf745d3bcd777
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We use threads now and the code had to be adapted.
Task-number: QTCREATORBUG-21950
Change-Id: Ie96c5bea1fa045588d0c5a8b18bfd1ccb5d9fdd9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We can get an compile error. In that case we should not update the
database. In the future we should have a mechanism to report about the
database state.
Task-number: QTCREATORBUG-21949
Change-Id: I203346d536b007171f7bf255047409431c44a85a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We generate one big file per project part so the preprocessor is skipping
the recurring includes.
This generated many errors about missing macros but we don't care
much about them during dependency collection step so we just
silence these errors with ignoring diagnostics consumer.
Change-Id: I5581d623b5d5f9995496252735577ea6b54790d9
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
We now support source file and not only header files and the file path is
now automatically added to the end. This removes quite some clutter.
Change-Id: I74eabd262e6c7e5f4d523e3a3cd194bd3efe1ef3
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
It is promised to be compatible with prior versions.
Change-Id: I85e433382a66c82e9880401c3a983fef06c03606
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
We we FilePath and NativeFilePath so that compiler warns us if we mix them
up.
Change-Id: I33d7abc7e4e724dff2a9b2b9b23deea8b358ccfd
Reviewed-by: Marco Bubke <marco.bubke@qt.io>