Commit Graph

187 Commits

Author SHA1 Message Date
David Schulz
02bfd03c22 Python: simplify detect python for document path
Change-Id: I49b943e8b89db32c11b12ee66c0ad3add9a695af
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-15 05:44:42 +00:00
David Schulz
99acc9a153 Python: Fix python detection for non project files
Do not return an empty file path if we cannot find a python venv for a
file path, but also consider the configured interpreters.

Change-Id: I5a7f06e394fb925f9a00143fc5f0797e8754534b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-10 12:47:29 +00:00
David Schulz
4c20a880e6 Python: remove python specific language client settings
Change-Id: Ic993d525f29c1925f7e64dfc6f5e053234fb4904
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-10 12:47:23 +00:00
David Schulz
ed22ef7854 Python: globalize Python language server settings
Change-Id: I84fcee6462064f0c788492fcfa12a77379af2bd7
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-10 12:40:43 +00:00
David Schulz
2029fe8c99 LanguageClient: fix todo
Change-Id: Ia6b3b5fe6e595c32a8b8a13b869f3178afb37ed8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-07 06:29:42 +00:00
David Schulz
ff8495b0a2 Python: fix pyside tool detection
pip might return an incomplete list of files on Windows for
installations. So we need to manually check the Scripts
folder for the tools we are looking for.

Change-Id: I40778607fd2f2015059744f17a539ca381b85560
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-03 07:35:13 +00:00
David Schulz
b9034e8426 Python: support python 3 mime type in language client
Change-Id: I9319442aecc61e854aaeb0778b959086a70d431b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 13:29:17 +00:00
David Schulz
b9627ddba7 Python: add pyside uic extra compiler
To be able to autocomplete code from .ui forms we need to feed the
python language server the compiled form. The uic extra compiler
generates a temporary ui_name.py file for uncompiled or unsaved ui
files. These files are inside a folder that gets appended to the python
path environment variable for the python language server.

Change-Id: I9f48d2012162f33986639315189c41e0a7e0dad2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 09:09:22 +00:00
David Schulz
3ad82a66f9 Python: move pyside detection to runconfig
Change-Id: I781c4d005ced0c884081616696eae7f738f38c6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-31 05:59:45 +00:00
hjk
2837f4d777 ProjectExplorer: Pass macroexpander (again) to WorkingDirectoryAspect
Broke with 8dacb123e0.

Probably calls for a more centralized approach again. Later.

Change-Id: Ibf52487d68d7938d4b5dfb38f1f0a5b0e1a97bc3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-30 14:45:47 +00:00
Jarek Kobus
ef2ddeb00b Utils: More forward declarations / drop unused headers [A-C]
Round 1 - focus on headers.
For classes with initial in range [A-C].
Try to keep the same separators between different kind of headers.

Change-Id: Ieab893d644af035c42590401c90728719394221f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-24 10:32:53 +00:00
David Schulz
7c86d1a195 LanguageClient: pimpl Client and cleanup includes
Change-Id: I653861e29baeaddcbcd21a5e738be6bd85514617
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-05-23 11:58:09 +00:00
hjk
d41fc4b329 Remove or replace a few unnecessary #includes
Change-Id: I0545533baab57a4383fda5fd680603fdc6459a01
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-20 16:57:26 +00:00
hjk
8dacb123e0 Utils: Pass MacroExpander to ArgumentsAspect constructor
In the past we wanted to keep the aspect constructor simple but
it turned out that exceptions were needed and accumulating, so those
are likely here to stay.

By passing also the MacroExpander to the ArgumentsAspect constructor
allows other single-purpose warts like the ProjectConfiguration::doPostInit()
machinery can be removed.

Change-Id: I148b0ca1ab0740270eecd0d3134620de65a86d4f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-20 07:06:10 +00:00
David Schulz
a493970e05 LanguageServerProtocol: remove IContent
Do not pretend to support multiple message types, while no other
messages are actually implemented by us or even known to exist in the
wild.

Change-Id: I49ee2118b2e10f265ac641c195df8a9e5c97951c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-20 06:35:47 +00:00
Jarek Kobus
6cd736fe6c Remove algorithm.h from buildtargetinfo.h
Change-Id: I777212fb94d46c1c71f017288b7e38dd5db62a91
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-18 08:38:05 +00:00
hjk
6008d05b71 Python: Split complex call
Change-Id: I6f301342a1841d2734f0598edfcd7b3327a943c9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-05-09 05:56:06 +00:00
David Schulz
fbefd45b94 Python: add pyside build configuration
Task-number: QTCREATORBUG-27219
Change-Id: I19340c57789933c7104ec5d6fec628ed810c5f3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-03 08:55:11 +00:00
hjk
0da130c4ef Python: Apply 'static' pattern for singleton members
Plus some cosmetics.

Change-Id: Ia2c8f425f0491fbe6a0bbf2e508857a5550e4d38
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-27 08:55:02 +00:00
hjk
28cfdf388a Promote previously python-specific InterpreterAspect
... and drop PythonRunConfiguration, which is a plain RunConfiguration now.

Change-Id: I540cb738180fc1424f730d6d1998886915ce527b
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-27 08:54:22 +00:00
Jarek Kobus
74b1623acd PythonUtils: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals.

Change-Id: I02fefe01cfc4be6ef996c7c8b98b36137217504e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-27 06:26:45 +00:00
hjk
5da8695dca ProjectExplorer: Pass envAspect directly to WorkingDirectory constructor
This trades a now necessary order of setup for the now removed
"acquaintSiblings" facility.

Change-Id: I85058578b792e210f24573e2ab4e3a40a8813a11
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-22 11:53:59 +00:00
David Schulz
24b4a7be74 Python: add pip package information
Change-Id: Iea55d1491b49156d8bef32c5d4045efde4bc92fe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-12 08:24:40 +00:00
David Schulz
98a2600150 Python: add clean up button to python settings
Change-Id: I633a8b20f4b02a989f2fd71448b611bbb0d0a3a4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-31 10:43:48 +00:00
David Schulz
d0c8cc20f5 Python: automatically purge outdated autodetected interpreters
Save whether an interpreter was automatically detected. Use this
information on startup and check whether the path still exists to remove
the interpreters that are gone.

Fixes: QTCREATORBUG-27253
Change-Id: I094e573122f2800f643a2708b924a7a9d7e25ae1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-31 10:43:42 +00:00
David Schulz
d8589e0222 Python: show error icon on non existent interpreter in settings
Change-Id: I8539d1aaaf2b332e0f97e0288b6b4e93f4851dfe
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-31 10:43:36 +00:00
Christian Stenger
e6de3eeb77 Python: Fix error message
Change-Id: I89531b1af594e11a52be18c4ca3c0112e076d660
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-28 12:18:27 +00:00
David Schulz
bf5114dcee Python: work with Interpreter in PythonRunConfiguration
This saves some unneeded file path conversion and lookups in the
python settings.

Change-Id: I8647858320183dc1da027363b4ab265f6c75e1ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:37 +00:00
David Schulz
7cb3a726d4 Python: add PySide installation check on document open
Checks if the document imports PySide and whether the selected python
interpreter can find a PySide installation. If not show a global info
bar that can install PySide via pip like the python lsp server.

Task-number: PYSIDE-1742
Change-Id: I02c0d5f6eb268f3d8826d4fb9d9ec3c7c48b8638
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:15 +00:00
David Schulz
64170a788a Python: extract pythonProjectForFile function to utils
Change-Id: I4055527302cab09f55cd4b06bfd3896accb4832a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 09:29:15 +00:00
David Schulz
ff686f5679 Python: move python name cache to utils
Change-Id: I7f6d13a465be6de90aea64e7f19c92bca3ee6c19
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 09:29:08 +00:00
David Schulz
b8c8e0ccae Python: Use specialized document to check for pylsp
Change-Id: I9ea13df7fc04a4fe35d901da179b9c0ebaf57bb6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 09:29:01 +00:00
David Schulz
62eb36e7ec Python: Use relative file path as run config name
Change-Id: Ifac28b9e4b066ea62b43a7da04b71e2c4317a898
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-23 13:56:56 +00:00
Christian Stenger
71a7928194 Python: Fix typo
Change-Id: Ide2d1d893ffcb0ebb6cb3aa787cf1f07960fcfc0
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-03-23 09:28:50 +00:00
David Schulz
7c3d6c1fc1 Python: remove unused variable
Change-Id: I1c16e4b3795f83e1107d39f0265465b0926d4c97
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-23 09:28:12 +00:00
Christian Stenger
59cb70e61f Python: Fix compile on Linux
Change-Id: I193fb8e5c8e6815fbd1b358c1dda1918ff2be6f0
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-21 15:47:17 +00:00
David Schulz
6f520f8783 Python: extract pip installation task
Make it reusable for pyside and other packages.

Change-Id: If97e65a506d36916aaa61f48b9a2f71c458d4fe9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 11:38:06 +00:00
David Schulz
9d1fe1df14 Python: ensure opened file is inside a workspace
The Python language server seems to dislike files that are not part of a
workspace resulting in very long lookup times for specific symbols.

Fixes: QTCREATORBUG-26230
Fixes: QTCREATORBUG-24704
Fixes: QTCREATORBUG-24140
Change-Id: Iceb7a2b3d57aea6554225a74587f619e530e10c9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 09:08:19 +00:00
David Schulz
1a88f26d8b LanguageClient: rename clientForSetting -> clientsForSetting
Change-Id: Idf4055769fba4c2551ac968c0232ddb3916acb6c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:24 +00:00
David Schulz
5924268568 LanguageClient: unify client container
Change-Id: I17b5e7ca4999cd5a9ca8e79577f29854082b6c6b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-21 08:48:17 +00:00
Jarek Kobus
8e0ae8ba96 QtcProcess: Limit the inclusion of qtcprocess.h
Move the rest of QtcProcess enums to processenums.h.
Move ExitCodeInterpreter into processenums.h.
Remove superfluous Utils:: prefix.

Change-Id: Iaa596f353d33d6930085a621b114cc15a35caa80
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 13:30:39 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
Jarek Kobus
48960b5cfc QtcProcess: Extract QtcProcess specific enums into separate header
Change-Id: Ib3498f189000fd8f5501130c0d280b0f5ae83849
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:51:55 +00:00
hjk
e2cb64471a Utils: Move QtcProcess constructor setup data to shared setup data
This includes replacing DeviceProcess terminal handling with base
member.

Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-11 17:33:48 +00:00
David Schulz
c9cd00f2ce Python: add lsp configuration widget
Change-Id: I688981293e3bbbee64fc2d714146fcdfa8126458
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-02-09 09:03:30 +00:00
Jarek Kobus
e28d2a88b2 PythonUtils: Use QtcProcess in terminal mode instead of ConsoleProcess
Change-Id: Icd8a481a03a2a13f5556327ce5caf661a5d19321
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-25 15:07:50 +00:00
Jarek Kobus
c0003c908d ConsoleProcess: Uniform the common interface of QtcProcess
This is a preliminary step before merging ConsoleProcess
into QtcProcess.

Rename command() to commandLine().
Return const references from commandLine() and from environment().

Change-Id: Iacbf48030d00f8dbba053ece70bd460924f96041
Reviewed-by: hjk <hjk@qt.io>
2022-01-20 16:42:50 +00:00
Eike Ziller
9d8a419d10 Remove qmake build files
Removes qmake as a build system for building Qt Creator itself.
Keep them for some tests that are not completely moved to CMake yet.

Change-Id: I846c6ef65626b6dfae6375fdc85d00677aa8c2fb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-01-20 12:18:15 +00:00
Jarek Kobus
2e3d32cc1b PythonEditor: Fix a leak of console process on shutdown
Give a parent for console process in order to delete it
on shutdown. In case the console process was started
and the user closed the Creator we were leaking
console process instance together with its process.

Connect to ConsoleProcess::finished() instead of stubStopped().
There is no point to keep the console open when the process
finished (it forces the user to manually close the stub
window by pressing enter).

Change-Id: I3f14e940f39b32e11bde276e80f3cb630b13d8f7
Reviewed-by: hjk <hjk@qt.io>
2022-01-20 11:04:26 +00:00
Jarek Kobus
70b2b2a1d5 ConsoleProcess: Uniform the common interface of QtcProcess
This is a preliminary step before merging ConsoleProcess
into QtcProcess.

Remove processError() signal, use errorOccurred() instead.

Change-Id: If11064944228c82a9099fffdba942c4276690085
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-20 07:51:04 +00:00