aboutsummaryrefslogtreecommitdiffstats
path: root/qt-lib/src
Commit message (Collapse)AuthorAgeFilesLines
* qt-ui: Check also for `qmake.bat` in the Qt installation directoryOrkun Tokdemir2024-12-181-4/+14
| | | | | | | | | | Some Qt installations do not have `qmake.exe` but `qmake.bat` instead. This commit adds a check for `qmake.bat` in the Qt installation directory. Fixes: VSCODEEXT-117 Change-Id: I2d4aa5fdda216739be16bc3a95867496d2817561 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Enhance logging for coreAPI notifications and config initializationOrkun Tokdemir2024-12-131-0/+10
| | | | | | | | * Improve logging for coreAPI notifications * Introduce `toString()` method for `QtWorkspaceConfigMessage` Change-Id: I7e82196ca641a93ea2a960230203fe21a38c8b4e Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-cpp: Introduce `FileWriter`Orkun Tokdemir2024-12-131-0/+63
| | | | | | | | | | | | When both `addtionalQtPaths` and `installationRoot` are set or updated, KitManager tries to write the new configuration to the `cmake-kits.json` . This might cause both handler to write the same file at the same time. To prevent this, `FileWriter` queues the write requests and writes the file one by one. Change-Id: Ic41aae5139fc04644a48b7a14ae14b8fd41536a4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Refactor communication between core and extensionsOrkun Tokdemir2024-12-122-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the previous implementation, the extensions were using only one way to communicate with each other, which was getting a notification when a config value was set or changed. This was problematic on startup because there was no order in which the extensions were activated and when messages were handled. b5bf26ac084823758be18453bb61579fefceb57c partially fixed this issue by adding a way to wait for `qt-cpp` to be ready, but it was still not enough. The extension should read config values when they are ready, not when messages are sent from other extensions. Remove the `lazy` initialization parameter in `Project` classes. Instead of using that parameter, we remove the firing event from `addProject()` and only fire when the project is added after startup. This way, we don't need the `lazy` parameter anymore. Since `processMessage()` is not used during startup, this commit also fixes QTBUG-131702 on the extension side. qt-lib: This commit changes `QtWorkspaceConfigMessage` and removes values in it. `QtWorkspaceConfigMessage` is now used only to notify that a value or values were set. The value `CoreApi` can be accessed by `getValue` and `setValue`. * Update the `CoreApi` interface * Add `setValue` * Rename `update` to `notify` * Remove `get<T>()` from `QtWorkspaceConfigMessage` qt-core: * Remove the internal checking mechanism to understand if a value was set or changed. Instead, just store values. qt-cpp: * Update `processMessage()` for the new usage. * Initialize config values explicitly during startup. qt-qml: * Update `processMessage()` for the new usage. * Separate starting `qmlls` from the constructor. It should be started when the conditions are met. * Get config values and update parameters inside `onProjectAdded()` Task-number: QTBUG-131702 Change-Id: If9831ea1257d123f777e6ae2afb92f33942dd3da Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-qml: qt-ui: Wait until qt-cpp is activatedOrkun Tokdemir2024-12-091-0/+7
| | | | | | | | | During the startup,`qt-qml` and `qt-ui` should wait until `qt-cpp`` sets the initial configuration values. Otherwise, qt-qml qt-ui may not be able to access the correct configuration values. Change-Id: I974a0e5e7e9cb541ea4a382ac85c303b6b59646f Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-cpp: Fix race condition while writing to `cmake-kits.json`qt-ui/1.1.0qt-qml/1.1.0qt-cpp/1.1.0qt-core/1.1.0Orkun Tokdemir2024-12-061-2/+4
| | | | | | | | | | | | | `kitManager.checkForAllQtInstallations()`, `KitManager.addProject` and `this.onProjectAdded()` try to write to `cmake-kits.json` at the same time. This generates a race condition that can lead to the file being corrupted. To fix this, we add projects to both `KitManager` and `ProjectManager` lazyly during startup. Change-Id: I5fc5199a33bb2d072eb52f8adc41df89e38722d8 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-cpp: Analyze selected kit & send telemetry dataOrkun Tokdemir2024-12-021-0/+2
| | | | | | | | | * Analyze the selected kit toolchain and the Qt version and send telemetry data to the server. * Introduce `QtVersionFromKit()` to reduce code duplication. Change-Id: Ia92f03f0c1bb18d3c69db5c7b0b485a6d8cd9099 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Dispose event handlers and language client when the project is closedOrkun Tokdemir2024-11-281-0/+4
| | | | | | | | | | | Since event handlers are not disposed properly, they are still active when the project is closed. This can cause those handlers to be called after the project is closed, which can lead to errors. * Dispose project managers inside `Deactivate()` Change-Id: Idd7b8548f7c16c41c0e4fd7052fa7ae988678bc4 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qt-qml: Add progress bar to fetching qmlls infoOrkun Tokdemir2024-11-141-0/+22
| | | | | | | | | * Move `fetchWithAbort()` to `qt-lib` * Add progress bar option to `fetchAssetAndDecide()` * Use `fetchWithAbort()` instead of `fetch()` in `fetchAssetAndDecide()` Change-Id: Ifd054d96427a89c9e24ac130a7362afe014ee8de Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Add telemetryOrkun Tokdemir2024-11-083-0/+150
| | | | | | | | | | * Send events when commands are executed * Add https://www.npmjs.com/package/@vscode/extension-telemetry * Update ThirdPartyNotices.txt Task-number: VSCODEEXT-62 Change-Id: I7c88b0db55fa14da6d66025e7fa4458726f5ce6b Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Package: Update dependencies & third party licensesOrkun Tokdemir2024-11-061-1/+1
| | | | | Change-Id: I14aaf1beb358e3efc5b81c362e8fbae4126c39d3 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Add missing qtpaths featuresOrkun Tokdemir2024-11-012-33/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove `getSelectedQtInstallationPath()` use `getSelectedKit()` instead Since we support both root installation kits and qtpaths, we cannot just return the installation path of the selected kit. We need to return the all kit information. * Use only qtpaths exe paths to cache information Since we store only qtpaths exe paths in `cmake-kits.json`, we don't need to hash it with other values like name or isVCPKG. And also, we can improving the performance by caching different kits but with the same qtpaths. * Implement `qt-cpp.qtDir` for debug templates on Windows We have to return possible dll paths for qtpaths kits. * Deprecate `qt-cpp.kitDirectory` and use `qt-cpp.qtDir` instead We support both root installation kits and qtpaths. So we cannot just rely on `qt-cpp.kitDirectory\bin` in debug templates. For qtpaths, we need to return multiple paths. * Remove `kit-directory.ts` and move content to `launch-variables.ts` * Add `qt-cpp.qpaPlatfromPluginPath` When we debug with Qt from vcpkg. We get the `could not find or load the Qt platform plugin "windows" in "",` error if we don't set the `QT_QPA_PLATFORM_PLUGIN_PATH` environment variable. That's why we need to set `qt-cpp.qpaPlatfromPluginPath` according to `cmake.buildType` either `debug` or `release` path. * Locate Designer via qtpaths To support using Designer from qtpaths, we need to locate the Designer inside paths like `QT_HOST_BINS`, `QT_HOST_LIBEXECS`, `QT_INSTALL_LIBEXECS` * Remove error messages when a qtpaths kit selected In the previous implementation, we showed an error message when a qtpaths kit selected instead of root installation kits. * Add Qt version detection from qtpaths * Add selectedQtPaths to coreAPI When a qtpaths kit is selected, we set `selectedQtPaths` to inform other extensions. * Move `queryHostBinDirPath` to `qt-ui/util.ts` Since it is only used in `qt-ui`, we move it to `qt-ui/util.ts` * Shorten `locateQtDesignerExePath()` to `locateDesigner()` * Use `set designerClient()` and detach inside it It is better encapsulation. Task-number: VSCODEEXT-86 Task-number: VSCODEEXT-93 Task-number: VSCODEEXT-92 Change-Id: I0aadd4dd5e2f9508576dda70d24eb14de7796a86 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Use `isEqual()` from `lodash` instead of custom implementationOrkun Tokdemir2024-10-291-37/+0
| | | | | Change-Id: I39904e5a5bb99e97b10681ba9ac368f136dce31c Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-qml: Add commands for QML language server installationBen Cho2024-10-281-0/+21
| | | | | | | | | | | | | | | | Add two commands to enhance user control over installation status. * `checkQmllsUpdate` checks for recent updates on the server and provides a window to ask the user whether to install it. * `downloadQmlls` downloads and install qmlls regardless of the current installation status. This could be useful when the user wants to reinstall from scratch. Task-number: VSCODEEXT-68 Change-Id: I293b17fdfdd478b16753b6f6b1346a11716f1b2f Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
* Add vcpkg supportOrkun Tokdemir2024-10-232-2/+17
| | | | | | | | | | * Update package.json & add `command-exists` * Add kit generation for vcpkg Task-number: VSCODEEXT-93 Change-Id: Iaae7c5b1cf1afc07a74544ad1840b13e3dba0350 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Add deepEqual comparisonOrkun Tokdemir2024-10-211-1/+34
| | | | | | | | | | | | | The current implementation of the isEqualArrays function compares arrays by checking if they have the same length and if each corresponding element is strictly equal (===). This approach works for primitive types but may fail for complex types like objects or arrays, where strict equality does not account for deep equality. To fix this, we use a deep equality check for each element in the array. Change-Id: I5fae38b205b5a971c1a32dffd385cb489461401f Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-core: Add `registerQtbyQtpaths` commandOrkun Tokdemir2024-10-171-0/+8
| | | | | | | | | | This new command opens the folder navigation dialog to select either a `qmake` or a `qtpaths` executable. The selected executable is then added to the global `qt-core.additionalQtPaths` configuration. Change-Id: Ic1bfb8d5b32f98b8b8fd2b6656dea1222d580ec2 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Improve consistency, remove duplication on project and project managerBen Cho2024-10-151-8/+8
| | | | | | | | | | The `ProjectManager` classes in qt-core, qt-cpp are now derived from the `ProjectManager` template class in qt-lib. Rename `ProjectBase` to `Project` for simplcity and consistency. Change-Id: I66492028f43eb8822e2be5cde87de8a97c214381 Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Simplify variable names in `QtInfo`Orkun Tokdemir2024-10-071-9/+8
| | | | | Change-Id: I1085256995872ac0698f6427c8279cf417004503 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-core: Add the `name` property to `additionalQtPaths`Orkun Tokdemir2024-10-071-3/+27
| | | | | | | | | | | | | | | | | Problem: Sometimes kits with the same name can be generated according to the query results from either `qtpaths` or `qmake`. This can cause the user to select the wrong kit. To avoid this, we need to add a new `name` property to `additionalQtPaths`. This will allow users to specilaize their kits with different names. Otherwise, the name will be the same as the `qtpaths` or `qmake` query result. * Add new type for `additionalQtPaths` * Convert the old string parameter to the new type to have uniformity Change-Id: I9c734c0c69cc19313e66808dad49ac72316f4243 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Add architecture flagsOrkun Tokdemir2024-10-071-0/+4
| | | | | Change-Id: I5de3290809f7354557ef2cc4d6832bef4ad35157 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Style: Shorten the exe suffix variableOrkun Tokdemir2024-10-071-7/+3
| | | | | Change-Id: Id7b61cc70c97b3e859a0004bb206e970ca51f17e Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-core: Add reset function to coreAPIOrkun Tokdemir2024-10-021-0/+1
| | | | | | | * Clear cache on reset Change-Id: Id9d117b6ee2a325e8b40183e9acb1707bc411092 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* qt-core: Add qt-core.additionalQtPathsJoerg Bornemann2024-09-273-6/+41
| | | | | | | | | | | | | | This new configuration value can be used to specify Qt installations that were not provided by the Qt installer. The values are absolute paths to the qtpaths or qmake executables of a Qt installation. For values in qt-core.additionalQtPaths we now generated CMake kits like it was already the case for qt-core.qtInstallationRoot. Fixes: VSCODEEXT-86 Change-Id: Id8eefe92c930546ede2639e18792fc78ba6558dd Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io>
* qt-lib: Fix Qt installation detection for cross-built QtJoerg Bornemann2024-09-231-7/+12
| | | | | | | | | | | Qt installation directories that were cross-built only have a target_qt.conf and no qt.conf file. Look for both files when finding the Qt installation directories within a Qt installer root. Fixes: VSCODEEXT-91 Change-Id: I6813aae72baf3a6d89f27f44f22c1814a7c363aa Reviewed-by: Orkun Tokdemir <orkun.tokdemir@qt.io> Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Add `IsUnix`Orkun Tokdemir2024-09-191-0/+1
| | | | | Change-Id: Ib6e51777b452b914246cbd728fe2ee2f5a17c375 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Style: Use the same naming convention for coreApi across all extensionsOrkun Tokdemir2024-08-281-5/+5
| | | | | Change-Id: I1e526a649de31f992d0652ccee8fb973e0ec7133 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-official: Separate into qt-cpp & qt-qmlOrkun Tokdemir2024-08-281-0/+35
| | | | | | | | | | | | | | | Amends c45fc76944f8a280ccc9483cc47236fd98275fb6 * Update github actions * Update ci-scripts * Remove unused test folder * Remove unused dependencies & update `ThirdPartyNotices.txt`s * Remove unused activation events Fixes: VSCODEEXT-79 Fixes: VSCODEEXT-80 Change-Id: I450fefdde5209454ef11e1b9cd12162753d4fa36 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: qt-core: Use constants instead of stringsOrkun Tokdemir2024-08-271-3/+9
| | | | | Change-Id: I3c8b892733da988d570df413ab416ca9d544f2fd Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-ui: Add openWidgetDesigner commandOrkun Tokdemir2024-08-261-0/+42
| | | | | | | | | | | | | | | * Add the `openWidgetDesigner`` command to open Qt Widget Designer. * Scan both global and workspaceFolder `qtInstallationRoot`s. * Show users current version to pick. * Add missing parameter type in `getValue<T>()` in `CoreApiImpl` * Move below function to qt-lib `findQtInstallations()` `isError()` `matchesVersionPattern()` Change-Id: Id0ed3714af32e24888fe60ed9e9191452293abed Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* Move `qtFolder` to `qt-core` & change name to `qtInstallationRoot`Orkun Tokdemir2024-08-215-14/+41
| | | | | | | | | | | | | | | * Change `qtFolder` name to `qtInstallationRoot` * Change all related variables from `qtFolder` to `qtInstallationRoot` * Move the `registerQt` command from `qt-official` to `qt-core` * Move all `qtInstallationRoot` logic to `qt-core` * Add `ProjectManager` and `StateManager` to `qt-core` * Move `BaseStateManager` to `qt-lib` * Update the documentation about the new config name * Add common constants to `qt-lib` * Fix typo Change-Id: I785e2e4aa51f64b91d8fec7d2c264b42d80c9a16 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-ui: Use QT_HOST_BINS to detect designerOrkun Tokdemir2024-08-091-0/+42
| | | | | | | | | | | | | When a kit which do not have binaries is selected, `qt-ui` cannot locate the designer binary because the binary is inside some specific kit folders like `gcc_64` in Linux or `macos` in MacOS. `QT_HOST_BINS` should be used to prevent that. * Move `queryHostBinDirPath()` into `qt-lib` * Enable `queryHostBinDirPath()` in `locateQtDesignerExePath()` Change-Id: I5199ca56832b1372ffe7a1ee6c683b32a61089cb Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
* qt-lib: Fix `existing` functionOrkun Tokdemir2024-08-081-1/+1
| | | | | | | It should return `filePath` instead of the `path` module. Change-Id: Iebbaa373995fb9c24ef8d72b4e3d2d3d9f0e4429 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* Divide the monolithic extension into modular extensionsOrkun Tokdemir2024-07-185-0/+279
The below Extensions are created with this commit: * qt-core * qt-official * qt-ui qt-core This extension is the core extension for the Qt extensions. It provides the basic functionalities for the other extensions to work. * It handles the communication between the other extensions. * It provides the basic functionalities and common features for the other extensions. * The all other extensions depend on this extension. qt-ui This extension provides the UI functionalities. * It communicates with the `qt-core` extension to get information about the Qt Widget Designer. * It provides syntax highlighting for `.ui` files. qt-official This extension has the rest of the previous monolithic extension functionalities. It should be divided into more extensions in the future. This commit implements: * Common functionalities are moved from `qt-official` to `qt-core`. * `qt-lib` is implemented as a npm module to gather the common code. * Static analysis tools for every extension are added. * Updated all `package.json` files to reflect the changes. * `ci-scripts` is implemented to run the static analysis tools and tests. * The `common` is created to gather the common code for tools. * Extension packs are updated. * The `ThirdPartyNotices.txt` files are generated for every extension. * The `README.md` files are updated to reflect the changes. * `.vscode/launch.json`, `.vscode/extensions.json`, and `.vscode/tasks.json` are updated. Change-Id: Iac9b7e071275e92cdfbb3a47fba24d3ba8e41c89 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>