Skip to content

Commit 770b463

Browse files
committed
Stop UTILITY targets from affecting IntelliSense
Some `UTILITY` targets, such as the ones created by `Doxygen.cmake`, have a list of sources attached. Avoid passing them to `updateConfigurationData()` so that they don't interfere with the assumptions made by `getConfiguration()` in the case that `all` or some other non-artifact target is the selected Build Target. * fix for #4404
1 parent b21cc30 commit 770b463

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Bug Fixes:
2828
- Fix evaluation of conditions in presets. [#4425](https://github.com/microsoft/vscode-cmake-tools/issues/4425)
2929
- Fix ENOENT error at vscode startup on some circumstances [#2855](https://github.com/microsoft/vscode-cmake-tools/issues/2855) Contributed by STMicroelectronics
3030
- Fix repeat execution option in test presets [#4443](https://github.com/microsoft/vscode-cmake-tools/issues/4443)
31+
- Fix incorrect IntelliSense configuration when a `UTILITY` has source files. [#4404](https://github.com/microsoft/vscode-cmake-tools/issues/4404)
3132

3233
## 1.20.53
3334

src/cpptools.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,10 @@ export class CppConfigurationProvider implements cpptools.CustomConfigurationPro
596596
if (config.name === opts.activeBuildTypeVariant || (!opts.activeBuildTypeVariant && config.name === "")) {
597597
for (const project of config.projects) {
598598
for (const target of project.targets) {
599+
if (target.type === 'UTILITY') {
600+
continue;
601+
}
602+
599603
// Now some shenanigans since header files don't have config data:
600604
// 1. Accumulate some "defaults" based on the set of all options for each file group
601605
// 2. Pass these "defaults" down when rebuilding the config data

test/unit-tests/cpptools.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,14 @@ suite('CppTools tests', () => {
213213
name: 'cpptools-test-3',
214214
sourceDirectory: smokeFolder,
215215
targets: [
216+
{
217+
name: 'utilityTarget',
218+
type: 'UTILITY',
219+
fileGroups: [{
220+
sources: [sourceFile3],
221+
isGenerated: false
222+
}]
223+
},
216224
{
217225
name: 'target3',
218226
type: 'EXECUTABLE',
@@ -319,6 +327,14 @@ suite('CppTools tests', () => {
319327
name: 'cpptools-test2',
320328
sourceDirectory: smokeFolder,
321329
targets: [
330+
{
331+
name: 'utilityTarget',
332+
type: 'UTILITY',
333+
fileGroups: [{
334+
sources: [sourceFile3],
335+
isGenerated: false
336+
}]
337+
},
322338
{
323339
name: 'target3',
324340
type: 'EXECUTABLE',

0 commit comments

Comments
 (0)