Commit Graph

439 Commits

Author SHA1 Message Date
hjk
5c5624007b FakeVim: Use PagedSettings for main settings
Change-Id: I5029ae42ca5c3ec426d37a818150677186dd55ea
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-06-01 09:41:34 +00:00
hjk
5ad790d5c8 FakeVim: Maintain highlighting on split
Fixes: QTCREATORBUG-28914
Change-Id: I4e0b82e49bd97f19eb513f21e1dc405ea9f0700c
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-17 13:24:41 +00:00
David Schulz
fe74e6d43b FakeVim: only block suggestion when fakevim is in use
This fixes the issue that no copilot suggestion were shown after
switching documents.

Change-Id: Ic81bfbe266877964eeaf688d9915a7937607118b
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-05-15 09:28:40 +00:00
hjk
c85b72000f All: Use the shorter access to aspect values in a few places
Change-Id: Ie0ff0e4e1cf4c2750897ea733dfccb743f44fa93
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-12 16:04:38 +00:00
hjk
7581dcd369 FakeVim: More compact settings page implementation
Change-Id: Iaca48e8a22f26817442dbf5147f318868dbd1f34
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-05-05 14:29:13 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:52:16 +00:00
Alessandro Portale
e5051bbfde Layouts: Add/remove contentMargins where needed
Some cases were preexisting, some were introduced recently

Change-Id: I0e7e7b74422c420fbf4563d7cbf384e53931c3a0
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:38:33 +00:00
hjk
c3a213cc65 FakeVim: Remove QtcProcess use from fakevimhandler.cpp
fakevimhandler.{h,cpp} are meant to be re-usable outside of Qt Creator.

Amends 91605c3.

Change-Id: I569a393d13049ef92ed3ef0c4f69de5232b2fa32
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-05-02 07:45:43 +00:00
Marcus Tillmanns
015d12ccf3 FakeVim: Accept suggestion with Tab Key
* Changed signals to callbacks as only one receiver was ever added
* Added "tabPressedInInsertMode" callback to allow accepting
  a suggestion with the Tab Key

Fixes: QTCREATORBUG-28830
Change-Id: Ie70ba595b8802b6100fff495164d8e0471b1354c
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 06:53:54 +00:00
Marcus Tillmanns
9f0919c4a3 FakeVim: Block Suggestions
Block suggestions when FakeVim is enabled and the mode
is not "Insert" or "Replace".

Change-Id: I778eb25d9570b76e42652f9d938a8c580033c462
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-05-02 06:04:53 +00:00
Marcus Tillmanns
1a658eff26 FakeVim: Clear suggestions on mode change
Change-Id: I5d3a37ab61f83a70e055063de397654f5621401d
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-04-27 06:56:47 +00:00
Christian Stenger
a5e5058c41 FakeVim: Avoid using invalid regular expressions
Print a warning in case of an invalid regular expression
and do not apply it to the settings.
This silently drops invalid regular expressions entered
and restored from settings.

Change-Id: I2f7686066541cf2307cf7cf96b3c6f89f6a677d8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-27 05:15:02 +00:00
hjk
c2ea7bc415 FakeVim: Re-organize ExCommand settings page setup
Change-Id: I085a86529fc840472aabf7ae62d6565f454256ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-25 08:35:45 +00:00
hjk
d13d48a281 FakeVim: Use IOptionPage::setWidgetCreator() for user command settings
Change-Id: Ic5d895634cb5ef1b2e1a6fa465cd800a213a7d41
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-04-25 08:12:05 +00:00
hjk
118b84ffd6 Use simpler Plugin::initialize() when feasible
Change-Id: I567965d266f20526bda9f823e31a04b354d53fb1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-20 12:13:10 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
David Schulz
0e4b0a26d3 Editor: move ownership of assist interface to processor
This way the base class can manage the lifetime of the interface object
and it doesn't need to be done in each implementation of perform.

Change-Id: Ie1ce742e31b688a337533ee6c57d376146e25ace
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-17 13:23:55 +00:00
David Schulz
09ee528c40 Editor: unify assist processor handling
Define the run type of the processor by its implementation instead of a
enum value of the provider. The execution of a processor inside the
assist now follows a unified procedure.

Change-Id: Ibe9fab324c6072e77702c2663946d7a9f562a085
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-14 13:02:51 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Jarek Kobus
392585f76d FakeVim: Replace foreach with ranged for loop
Change-Id: I0de9620ebf837be25e153bfd282b6564d4d2b115
Reviewed-by: hjk <hjk@qt.io>
2022-10-05 13:50:35 +00:00
Florian Koch
69fad91660 Re-introduction of the feature to adjust the line spacing
This already has been implemented in change
dc64f3207b, but was reverted with
change f220cb0e23) because this does not
work with text wrapping rendering, due to internal limitations of Qt.
Since this is a highly requested feature (e.g. QTCREATORBUG-13727), but
an internal change within Qt is not in sight, the approach taken here
is to offer the text wrapping feature in the settings only when the
line spacing is set to 100%. Additionally, a change has been made to
the layout of the display settings page to reflect this.

Fixes: QTCREATORBUG-13727
Change-Id: Ib233cf90a5f336bc591fa1bf860e162fa774dfe3
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-09-12 16:40:15 +00:00
Eike Ziller
04e50438eb Utils: Remove Utils::optional
Since we are now requiring macOS 10.14 we can remove our local
implementation of optional and use std::optional for macOS too.

Change-Id: I2bd018261b68da64f7f031a812045dd7784697e1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
2022-09-01 06:58:04 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
hjk
58c5b126d3 Utils: Settle on lowerSnakeCase for LayoutBuilder::Setter
Change-Id: Icfe487d8c7712cc8ad28f0f61e8ae4778a356fc3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-27 08:40:12 +00:00
hjk
b97c495d2b Utils: Make the second parameter to LayoutBuilder::attach() an enum
More explicit and more potential options (e.g. "treat grid as form")
than a bool.

Change-Id: I89413efe30410160c38b0e524ba64288dde2332e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-26 11:52:16 +00:00
hjk
14257a24f9 Utils: Introduce Layouting::{br,st}
... as "standard" ways to define line breaks and simple stretch.

There have already been too many patterns to do it.

Break() and Stretch() still work for the patches in flight, but
they are planned to be removed.

Change-Id: I9b70dcdc11244a904a496b0c55938dfb0b265fc8
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-25 09:52:15 +00:00
hjk
b8a6d72137 Utils: Make Layouting::Group { .. } less weird
It had a implicit vertical layout leading to unneded layout nesting
in quite a few cases. The price is an added Column { ... } in those
places where the implicit vertical layout was sufficient before.

Change-Id: I3ae1f03f9c1d691bd0c563b0447edd03ee02bbd2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-07-22 07:43:23 +00:00
Eike Ziller
b6dcca00c9 FakeVim: Fix compiler warning
Remove unused lambda capture

Change-Id: I973a5a6be6e2c27450ab80bbb87c9077f0ecd3e9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-05-19 07:51:16 +00:00
Robert Löhning
7c942cfd18 Remove outdated code
Change-Id: I65e0ed79dabd987bc67d4082969835d52dd7cb8b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-09 18:53:36 +00:00
Eike Ziller
195abefe7d EditorManager: Remove QString openEditor(At) overloads
In favor of the FilePath/Link ones.

Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-02 08:11:14 +00:00
hjk
8938864876 FakeVim: Use setEnabler for the vimrc path aspect
This fixes the enabling/disabling of the line edit and triggers the
(re-)read of the .vimrc at the right times.

Change-Id: I13a022aafc23ea761d3c1c4d0359cc5f137695d5
Reviewed-by: Lukas Holecek <hluk@email.cz>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-15 06:22:25 +00:00
David Schulz
c00330f905 Editor: multi cursor support
Adding a way to create multiple cursors that can insert/remove text at
arbitrary positions in the document. Adding cursors is done by pressing
alt + up/down or by clicking into the editor while holding the alt key.

Fixes: QTCREATORBUG-16013
Change-Id: I495d27d95a3d277220946616ef30efc241da0120
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-27 10:56:54 +00:00
David Schulz
4324f3e8c1 Editor: pass AssistInterface to createProcessor
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>
2021-09-16 08:25:36 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00
David Schulz
f66df921d7 Core: filepathify file renaming
Change-Id: I3d4f39e34e65cde3df7b7c19570e3a54d0625d53
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 11:13:51 +00:00
hjk
d0c32df3fe FakeVim: Don't create two handlers for one editor
Amends 206e9f95fb.

Fixes: QTCREATORBUG-25770
Change-Id: I4028a7c8257ee3985fd2198e789d98b25901d92d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-11 08:20:23 +00:00
hjk
19d078bb5c FakeVim: Use new IOptionsPage convenience functions
Change-Id: I739fe152a4f642a19c90be71bbe5adbc8747f402
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-01 07:44:22 +00:00
hjk
035a6ff031 Utils: Avoid intermediate widgets when using LayoutBuilder
In most cases, the layout constructed in the builder was set
on a widget which in turn was put into a vbox in the actual
widget. This is not necessary, but needs some re-ordering.

Also make sure that using not-yet-parented widgets during
layout construction does not cause visible artifacts.

Change-Id: I75727a571da093d3131ea6fba467c2c646cdb6f1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-16 11:37:44 +00:00
hjk
50f93710b7 FakeVim: Aspectify settings
Change-Id: Ic73edce82e192779ed3efe86a5cb747a52d94d36
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-03 07:12:21 +00:00
Christian Kandeler
1027b94fcb Fix some compiler warnings about unused variables
Change-Id: I9a9450eab68f53b08722adb9a5d33c4f318b2129
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-02-25 15:55:39 +00:00
Tom Praschan
1085d6b508 FakeVim: Add emulation for vim-surround plugin
Change-Id: If450d04dd89a1707ab05806522fbf4cc987d454b
Reviewed-by: hjk <hjk@qt.io>
2021-02-17 08:50:21 +00:00
Tom Praschan
d7acee920d FakeVim: Add emulation for argtextobj.vim plugin
Change-Id: I319d2b9fe9f0d145c2560cf03fecc50629c99006
Reviewed-by: hjk <hjk@qt.io>
2021-02-12 08:36:29 +00:00
Tom Praschan
f83eeb0548 FakeVim: Add emulation of vim-exchange plugin
Change-Id: I844c9bf11231ab842cee020a0e7a29af8ed209eb
Reviewed-by: hjk <hjk@qt.io>
2021-02-10 16:11:50 +00:00
Tom Praschan
b6f26ed67a FakeVim: Add emulation for ReplaceWithRegister plugin
Change-Id: Iaaeef6ff51fe858b759c10adaac582f5858b6210
Reviewed-by: hjk <hjk@qt.io>
2021-02-09 07:33:03 +00:00
Tom Praschan
f626e27370 FakeVim: Add emulation for vim-commentary
Change-Id: I34f222182835ae160e6c4c66ad0bada79d8abeff
Reviewed-by: hjk <hjk@qt.io>
2021-02-03 17:58:22 +00:00
hjk
206e9f95fb Core: Signal duplicated editors
FakeVim needs some notification even in cases where the
duplication is triggered outside the EditorManager as in
QmlDesigner's qml-editor.

Fixes: QTCREATORBUG-22344
Change-Id: Ia4950ff4b02d3f89779f03ff4c106a07ccff2106
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-01-14 08:31:44 +00:00
hjk
289a18f56f FakeVim: Change shortcuts from Alt-V,X to Alt-Y,X
Alt-V is taken by the Views menu nowadays.

Also, fix the instruction to quit FakeVim on Mac.

Fixes: QTCREATORBUG-24694
Change-Id: I5268760f45e34f973b3b38b19d2577c0c655b000
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-11-10 12:29:14 +00:00
David Schulz
f220cb0e23 Revert "Editor: Make line spacing adjustable"
This does not work with text wrapping since there are multiple
QTextLines inside a block but we can not adjust the line hight inside a
block. This needs to be addressed inside Qt.

This reverts commit dc64f3207b.

Change-Id: If6c28056da9891eeeb75f5939a42f08360013a80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-20 04:35:42 +00:00
hjk
fcaa6801cf Utils: Start replacing SavedActions by QAction or Utils::Aspect
First mechanical step here is to derive SavedActions from BaseAspect
instead of QAction.

Change-Id: I2ec95883b825462c1d867f83cc2b3bd2c2732055
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-10-05 08:46:27 +00:00