diff --git a/.github/actions/package-lock.json b/.github/actions/package-lock.json index 84858c90f8..3f3639fd52 100644 --- a/.github/actions/package-lock.json +++ b/.github/actions/package-lock.json @@ -295,11 +295,11 @@ "integrity": "sha1-D+9a1G8b16hQLGVyfwNn1e5D1pY=" }, "axios": { - "version": "0.19.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", - "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", "requires": { - "follow-redirects": "1.5.10" + "follow-redirects": "^1.10.0" } }, "balanced-match": { @@ -399,14 +399,6 @@ "which": "^1.2.9" } }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "requires": { - "ms": "2.0.0" - } - }, "deep-is": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", @@ -682,12 +674,9 @@ "dev": true }, "follow-redirects": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", - "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", - "requires": { - "debug": "=3.1.0" - } + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.1.tgz", + "integrity": "sha512-SSG5xmZh1mkPGyKzjZP8zLjltIfpW32Y5QpdNJyjcfGxK3qo3NDDkZOZSFiGn1A6SclQxY9GzEwAHQ3dmYRWpg==" }, "fs.realpath": { "version": "1.0.0", @@ -1006,11 +995,6 @@ "minimist": "^1.2.5" } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, "mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", diff --git a/.github/actions/package.json b/.github/actions/package.json index 96548257cb..994e077072 100644 --- a/.github/actions/package.json +++ b/.github/actions/package.json @@ -12,7 +12,7 @@ "dependencies": { "@actions/core": "^1.2.6", "@actions/github": "^2.1.1", - "axios": "^0.19.2" + "axios": "^0.21.1" }, "devDependencies": { "eslint": "^6.8.0", diff --git a/Extension/CHANGELOG.md b/Extension/CHANGELOG.md index 52693953a6..489a8f2d55 100644 --- a/Extension/CHANGELOG.md +++ b/Extension/CHANGELOG.md @@ -11,7 +11,7 @@ * Fix #include completion not sorting _ last. [#3465](https://github.com/microsoft/vscode-cpptools/issues/3465) * Fix crash when certain JavaScript files are parsed as C++. [#3858](https://github.com/microsoft/vscode-cpptools/issues/3858) * Fix IntelliSense squiggle about not being able to assign to an object of its own type. [#3883](https://github.com/microsoft/vscode-cpptools/issues/3883) -* Fix hover and Find All References for template function overloads. [#4044[(https://github.com/microsoft/vscode-cpptools/issues/4044), [#4249](https://github.com/microsoft/vscode-cpptools/issues/4249) +* Fix hover and Find All References for template function overloads. [#4044](https://github.com/microsoft/vscode-cpptools/issues/4044), [#4249](https://github.com/microsoft/vscode-cpptools/issues/4249) * Fix the Outline view for nested namespaces. [#4456](https://github.com/microsoft/vscode-cpptools/issues/4456) * Fix Outline view with`"**/.*"` in `files.exclude`. [#4602](https://github.com/microsoft/vscode-cpptools/issues/4602) * Fix the Outline view for nested structs/classes. [#4781](https://github.com/microsoft/vscode-cpptools/issues/4871) diff --git a/Extension/bin/common.json b/Extension/bin/common.json new file mode 100644 index 0000000000..bf6e470e33 --- /dev/null +++ b/Extension/bin/common.json @@ -0,0 +1,33 @@ +{ + "defaults": [ + "cpfe", + "--wchar_t_keyword", + "--no_warnings", + "--rtti", + "--edge", + "--exceptions", + "--error_limit", + "25000", + "-D_EDG_COMPILER", + "-D_USE_DECLSPECS_FOR_SAL=1" + ], + "source_file_format": "-f %s", + "expressions": [ + { + "match": "^/I(.*)", + "replace": "-I\n$1" + }, + { + "match": "^/D(.*)", + "replace": "-D$1" + }, + { + "match": "^/AI(.*)", + "replace": "--using_directory\n$1" + }, + { + "match": "^/dE--header_only_fallback", + "replace": "--header_only_fallback" + } + ] +} \ No newline at end of file diff --git a/Extension/bin/linux.clang.arm.json b/Extension/bin/linux.clang.arm.json new file mode 100644 index 0000000000..f582efccff --- /dev/null +++ b/Extension/bin/linux.clang.arm.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__arm__=1", + "-D__ARM_32BIT_STATE=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.clang.arm64.json b/Extension/bin/linux.clang.arm64.json new file mode 100644 index 0000000000..d75b8d805b --- /dev/null +++ b/Extension/bin/linux.clang.arm64.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__aarch64__=1", + "-D__ARM_64BIT_STATE=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.clang.x64.json b/Extension/bin/linux.clang.x64.json new file mode 100644 index 0000000000..24d8e78408 --- /dev/null +++ b/Extension/bin/linux.clang.x64.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__x86_64=1", + "-D__x86_64__=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.clang.x86.json b/Extension/bin/linux.clang.x86.json new file mode 100644 index 0000000000..d026cd030b --- /dev/null +++ b/Extension/bin/linux.clang.x86.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__i386=1", + "-D__i386__=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.gcc.arm.json b/Extension/bin/linux.gcc.arm.json new file mode 100644 index 0000000000..f582efccff --- /dev/null +++ b/Extension/bin/linux.gcc.arm.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__arm__=1", + "-D__ARM_32BIT_STATE=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.gcc.arm64.json b/Extension/bin/linux.gcc.arm64.json new file mode 100644 index 0000000000..d75b8d805b --- /dev/null +++ b/Extension/bin/linux.gcc.arm64.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__aarch64__=1", + "-D__ARM_64BIT_STATE=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/linux.gcc.x64.json b/Extension/bin/linux.gcc.x64.json new file mode 100644 index 0000000000..b09cc36c35 --- /dev/null +++ b/Extension/bin/linux.gcc.x64.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__x86_64=1", + "-D__x86_64__=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} diff --git a/Extension/bin/linux.gcc.x86.json b/Extension/bin/linux.gcc.x86.json new file mode 100644 index 0000000000..d026cd030b --- /dev/null +++ b/Extension/bin/linux.gcc.x86.json @@ -0,0 +1,15 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-Dunix=1", + "-D__unix__=1", + "-D__linux__=1", + "-D__i386=1", + "-D__i386__=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.clang.arm.json b/Extension/bin/macos.clang.arm.json new file mode 100644 index 0000000000..92823ac523 --- /dev/null +++ b/Extension/bin/macos.clang.arm.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__arm__=1", + "-D__ARM_32BIT_STATE=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.clang.arm64.json b/Extension/bin/macos.clang.arm64.json new file mode 100644 index 0000000000..18721f3eb6 --- /dev/null +++ b/Extension/bin/macos.clang.arm64.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__aarch64__=1", + "-D__ARM_64BIT_STATE=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.clang.x64.json b/Extension/bin/macos.clang.x64.json new file mode 100644 index 0000000000..d049f22eaf --- /dev/null +++ b/Extension/bin/macos.clang.x64.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__x86_64=1", + "-D__x86_64__=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.clang.x86.json b/Extension/bin/macos.clang.x86.json new file mode 100644 index 0000000000..b6189bb0a7 --- /dev/null +++ b/Extension/bin/macos.clang.x86.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__i386=1", + "-D__i386__=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.gcc.arm.json b/Extension/bin/macos.gcc.arm.json new file mode 100644 index 0000000000..92823ac523 --- /dev/null +++ b/Extension/bin/macos.gcc.arm.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__arm__=1", + "-D__ARM_32BIT_STATE=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.gcc.arm64.json b/Extension/bin/macos.gcc.arm64.json new file mode 100644 index 0000000000..18721f3eb6 --- /dev/null +++ b/Extension/bin/macos.gcc.arm64.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__aarch64__=1", + "-D__ARM_64BIT_STATE=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.gcc.x64.json b/Extension/bin/macos.gcc.x64.json new file mode 100644 index 0000000000..d049f22eaf --- /dev/null +++ b/Extension/bin/macos.gcc.x64.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__x86_64=1", + "-D__x86_64__=1", + "-D__PTRDIFF_TYPE__=long int", + "-D__SIZE_TYPE__=long unsigned int", + "-D__WCHAR_TYPE__=int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/macos.gcc.x86.json b/Extension/bin/macos.gcc.x86.json new file mode 100644 index 0000000000..b6189bb0a7 --- /dev/null +++ b/Extension/bin/macos.gcc.x86.json @@ -0,0 +1,14 @@ +{ + "defaults": [ + "--pack_alignment", + "8", + "-D__APPLE__=1", + "-D__MACH__=1", + "-D__i386=1", + "-D__i386__=1", + "-D__PTRDIFF_TYPE__=int", + "-D__SIZE_TYPE__=unsigned int", + "-D__WCHAR_TYPE__=long int" + ], + "defaults_op" : "merge" +} \ No newline at end of file diff --git a/Extension/bin/msvc.json b/Extension/bin/msvc.json deleted file mode 100644 index 2f9af22205..0000000000 --- a/Extension/bin/msvc.json +++ /dev/null @@ -1,33 +0,0 @@ - { - "defaults": [ - "cpfe", - "--wchar_t_keyword", - "--no_warnings", - "--rtti", - "--edge", - "--exceptions", - "--error_limit", - "25000", - "-D_EDG_COMPILER", - "-D_USE_DECLSPECS_FOR_SAL=1" - ], - "source_file_format": "-f %s", - "expressions": [ - { - "match": "^/I(.*)", - "replace": "-I\n$1" - }, - { - "match": "^/D(.*)", - "replace": "-D$1" - }, - { - "match": "^/AI(.*)", - "replace": "--using_directory\n$1" - }, - { - "match": "^/dE--header_only_fallback", - "replace": "--header_only_fallback" - } - ] - } diff --git a/Extension/bin/msvc.x64.clang.json b/Extension/bin/msvc.x64.clang.json deleted file mode 100644 index e0ac16a148..0000000000 --- a/Extension/bin/msvc.x64.clang.json +++ /dev/null @@ -1,7 +0,0 @@ - { - "defaults": [ - "--pack_alignment", - "8" - ], - "defaults_op" : "merge" - } \ No newline at end of file diff --git a/Extension/bin/msvc.x64.gcc.json b/Extension/bin/msvc.x64.gcc.json deleted file mode 100644 index e88706f682..0000000000 --- a/Extension/bin/msvc.x64.gcc.json +++ /dev/null @@ -1,7 +0,0 @@ - { - "defaults": [ - "--pack_alignment", - "8" - ], - "defaults_op" : "merge" - } diff --git a/Extension/bin/msvc.x86.clang.json b/Extension/bin/msvc.x86.clang.json deleted file mode 100644 index e0ac16a148..0000000000 --- a/Extension/bin/msvc.x86.clang.json +++ /dev/null @@ -1,7 +0,0 @@ - { - "defaults": [ - "--pack_alignment", - "8" - ], - "defaults_op" : "merge" - } \ No newline at end of file diff --git a/Extension/bin/msvc.x86.gcc.json b/Extension/bin/msvc.x86.gcc.json deleted file mode 100644 index e0ac16a148..0000000000 --- a/Extension/bin/msvc.x86.gcc.json +++ /dev/null @@ -1,7 +0,0 @@ - { - "defaults": [ - "--pack_alignment", - "8" - ], - "defaults_op" : "merge" - } \ No newline at end of file diff --git a/Extension/bin/msvc.arm32.clang.json b/Extension/bin/windows.clang.arm.json similarity index 100% rename from Extension/bin/msvc.arm32.clang.json rename to Extension/bin/windows.clang.arm.json diff --git a/Extension/bin/msvc.arm32.gcc.json b/Extension/bin/windows.clang.arm64.json similarity index 100% rename from Extension/bin/msvc.arm32.gcc.json rename to Extension/bin/windows.clang.arm64.json diff --git a/Extension/bin/msvc.arm64.clang.json b/Extension/bin/windows.clang.x64.json similarity index 100% rename from Extension/bin/msvc.arm64.clang.json rename to Extension/bin/windows.clang.x64.json diff --git a/Extension/bin/windows.clang.x86.json b/Extension/bin/windows.clang.x86.json new file mode 100644 index 0000000000..37e18b9268 --- /dev/null +++ b/Extension/bin/windows.clang.x86.json @@ -0,0 +1,7 @@ +{ + "defaults": [ + "--pack_alignment", + "8" + ], + "defaults_op": "merge" +} \ No newline at end of file diff --git a/Extension/bin/windows.gcc.arm.json b/Extension/bin/windows.gcc.arm.json new file mode 100644 index 0000000000..37e18b9268 --- /dev/null +++ b/Extension/bin/windows.gcc.arm.json @@ -0,0 +1,7 @@ +{ + "defaults": [ + "--pack_alignment", + "8" + ], + "defaults_op": "merge" +} \ No newline at end of file diff --git a/Extension/bin/msvc.arm64.gcc.json b/Extension/bin/windows.gcc.arm64.json similarity index 100% rename from Extension/bin/msvc.arm64.gcc.json rename to Extension/bin/windows.gcc.arm64.json diff --git a/Extension/bin/windows.gcc.x64.json b/Extension/bin/windows.gcc.x64.json new file mode 100644 index 0000000000..37e18b9268 --- /dev/null +++ b/Extension/bin/windows.gcc.x64.json @@ -0,0 +1,7 @@ +{ + "defaults": [ + "--pack_alignment", + "8" + ], + "defaults_op": "merge" +} \ No newline at end of file diff --git a/Extension/bin/windows.gcc.x86.json b/Extension/bin/windows.gcc.x86.json new file mode 100644 index 0000000000..37e18b9268 --- /dev/null +++ b/Extension/bin/windows.gcc.x86.json @@ -0,0 +1,7 @@ +{ + "defaults": [ + "--pack_alignment", + "8" + ], + "defaults_op": "merge" +} \ No newline at end of file diff --git a/Extension/bin/msvc.arm32.msvc.json b/Extension/bin/windows.msvc.arm.json similarity index 100% rename from Extension/bin/msvc.arm32.msvc.json rename to Extension/bin/windows.msvc.arm.json diff --git a/Extension/bin/msvc.arm64.msvc.json b/Extension/bin/windows.msvc.arm64.json similarity index 100% rename from Extension/bin/msvc.arm64.msvc.json rename to Extension/bin/windows.msvc.arm64.json diff --git a/Extension/bin/msvc.x64.msvc.json b/Extension/bin/windows.msvc.x64.json similarity index 100% rename from Extension/bin/msvc.x64.msvc.json rename to Extension/bin/windows.msvc.x64.json diff --git a/Extension/bin/msvc.x86.msvc.json b/Extension/bin/windows.msvc.x86.json similarity index 100% rename from Extension/bin/msvc.x86.msvc.json rename to Extension/bin/windows.msvc.x86.json diff --git a/Extension/c_cpp_properties.schema.json b/Extension/c_cpp_properties.schema.json index 7b0d004752..23aea605b5 100644 --- a/Extension/c_cpp_properties.schema.json +++ b/Extension/c_cpp_properties.schema.json @@ -90,9 +90,37 @@ } }, "intelliSenseMode": { - "description": "The IntelliSense mode to use that maps to an architecture-specific variant of MSVC, gcc, or Clang. If not set or if set to ${default}, the extension will choose the default for that platform. Windows defaults to msvc-x64, Linux defaults to gcc-x64, and macOS defaults to clang-x64.", + "description": "The IntelliSense mode to use that maps to a platform and architecture variant of MSVC, gcc, or Clang. If not set or if set to ${default}, the extension will choose the default for that platform. Windows defaults to windows-msvc-x64, Linux defaults to linux-gcc-x64, and macOS defaults to macos-clang-x64.", "type": "string", "enum": [ + "macos-clang-x86", + "macos-clang-x64", + "macos-clang-arm", + "macos-clang-arm64", + "macos-gcc-x86", + "macos-gcc-x64", + "macos-gcc-arm", + "macos-gcc-arm64", + "linux-clang-x86", + "linux-clang-x64", + "linux-clang-arm", + "linux-clang-arm64", + "linux-gcc-x86", + "linux-gcc-x64", + "linux-gcc-arm", + "linux-gcc-arm64", + "windows-clang-x86", + "windows-clang-x64", + "windows-clang-arm", + "windows-clang-arm64", + "windows-gcc-x86", + "windows-gcc-x64", + "windows-gcc-arm", + "windows-gcc-arm64", + "windows-msvc-x86", + "windows-msvc-x64", + "windows-msvc-arm", + "windows-msvc-arm64", "clang-x86", "clang-x64", "clang-arm", diff --git a/Extension/package.json b/Extension/package.json index 5f4b580e8c..381350f82c 100644 --- a/Extension/package.json +++ b/Extension/package.json @@ -927,6 +927,34 @@ "type": "string", "enum": [ "", + "macos-clang-x86", + "macos-clang-x64", + "macos-clang-arm", + "macos-clang-arm64", + "macos-gcc-x86", + "macos-gcc-x64", + "macos-gcc-arm", + "macos-gcc-arm64", + "linux-clang-x86", + "linux-clang-x64", + "linux-clang-arm", + "linux-clang-arm64", + "linux-gcc-x86", + "linux-gcc-x64", + "linux-gcc-arm", + "linux-gcc-arm64", + "windows-clang-x86", + "windows-clang-x64", + "windows-clang-arm", + "windows-clang-arm64", + "windows-gcc-x86", + "windows-gcc-x64", + "windows-gcc-arm", + "windows-gcc-arm64", + "windows-msvc-x86", + "windows-msvc-x64", + "windows-msvc-arm", + "windows-msvc-arm64", "clang-x86", "clang-x64", "clang-arm", @@ -2515,7 +2543,7 @@ }, { "description": "ClangFormat (Linux / x86_64)", - "url": "https://go.microsoft.com/fwlink/?LinkID=2135581", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152861", "platforms": [ "linux" ], @@ -2525,11 +2553,11 @@ "binaries": [ "./LLVM/bin/clang-format" ], - "integrity": "B8381B87B83EE1AF9088AA6679F2DA013DC23A21D9EC5603C58DEFC323ED9617" + "integrity": "B29779E4FE3D03094655FD24CC17B55B41518EDDCCB1E3DF3F4665F9685152E0" }, { "description": "ClangFormat (Linux / armhf)", - "url": "https://go.microsoft.com/fwlink/?LinkID=2135579", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152860", "platforms": [ "linux" ], @@ -2539,11 +2567,11 @@ "binaries": [ "./LLVM/bin/clang-format" ], - "integrity": "F06D3741192FFD7BB96BF9327D9DE1BBF6A9DB9753DA971C727D20D38835C1A9" + "integrity": "F1CD21F581715A2C2A3B10C8D33FF81E5CBCD58856AA73CA56A88B5F085EA0D7" }, { "description": "ClangFormat (Linux / aarch64)", - "url": "https://go.microsoft.com/fwlink/?LinkID=2143107", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152922", "platforms": [ "linux" ], @@ -2553,29 +2581,60 @@ "binaries": [ "./LLVM/bin/clang-format" ], - "integrity": "8CE17FA29582759418588CD1B63C91691C944CCED95E45593D4EA31834E20913" + "integrity": "97B2A5A274F53FBB37485A383AD379CD556E85413BF843F0F0FD10536A0D705D" }, { "description": "ClangFormat (OS X)", - "url": "https://go.microsoft.com/fwlink/?LinkID=2135580", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152859", "platforms": [ "darwin" ], "binaries": [ "./LLVM/bin/clang-format.darwin" ], - "integrity": "416D3B814A76E52D943B3372D517D6AADE0AB0BD9FD9921F871C1FB89D7B17B1" + "integrity": "7AA436BA25E3404DC658A137188BEC65FF2532D1FEB314ABBBC5EBC9AAF5CCF7" }, { - "description": "ClangFormat (Windows)", - "url": "https://go.microsoft.com/fwlink/?LinkID=2144203", + "description": "ClangFormat (Windows x86)", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152921", "platforms": [ "win32" ], + "architectures": [ + "x86" + ], + "binaries": [ + "./LLVM/bin/clang-format.exe" + ], + "integrity": "993A65F61F4BF6CA6FEF6F9C1B6EB4341CE63F30A72272CABA65392695764DA7" + }, + { + "description": "ClangFormat (Windows x64)", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152923", + "platforms": [ + "win32" + ], + "architectures": [ + "x64" + ], + "binaries": [ + "./LLVM/bin/clang-format.exe" + ], + "integrity": "5E271FD44792B3675136A34466F67A876174B7818533CF37486372E43E014E62" + }, + { + "description": "ClangFormat (Windows arm64)", + "url": "https://go.microsoft.com/fwlink/?LinkID=2152862", + "platforms": [ + "win32" + ], + "architectures": [ + "arm64" + ], "binaries": [ "./LLVM/bin/clang-format.exe" ], - "integrity": "F943ADF0CE7C123C674F62F8F31FF0ADD8C54F974DD25CD01A8A1AA1532A130F" + "integrity": "9944827F70A8C53127B1A7860401923DED2DB7FBAD75E7A8106636891C11F832" }, { "description": "Mono Framework Assemblies", @@ -2671,7 +2730,7 @@ }, { "description": "Visual Studio Windows Debugger", - "url": "https://go.microsoft.com/fwlink/?linkid=2082216", + "url": "https://go.microsoft.com/fwlink/?linkid=2152353", "platforms": [ "win32" ], @@ -2682,7 +2741,7 @@ "binaries": [ "./debugAdapters/vsdbg/bin/vsdbg.exe" ], - "integrity": "CF1A01AA75275F76800F6BC1D289F2066DCEBCD983376D344ABF6B03FDB8FEA0" + "integrity": "8299A112D1260C2CEA53AC74D18FA73DE8533C058AAAB254571B503FBAC37297" } ] } diff --git a/Extension/src/Debugger/configurationProvider.ts b/Extension/src/Debugger/configurationProvider.ts index 3b65ac78c4..0c0eef308a 100644 --- a/Extension/src/Debugger/configurationProvider.ts +++ b/Extension/src/Debugger/configurationProvider.ts @@ -71,17 +71,23 @@ export class QuickPickConfigurationProvider implements vscode.DebugConfiguration const selection: MenuItem | undefined = await vscode.window.showQuickPick(items, {placeHolder: localize("select.configuration", "Select a configuration")}); if (!selection) { - throw new Error(); // User canceled it. + return []; // User canceled it. } if (selection.label.startsWith("cl.exe")) { if (!process.env.DevEnvDir) { vscode.window.showErrorMessage(localize("cl.exe.not.available", "{0} build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.", "cl.exe")); - throw new Error(); + return [selection.configuration]; } } if (selection.label.indexOf(buildAndDebugActiveFileStr()) !== -1 && selection.configuration.preLaunchTask) { try { await cppBuildTaskProvider.ensureBuildTaskExists(selection.configuration.preLaunchTask); + if (selection.configuration.miDebuggerPath) { + if (!fs.existsSync(selection.configuration.miDebuggerPath)) { + vscode.window.showErrorMessage(localize("miDebuggerPath.not.available", "miDebuggerPath does not exist: {0}. Has a debugger been installed?", selection.configuration.miDebuggerPath)); + throw new Error(); + } + } await vscode.debug.startDebugging(folder, selection.configuration); Telemetry.logDebuggerEvent("buildAndDebug", { "success": "true" }); } catch (e) { @@ -210,15 +216,19 @@ class CppConfigurationProvider implements vscode.DebugConfigurationProvider { const compilerDirname: string = path.dirname(compilerPath); const debuggerPath: string = path.join(compilerDirname, debuggerName); - fs.stat(debuggerPath, (err, stats: fs.Stats) => { - if (!err && stats && stats.isFile) { - newConfig.miDebuggerPath = debuggerPath; - } else { - // TODO should probably resolve a missing debugger in a more graceful fashion for win32. - newConfig.miDebuggerPath = path.join("/usr", "bin", debuggerName); - } + if (isWindows) { + newConfig.miDebuggerPath = debuggerPath; return resolve(newConfig); - }); + } else { + fs.stat(debuggerPath, (err, stats: fs.Stats) => { + if (!err && stats && stats.isFile) { + newConfig.miDebuggerPath = debuggerPath; + } else { + newConfig.miDebuggerPath = path.join("/usr", "bin", debuggerName); + } + return resolve(newConfig); + }); + } } }); })); diff --git a/Extension/src/LanguageServer/Providers/workspaceSymbolProvider.ts b/Extension/src/LanguageServer/Providers/workspaceSymbolProvider.ts index d820c2bf97..44c97981a0 100644 --- a/Extension/src/LanguageServer/Providers/workspaceSymbolProvider.ts +++ b/Extension/src/LanguageServer/Providers/workspaceSymbolProvider.ts @@ -25,17 +25,14 @@ export class WorkspaceSymbolProvider implements vscode.WorkspaceSymbolProvider { symbols.forEach((symbol) => { const suffix: string = util.getLocalizedString(symbol.suffix); let name: string = symbol.name; - const range: vscode.Range = new vscode.Range(symbol.location.range.start.line, symbol.location.range.start.character, symbol.location.range.end.line, symbol.location.range.end.character); - const uri: vscode.Uri = vscode.Uri.parse(symbol.location.uri.toString()); if (suffix.length) { name = name + ' (' + suffix + ')'; } const vscodeSymbol: vscode.SymbolInformation = new vscode.SymbolInformation( name, symbol.kind, - range, - uri, - symbol.containerName + symbol.containerName, + symbol.location ); resultSymbols.push(vscodeSymbol); }); diff --git a/Extension/src/LanguageServer/client.ts b/Extension/src/LanguageServer/client.ts index 0ef0b69485..f5e9d9f9cf 100644 --- a/Extension/src/LanguageServer/client.ts +++ b/Extension/src/LanguageServer/client.ts @@ -302,15 +302,10 @@ export interface LocalizeDocumentSymbol { children: LocalizeDocumentSymbol[]; } -interface Location { - uri: string; - range: Range; -} - interface LocalizeSymbolInformation { name: string; kind: vscode.SymbolKind; - location: Location; + location: vscode.Location; containerName: string; suffix: LocalizeStringParams; } @@ -701,7 +696,7 @@ export class DefaultClient implements Client { this.rootFolder = workspaceFolder; let storagePath: string | undefined; if (util.extensionContext) { - const path: string | undefined = util.extensionContext.storagePath; + const path: string | undefined = util.extensionContext.storageUri?.fsPath; if (path) { storagePath = path; } @@ -2602,6 +2597,7 @@ export class DefaultClient implements Client { if (this.innerLanguageClient !== undefined && this.configuration !== undefined) { this.languageClient.sendNotification(IntervalTimerNotification); this.configuration.checkCppProperties(); + this.configuration.checkCompileCommands(); } } diff --git a/Extension/src/LanguageServer/configurations.ts b/Extension/src/LanguageServer/configurations.ts index fe86468acd..f47381ca03 100644 --- a/Extension/src/LanguageServer/configurations.ts +++ b/Extension/src/LanguageServer/configurations.ts @@ -78,6 +78,7 @@ export interface Configuration { } export interface ConfigurationErrors { + name?: string; compilerPath?: string; includePath?: string; intelliSenseMode?: string; @@ -120,7 +121,9 @@ export class CppProperties { private currentConfigurationIndex: PersistentFolderState | undefined; private configFileWatcher: vscode.FileSystemWatcher | null = null; private configFileWatcherFallbackTime: Date = new Date(); // Used when file watching fails. - private compileCommandFileWatchers: fs.FSWatcher[] = []; + private compileCommandsFile: vscode.Uri | undefined | null = undefined; + private compileCommandsFileWatchers: fs.FSWatcher[] = []; + private compileCommandsFileWatcherFallbackTime: Date = new Date(); // Used when file watching fails. private defaultCompilerPath: string | null = null; private knownCompilers?: KnownCompiler[]; private defaultCStandard: string | null = null; @@ -507,10 +510,7 @@ export class CppProperties { const resolvedCompilerPath: string = this.resolvePath(configuration.compilerPath, true); const compilerPathAndArgs: util.CompilerPathAndArgs = util.extractCompilerPathAndArgs(resolvedCompilerPath); - // Valid compiler + IntelliSenseMode combinations: - // 1. compiler is cl/clang-cl and IntelliSenseMode is MSVC - // 2. compiler is not cl/clang-cl and IntelliSenseMode is not MSVC - const isValid: boolean = compilerPathAndArgs.compilerName.endsWith("cl.exe") === configuration.intelliSenseMode.startsWith("msvc"); + const isValid: boolean = (compilerPathAndArgs.compilerName.toLowerCase() === "cl.exe") === configuration.intelliSenseMode.includes("msvc"); if (isValid) { return ""; } else { @@ -820,8 +820,8 @@ export class CppProperties { // paths are expected to have variables resolved already public updateCompileCommandsFileWatchers(): void { if (this.configurationJson) { - this.compileCommandFileWatchers.forEach((watcher: fs.FSWatcher) => watcher.close()); - this.compileCommandFileWatchers = []; // reset it + this.compileCommandsFileWatchers.forEach((watcher: fs.FSWatcher) => watcher.close()); + this.compileCommandsFileWatchers = []; // reset it const filePaths: Set = new Set(); this.configurationJson.configurations.forEach(c => { if (c.compileCommands) { @@ -833,7 +833,7 @@ export class CppProperties { }); try { filePaths.forEach((path: string) => { - this.compileCommandFileWatchers.push(fs.watch(path, (event: string, filename: string) => { + this.compileCommandsFileWatchers.push(fs.watch(path, (event: string, filename: string) => { // Wait 1 second after a change to allow time for the write to finish. if (this.compileCommandsFileWatcherTimer) { clearInterval(this.compileCommandsFileWatcherTimer); @@ -1222,12 +1222,15 @@ export class CppProperties { const isWindows: boolean = os.platform() === 'win32'; const config: Configuration = this.configurationJson.configurations[configIndex]; + // Check if config name is unique. + errors.name = this.isConfigNameUnique(config.name); + // Validate compilerPath let resolvedCompilerPath: string | undefined = this.resolvePath(config.compilerPath, isWindows); const compilerPathAndArgs: util.CompilerPathAndArgs = util.extractCompilerPathAndArgs(resolvedCompilerPath); if (resolvedCompilerPath && // Don't error cl.exe paths because it could be for an older preview build. - !(isWindows && compilerPathAndArgs.compilerName === "cl.exe")) { + compilerPathAndArgs.compilerName.toLowerCase() !== "cl.exe") { resolvedCompilerPath = resolvedCompilerPath.trim(); // Error when the compiler's path has spaces without quotes but args are used. @@ -1370,6 +1373,15 @@ export class CppProperties { return errorMsg; } + private isConfigNameUnique(configName: string): string | undefined { + let errorMsg: string | undefined; + const occurrences: number | undefined = this.ConfigurationNames?.filter(function (name): boolean { return name === configName; }).length; + if (occurrences) { + errorMsg = localize('duplicate.name', "{0} is a duplicate. The configuration name should be unique.", configName); + } + return errorMsg; + } + private handleSquiggles(): void { if (!this.propertiesFile) { return; @@ -1411,8 +1423,49 @@ export class CppProperties { envText = curText.substr(envStart, envEnd); const envTextStartOffSet: number = envStart + 1; + // Check if all config names are unique. + let allConfigText: string = curText; + let allConfigTextOffset: number = envTextStartOffSet; + const nameRegex: RegExp = new RegExp(`{\\s*"name"\\s*:\\s*".*"`); + let configStart: number = allConfigText.search(new RegExp(nameRegex)); + let configNameStart: number; + let configNameEnd: number; + let configName: string; + const configNames: Map = new Map(); + let dupErrorMsg: string; + while (configStart !== -1) { + allConfigText = allConfigText.substr(configStart); + allConfigTextOffset += configStart; + configNameStart = allConfigText.indexOf('"', allConfigText.indexOf(':') + 1) + 1; + configNameEnd = allConfigText.indexOf('"', configNameStart); + configName = allConfigText.substr(configNameStart, configNameEnd - configNameStart); + const newRange: vscode.Range = new vscode.Range(0, allConfigTextOffset + configNameStart, 0, allConfigTextOffset + configNameEnd); + const allRanges: vscode.Range[] | undefined = configNames.get(configName); + if (allRanges) { + allRanges.push(newRange); + configNames.set(configName, allRanges); + } else { + configNames.set(configName, [newRange]); + } + allConfigText = allConfigText.substr(configNameEnd + 1); + allConfigTextOffset += configNameEnd + 1; + configStart = allConfigText.search(new RegExp(nameRegex)); + } + for (const [configName, allRanges] of configNames) { + if (allRanges && allRanges.length > 1) { + dupErrorMsg = localize('duplicate.name', "{0} is a duplicate. The configuration name should be unique.", configName); + allRanges.forEach(nameRange => { + const diagnostic: vscode.Diagnostic = new vscode.Diagnostic( + new vscode.Range(document.positionAt(nameRange.start.character), + document.positionAt(nameRange.end.character)), + dupErrorMsg, vscode.DiagnosticSeverity.Warning); + diagnostics.push(diagnostic); + }); + } + } + // Get current config text - const configStart: number = curText.search(new RegExp(`{\\s*"name"\\s*:\\s*"${escapeStringRegExp(currentConfiguration.name)}"`)); + configStart = curText.search(new RegExp(`{\\s*"name"\\s*:\\s*"${escapeStringRegExp(currentConfiguration.name)}"`)); if (configStart === -1) { telemetry.logLanguageServerEvent("ConfigSquiggles", { "error": "config name not first" }); return; @@ -1517,7 +1570,7 @@ export class CppProperties { if (isCompilerPath) { resolvedPath = resolvedPath.trim(); const compilerPathAndArgs: util.CompilerPathAndArgs = util.extractCompilerPathAndArgs(resolvedPath); - if (isWindows && compilerPathAndArgs.compilerName === "cl.exe") { + if (compilerPathAndArgs.compilerName.toLowerCase() === "cl.exe") { continue; // Don't squiggle invalid cl.exe paths because it could be for an older preview build. } if (compilerPathAndArgs.compilerPath === undefined) { @@ -1745,12 +1798,33 @@ export class CppProperties { }); } + public checkCompileCommands(): void { + // Check for changes in case of file watcher failure. + const compileCommandsFile: string | undefined = this.CurrentConfiguration?.compileCommands; + if (!compileCommandsFile) { + return; + } + fs.stat(compileCommandsFile, (err, stats) => { + if (err) { + if (err.code === "ENOENT" && this.compileCommandsFile) { + this.compileCommandsFileWatchers = []; // reset file watchers + this.onCompileCommandsChanged(compileCommandsFile); + this.compileCommandsFile = null; // File deleted + } + } else if (stats.mtime > this.compileCommandsFileWatcherFallbackTime) { + this.compileCommandsFileWatcherFallbackTime = new Date(); + this.onCompileCommandsChanged(compileCommandsFile); + this.compileCommandsFile = vscode.Uri.file(compileCommandsFile); // File created. + } + }); + } + dispose(): void { this.disposables.forEach((d) => d.dispose()); this.disposables = []; - this.compileCommandFileWatchers.forEach((watcher: fs.FSWatcher) => watcher.close()); - this.compileCommandFileWatchers = []; // reset it + this.compileCommandsFileWatchers.forEach((watcher: fs.FSWatcher) => watcher.close()); + this.compileCommandsFileWatchers = []; // reset it this.diagnosticCollection.dispose(); } diff --git a/Extension/src/LanguageServer/cppBuildTaskProvider.ts b/Extension/src/LanguageServer/cppBuildTaskProvider.ts index a48aff428d..ed9ec1531d 100644 --- a/Extension/src/LanguageServer/cppBuildTaskProvider.ts +++ b/Extension/src/LanguageServer/cppBuildTaskProvider.ts @@ -154,7 +154,7 @@ export class CppBuildTaskProvider implements TaskProvider { private getTask: (compilerPath: string, appendSourceToName: boolean, compilerArgs?: string[], definition?: CppBuildTaskDefinition, detail?: string) => Task = (compilerPath: string, appendSourceToName: boolean, compilerArgs?: string[], definition?: CppBuildTaskDefinition, detail?: string) => { const compilerPathBase: string = path.basename(compilerPath); - const isCl: boolean = compilerPathBase === "cl.exe"; + const isCl: boolean = compilerPathBase.toLowerCase() === "cl.exe"; // Double-quote the command if it is not already double-quoted. let resolvedcompilerPath: string = isCl ? compilerPathBase : compilerPath; if (resolvedcompilerPath && !resolvedcompilerPath.startsWith("\"") && resolvedcompilerPath.includes(" ")) { @@ -166,7 +166,7 @@ export class CppBuildTaskProvider implements TaskProvider { CppBuildTaskProvider.CppBuildSourceStr + ": " : "") + compilerPathBase + " " + localize("build_active_file", "build active file"); const filePath: string = path.join('${fileDirname}', '${fileBasenameNoExtension}'); const isWindows: boolean = os.platform() === 'win32'; - let args: string[] = isCl ? ['/Zi', '/EHsc', '/Fe:', filePath + '.exe', '${file}'] : ['-g', '${file}', '-o', filePath + (isWindows ? '.exe' : '')]; + let args: string[] = isCl ? ['/Zi', '/EHsc', '/nologo', '/Fe:', filePath + '.exe', '${file}'] : ['-g', '${file}', '-o', filePath + (isWindows ? '.exe' : '')]; if (compilerArgs && compilerArgs.length > 0) { args = args.concat(compilerArgs); } @@ -370,36 +370,40 @@ class CustomBuildTaskTerminal implements Pseudoterminal { this.writeEmitter.fire(line + this.endOfLine); } }; + this.writeEmitter.fire(activeCommand + this.endOfLine); try { const result: number = await new Promise((resolve, reject) => { cp.exec(activeCommand, this.options, (_error, stdout, _stderr) => { - const dot: string = (stdout || _stderr) ? ":" : "."; + const dot: string = "."; + const is_cl: boolean = (_stderr || _stderr === '') && stdout ? true : false; + if (is_cl) { + // cl.exe, header info may not appear if /nologo is used. + if (_stderr) { + splitWriteEmitter(_stderr); // compiler header info and command line D warnings (e.g. when /MTd and /MDd are both used) + } + splitWriteEmitter(stdout); // linker header info and potentially compiler C warnings + } if (_error) { - telemetry.logLanguageServerEvent("cppBuildTaskError"); - this.writeEmitter.fire(localize("build_finished_with_error", "Build finished with errors(s)") + dot + this.endOfLine); if (stdout) { - splitWriteEmitter(stdout); // cl.exe + // cl.exe } else if (_stderr) { splitWriteEmitter(_stderr); // gcc/clang } else { splitWriteEmitter(_error.message); // e.g. command executable not found } + telemetry.logLanguageServerEvent("cppBuildTaskError"); + this.writeEmitter.fire(localize("build_finished_with_error", "Build finished with error(s)") + dot + this.endOfLine); resolve(-1); - return; } else if (_stderr && !stdout) { // gcc/clang + splitWriteEmitter(_stderr); telemetry.logLanguageServerEvent("cppBuildTaskWarnings"); this.writeEmitter.fire(localize("build_finished_with_warnings", "Build finished with warning(s)") + dot + this.endOfLine); - splitWriteEmitter(_stderr); resolve(0); - } else if (stdout && stdout.includes("warning C")) { // cl.exe + } else if (stdout && stdout.includes("warning C")) { // cl.exe, compiler warnings telemetry.logLanguageServerEvent("cppBuildTaskWarnings"); this.writeEmitter.fire(localize("build_finished_with_warnings", "Build finished with warning(s)") + dot + this.endOfLine); - splitWriteEmitter(stdout); resolve(0); } else { - if (stdout) { - splitWriteEmitter(stdout); // cl.exe - } this.writeEmitter.fire(localize("build finished successfully", "Build finished successfully.") + this.endOfLine); resolve(0); } diff --git a/Extension/src/LanguageServer/extension.ts b/Extension/src/LanguageServer/extension.ts index bcf0c17995..bc26fe0a27 100644 --- a/Extension/src/LanguageServer/extension.ts +++ b/Extension/src/LanguageServer/extension.ts @@ -806,14 +806,9 @@ function onSwitchHeaderSource(): void { vscode.window.showTextDocument(document, editor.viewColumn); } }); - // TODO: Handle non-visibleTextEditor...not sure how yet. + if (!foundEditor) { - if (vscode.window.activeTextEditor !== undefined) { - // TODO: Change to show it in a different column? - vscode.window.showTextDocument(document, vscode.window.activeTextEditor.viewColumn); - } else { - vscode.window.showTextDocument(document); - } + vscode.window.showTextDocument(document); } }); }); diff --git a/Extension/src/LanguageServer/settingsPanel.ts b/Extension/src/LanguageServer/settingsPanel.ts index da1939796a..3478394db6 100644 --- a/Extension/src/LanguageServer/settingsPanel.ts +++ b/Extension/src/LanguageServer/settingsPanel.ts @@ -15,6 +15,7 @@ import * as telemetry from '../telemetry'; const elementId: { [key: string]: string } = { // Basic settings configName: "configName", + configNameInvalid: "configNameInvalid", configSelection: "configSelection", addConfigBtn: "addConfigBtn", addConfigOk: "addConfigOk", diff --git a/Extension/src/common.ts b/Extension/src/common.ts index 366c72e49b..425357ea6e 100644 --- a/Extension/src/common.ts +++ b/Extension/src/common.ts @@ -544,19 +544,35 @@ export async function checkInstallBinariesExist(): Promise { export async function checkInstallJsonsExist(): Promise { let installJsonsExist: boolean = true; const jsonFiles: string[] = [ - "bin/msvc.arm32.clang.json", - "bin/msvc.arm32.gcc.json", - "bin/msvc.arm32.msvc.json", - "bin/msvc.arm64.clang.json", - "bin/msvc.arm64.gcc.json", - "bin/msvc.arm64.msvc.json", - "bin/msvc.json", - "bin/msvc.x64.clang.json", - "bin/msvc.x64.gcc.json", - "bin/msvc.x64.msvc.json", - "bin/msvc.x86.clang.json", - "bin/msvc.x86.gcc.json", - "bin/msvc.x86.msvc.json", + "bin/common.json", + "bin/linux.clang.arm.json", + "bin/linux.clang.arm64.json", + "bin/linux.clang.x64.json", + "bin/linux.clang.x86.json", + "bin/linux.gcc.arm.json", + "bin/linux.gcc.arm64.json", + "bin/linux.gcc.x64.json", + "bin/linux.gcc.x86.json", + "bin/macos.clang.arm.json", + "bin/macos.clang.arm64.json", + "bin/macos.clang.x64.json", + "bin/macos.clang.x86.json", + "bin/macos.gcc.arm.json", + "bin/macos.gcc.arm64.json", + "bin/macos.gcc.x64.json", + "bin/macos.gcc.x86.json", + "bin/windows.clang.arm.json", + "bin/windows.clang.arm64.json", + "bin/windows.clang.x64.json", + "bin/windows.clang.x86.json", + "bin/windows.gcc.arm.json", + "bin/windows.gcc.arm64.json", + "bin/windows.gcc.x64.json", + "bin/windows.gcc.x86.json", + "bin/windows.msvc.arm.json", + "bin/windows.msvc.arm64.json", + "bin/windows.msvc.x64.json", + "bin/windows.msvc.x86.json", "debugAdapters/bin/cppdbg.ad7Engine.json" ]; await Promise.all(jsonFiles.map(async (file) => { @@ -897,6 +913,7 @@ export function downloadFileToStr(urlStr: string, headers?: OutgoingHttpHeaders) }); } +/** CompilerPathAndArgs retains original casing of text input for compiler path and args */ export interface CompilerPathAndArgs { compilerPath?: string; compilerName: string; @@ -952,14 +969,13 @@ function extractArgs(argsString: string): string[] { export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputCompilerArgs?: string[]): CompilerPathAndArgs { let compilerPath: string | undefined = inputCompilerPath; + const compilerPathLowercase: string | undefined = inputCompilerPath?.toLowerCase(); let compilerName: string = ""; let additionalArgs: string[] = []; - const isWindows: boolean = os.platform() === 'win32'; + if (compilerPath) { - if (compilerPath.endsWith("\\cl.exe") || compilerPath.endsWith("/cl.exe") || compilerPath === "cl.exe") { - // Input is only compiler name, this is only for cl.exe + if (compilerPathLowercase?.endsWith("\\cl.exe") || compilerPathLowercase?.endsWith("/cl.exe") || (compilerPathLowercase === "cl.exe")) { compilerName = path.basename(compilerPath); - } else if (compilerPath.startsWith("\"")) { // Input has quotes around compiler path const endQuote: number = compilerPath.substr(1).search("\"") + 1; @@ -969,12 +985,16 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp compilerName = path.basename(compilerPath); } } else { - // Input has no quotes but can have a compiler path with spaces and args. - // Go from right to left checking if a valid path is to the left of a space. + // Input has no quotes around compiler path let spaceStart: number = compilerPath.lastIndexOf(" "); - if (spaceStart !== -1 && (!isWindows || !compilerPath.endsWith("cl.exe")) && !checkFileExistsSync(compilerPath)) { + if (checkFileExistsSync(compilerPath)) { + // Get compiler name if there are no args but path is valid. + compilerName = path.basename(compilerPath); + } else if (spaceStart !== -1 && !checkFileExistsSync(compilerPath)) { + // Get compiler name if compiler path has spaces and args. + // Go from right to left checking if a valid path is to the left of a space. let potentialCompilerPath: string = compilerPath.substr(0, spaceStart); - while ((!isWindows || !potentialCompilerPath.endsWith("cl.exe")) && !checkFileExistsSync(potentialCompilerPath)) { + while (!checkFileExistsSync(potentialCompilerPath)) { spaceStart = potentialCompilerPath.lastIndexOf(" "); if (spaceStart === -1) { // Reached the start without finding a valid path. Use the original value. @@ -987,12 +1007,8 @@ export function extractCompilerPathAndArgs(inputCompilerPath?: string, inputComp // Found a valid compilerPath and args. additionalArgs = extractArgs(compilerPath.substr(spaceStart + 1)); compilerPath = potentialCompilerPath; + compilerName = path.basename(potentialCompilerPath); } - compilerName = path.basename(compilerPath); - } - // Get compiler name if there are no args but path is valid or a valid path was found with args. - if (compilerPath === "cl.exe" || checkFileExistsSync(compilerPath)) { - compilerName = path.basename(compilerPath); } } } diff --git a/Extension/ui/settings.html b/Extension/ui/settings.html index 429e85a859..4f6b035006 100644 --- a/Extension/ui/settings.html +++ b/Extension/ui/settings.html @@ -455,7 +455,7 @@ -
+
@@ -473,6 +473,7 @@ +
@@ -504,11 +505,39 @@
IntelliSense mode
- The IntelliSense mode to use that maps to an architecture-specific variant of MSVC, gcc, or Clang. If not set or if set to ${default}, the extension will choose the default for that platform. Windows defaults to msvc-x64, Linux defaults to gcc-x64, and macOS defaults to clang-x64. Select a specific IntelliSense mode to override the ${default} mode. + The IntelliSense mode to use that maps to a platform and architecture variant of MSVC, gcc, or Clang. If not set or if set to ${default}, the extension will choose the default for that platform. Windows defaults to windows-msvc-x64, Linux defaults to linux-gcc-x64, and macOS defaults to macos-clang-x64. Select a specific IntelliSense mode to override the ${default} mode.