microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.52k stars 1.55k forks source link

clang-tidy and `"editor.formatOnSave": true,` not updating properly on save #12716

Closed thernstig closed 1 month ago

thernstig commented 1 month ago

Environment

OS and Version: Windows 11 23H2 VS Code Version: 1.92.2 C/C++ Extension Version: v1.21.6 If using SSH remote, specify OS of remote machine: wsl (Ubuntu 20.04)

Bug Summary and Steps to Reproduce

Bug Summary:

clang-tidy and "editor.formatOnSave": true, not updating properly on save. The integration works when opening a file or reloading VS Code. But often when working and save all the time, the clang-tidy output does not get updated. It works fine via the CLI clang-tidy so this is a VS Code extension/integration fault towards clang-tidy.

image

Another example without the ErrorLens extension enabled:

image

Running it in the shell shows:

> clang-tidy -quiet -p build/Debug/ src/helloworld.c 
1387 warnings generated.

Steps to reproduce:

  1. Enable this in config:

  2. {
    "editor.formatOnPaste": true,
    "editor.formatOnSave": true,
    "C_Cpp.codeAnalysis.clangTidy.enabled": true
    }
  3. Enable this in .clang-tidy and .clang-format:

# yaml-language-server: $schema=https://json.schemastore.org/clang-tidy.json

Checks:
  - "*"
  - "-llvmlibc-restrict-system-libc-headers"
  - "-llvm-include-order"
# yaml-language-server: $schema=https://json.schemastore.org/clang-format.json

BasedOnStyle: Chromium

InsertNewlineAtEOF: true
IncludeBlocks: "Regroup"
  1. Try to edit the file and save every now and then and invoke various linting errors.

Expected behavior: For it to work. This is a rather crucial bug I would say, as this not working will be a large time sink for teams as we cannot see faults properly directly when we code, but have to run the linting separately in one way or another.

Configuration and Logs

`c_cpp_properties.json`

{
    "configurations": [
        {
            "name": "CMake as IntelliSense provider",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c99",
            "intelliSenseMode": "linux-gcc-x64",
            "compileCommands": "${config:cmake.buildDirectory}/compile_commands.json",
            "configurationProvider": "ms-vscode.cmake-tools"
        }
    ],
    "version": 4
}

`C/C++: Log Diagnostics`

-------- Diagnostics - 9/14/2024, 3:21:07 PM Version: 1.21.6 Current Configuration: { "name": "CMake as IntelliSense provider", "includePath": [ "/home/tobias/code/c-test/" ], "defines": [], "compilerPath": "/usr/bin/gcc", "cStandard": "c99", "intelliSenseMode": "linux-gcc-x64", "compileCommands": "/home/tobias/code/c-test/build/compile_commands.json", "configurationProvider": "ms-vscode.cmake-tools", "compilerPathIsExplicit": true, "cStandardIsExplicit": true, "cppStandardIsExplicit": false, "intelliSenseModeIsExplicit": true, "compilerPathInCppPropertiesJson": "/usr/bin/gcc", "compileCommandsInCppPropertiesJson": "${config:cmake.buildDirectory}/compile_commands.json", "configurationProviderInCppPropertiesJson": "ms-vscode.cmake-tools", "mergeConfigurations": false, "browse": { "path": [ "/home/tobias/code/c-test/", "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": true } } Custom browse configuration: { "browsePath": [ "/home/tobias/code/c-test/src" ], "compilerPath": "/usr/bin/gcc", "compilerArgs": [], "compilerFragments": [ "-g -std=gnu90" ] } cpptools version (native): 1.21.6.0 Translation Unit Mappings: [ /home/tobias/code/c-test/src/helloworld.c - source TU]: /usr/include/stdio.h [ /home/tobias/code/c-test/src/main.c - source TU]: Translation Unit Configurations: [ /home/tobias/code/c-test/src/helloworld.c ]: Process ID: 23834 Memory Usage: 20 MB Compiler Path: /usr/bin/gcc Includes: System Includes: /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include Standard Version: c23 IntelliSense Mode: linux-gcc-x64 Other Flags: --gcc --gnu_version=90400 [ /home/tobias/code/c-test/src/main.c ]: Process ID: 23756 Memory Usage: 15 MB Compiler Path: /usr/bin/gcc Includes: System Includes: /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/local/include /usr/include/x86_64-linux-gnu /usr/include Standard Version: c23 IntelliSense Mode: linux-gcc-x64 Other Flags: --gcc --gnu_version=90400 Total Memory Usage: 35 MB Browse Paths from compile_commands.json, from workspace folder: /home/tobias/code/c-test /home/tobias/code/c-test/src

------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 4909


`LSP logging`

```sh
LSP: (received) cpptools/formatDocument: file: ///home/tobias/code/c-test/src/helloworld.c (id: 598)
LSP: (invoked) cpptools/formatDocument: file: ///home/tobias/code/c-test/src/helloworld.c (id: 598)
Formatting document: file: ///home/tobias/code/c-test/src/helloworld.c
Formatting Engine: clangFormat
/home/tobias/.vscode-server/extensions/ms-vscode.cpptools-1.21.6-linux-x64/bin/../LLVM/bin/clang-format -style=file -fallback-style=LLVM --Wno-error=unknown -assume-filename=/home/tobias/code/c-test/src/helloworld.c
LSP: Sending response (id: 598)
LSP: (received) textDocument/willSaveWaitUntil: file: ///home/tobias/code/c-test/src/helloworld.c (id: 599)
LSP: (invoked) textDocument/willSaveWaitUntil: file: ///home/tobias/code/c-test/src/helloworld.c (id: 599)
LSP: Sending response (id: 599)
willSaveWaitUntil: 0ms
LSP: (received) textDocument/didSave: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) textDocument/didSave: file: ///home/tobias/code/c-test/src/helloworld.c
Intellisense update pending for: file: ///home/tobias/code/c-test/src/helloworld.c
tag parsing file: /home/tobias/code/c-test/src/helloworld.c
/home/tobias/.vscode-server/extensions/ms-vscode.cpptools-1.21.6-linux-x64/bin/../LLVM/bin/clang-tidy
--export-fixes=/tmp/{
    12457784936315504446
}/fixes140425389894448.yaml
--quiet
--use-color=false
/home/tobias/code/c-test/src/helloworld.c
--
-std=c2x
-xc
-Wno-pragma-pack
-Wno-pragma-once-outside-header
-D__SSP_STRONG__=3
-D__DBL_MIN_EXP__=(-1021)
-D__FLT32X_MAX_EXP__=1024
-D__UINT_LEAST16_MAX__=0xffff
-D__ATOMIC_ACQUIRE=2
-D__FLT128_MAX_10_EXP__=4932
-D__FLT_MIN__=1.17549435082228750796873653722224568e-38F
-D__GCC_IEC_559_COMPLEX=2
-D__UINT_LEAST8_TYPE__=unsigned char
-D__INTMAX_C(c)=c ## L
-D__CHAR_BIT__=8
-D__UINT8_MAX__=0xff
-D__WINT_MAX__=0xffffffffU
-D__FLT32_MIN_EXP__=(-125)
-D__ORDER_LITTLE_ENDIAN__=1234
-D__SIZE_MAX__=0xffffffffffffffffUL
-D__WCHAR_MAX__=0x7fffffff
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2=1
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4=1
-D__DBL_DENORM_MIN__=((double)4.94065645841246544176568792868221372e-324L)
-D__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8=1
-D__GCC_ATOMIC_CHAR_LOCK_FREE=2
-D__GCC_IEC_559=2
-D__FLT32X_DECIMAL_DIG__=17
-D__FLT_EVAL_METHOD__=0
-D__unix__=1
-D__FLT64_DECIMAL_DIG__=17
-D__CET__=3
-D__GCC_ATOMIC_CHAR32_T_LOCK_FREE=2
-D__x86_64=1
-D__UINT_FAST64_MAX__=0xffffffffffffffffUL
-D__SIG_ATOMIC_TYPE__=int
-D__DBL_MIN_10_EXP__=(-307)
-D__FINITE_MATH_ONLY__=0
-D__FLT32_HAS_DENORM__=1
-D__UINT_FAST8_MAX__=0xff
-D__DEC64_MAX_EXP__=385
-D__INT8_C(c)=c
-D__INT_LEAST8_WIDTH__=8
-D__UINT_LEAST64_MAX__=0xffffffffffffffffUL
-D__SHRT_MAX__=0x7fff
-D__LDBL_MAX__=1.18973149535723176502126385303097021e+4932L
-D__FLT64X_MAX_10_EXP__=4932
-D__UINT_LEAST8_MAX__=0xff
-D__GCC_ATOMIC_BOOL_LOCK_FREE=2
-D__FLT128_DENORM_MIN__=6.47517511943802511092443895822764655e-4966F128
-D__UINTMAX_TYPE__=long unsigned int
-D__linux=1
-D__DEC32_EPSILON__=1E-6DF
-D__FLT_EVAL_METHOD_TS_18661_3__=0
-D__unix=1
-D__UINT32_MAX__=0xffffffffU
-D__LDBL_MAX_EXP__=16384
-D__FLT128_MIN_EXP__=(-16381)
-D__WINT_MIN__=0U
-D__linux__=1
-D__FLT128_MIN_10_EXP__=(-4931)
-D__INT_LEAST16_WIDTH__=16
-D__SCHAR_MAX__=0x7f
-D__FLT128_MANT_DIG__=113
-D__WCHAR_MIN__=(-__WCHAR_MAX__ - 1)
-D__INT64_C(c)=c ## L
-D__DBL_DIG__=15
-D__GCC_ATOMIC_POINTER_LOCK_FREE=2
-D__FLT64X_MANT_DIG__=64
-D__SIZEOF_INT__=4
-D__SIZEOF_POINTER__=8
-D__USER_LABEL_PREFIX__=
-D__FLT64X_EPSILON__=1.08420217248550443400745280086994171e-19F64x
-D__STDC_HOSTED__=1
-D__LDBL_HAS_INFINITY__=1
-D__FLT32_DIG__=6
-D__FLT_EPSILON__=1.19209289550781250000000000000000000e-7F
-D__SHRT_WIDTH__=16
-D__LDBL_MIN__=3.36210314311209350626267781732175260e-4932L
-D__DEC32_MAX__=9.999999E96DF
-D__FLT64X_DENORM_MIN__=3.64519953188247460252840593361941982e-4951F64x
-D__FLT32X_HAS_INFINITY__=1
-D__INT32_MAX__=0x7fffffff
-D__INT_WIDTH__=32
-D__SIZEOF_LONG__=8
-D__STDC_IEC_559__=1
-D__STDC_ISO_10646__=201706L
-D__UINT16_C(c)=c
-D__PTRDIFF_WIDTH__=64
-D__DECIMAL_DIG__=21
-D__FLT64_EPSILON__=2.22044604925031308084726333618164062e-16F64
-D__gnu_linux__=1
-D__INTMAX_WIDTH__=64
-D__FLT64X_MIN_10_EXP__=(-4931)
-D__LDBL_HAS_QUIET_NAN__=1
-D__FLT64_MANT_DIG__=53
-D__pie__=2
-D__MMX__=1
-D__FLT_HAS_DENORM__=1
-D__SIZEOF_LONG_DOUBLE__=16
-D__BIGGEST_ALIGNMENT__=16
-D__FLT64_MAX_10_EXP__=308
-D__DBL_MAX__=((double)1.79769313486231570814527423731704357e+308L)
-D__INT_FAST32_MAX__=0x7fffffffffffffffL
-D__DBL_HAS_INFINITY__=1
-D__HAVE_SPECULATION_SAFE_VALUE=1
-D__DEC32_MIN_EXP__=(-94)
-D__INTPTR_WIDTH__=64
-D__FLT32X_HAS_DENORM__=1
-D__INT_FAST16_TYPE__=long int
-D__LDBL_HAS_DENORM__=1
-D__FLT128_HAS_INFINITY__=1
-D__DEC128_MAX__=9.999999999999999999999999999999999E6144DL
-D__INT_LEAST32_MAX__=0x7fffffff
-D__DEC32_MIN__=1E-95DF
-D__DBL_MAX_EXP__=1024
-D__WCHAR_WIDTH__=32
-D__FLT32_MAX__=3.40282346638528859811704183484516925e+38F32
-D__DEC128_EPSILON__=1E-33DL
-D__ATOMIC_HLE_RELEASE=131072
-D__PTRDIFF_MAX__=0x7fffffffffffffffL
-D__amd64=1
-D__ATOMIC_HLE_ACQUIRE=65536
-D__FLT32_HAS_QUIET_NAN__=1
-D__LONG_LONG_MAX__=0x7fffffffffffffffLL
-D__SIZEOF_SIZE_T__=8
-D__FLT64X_MIN_EXP__=(-16381)
-D__SIZEOF_WINT_T__=4
-D__LONG_LONG_WIDTH__=64
-D__FLT32_MAX_EXP__=128
-D__GCC_HAVE_DWARF2_CFI_ASM=1
-D__GXX_ABI_VERSION=1013
-D__FLT_MIN_EXP__=(-125)
-D__FLT64X_HAS_QUIET_NAN__=1
-D__INT_FAST64_TYPE__=long int
-D__FLT64_DENORM_MIN__=4.94065645841246544176568792868221372e-324F64
-D__DBL_MIN__=((double)2.22507385850720138309023271733240406e-308L)
-D__PIE__=2
-D__LP64__=1
-D__FLT32X_EPSILON__=2.22044604925031308084726333618164062e-16F32x
-D__DECIMAL_BID_FORMAT__=1
-D__FLT64_MIN_EXP__=(-1021)
-D__FLT64_MIN_10_EXP__=(-307)
-D__FLT64X_DECIMAL_DIG__=21
-D__DEC128_MIN__=1E-6143DL
-D__REGISTER_PREFIX__=
-D__UINT16_MAX__=0xffff
-D__DBL_HAS_DENORM__=1
-D__FLT32_MIN__=1.17549435082228750796873653722224568e-38F32
-D__UINT8_TYPE__=unsigned char
-D__NO_INLINE__=1
-D__FLT_MANT_DIG__=24
-D__LDBL_DECIMAL_DIG__=21
-D__UINT64_C(c)=c ## UL
-D_STDC_PREDEF_H=1
-D__GCC_ATOMIC_INT_LOCK_FREE=2
-D__FLT128_MAX_EXP__=16384
-D__FLT32_MANT_DIG__=24
-D__FLOAT_WORD_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__STDC_IEC_559_COMPLEX__=1
-D__FLT128_HAS_DENORM__=1
-D__FLT128_DIG__=33
-D__SCHAR_WIDTH__=8
-D__INT32_C(c)=c
-D__DEC64_EPSILON__=1E-15DD
-D__ORDER_PDP_ENDIAN__=3412
-D__DEC128_MIN_EXP__=(-6142)
-D__FLT32_MAX_10_EXP__=38
-D__INT_FAST32_TYPE__=long int
-D__UINT_LEAST16_TYPE__=short unsigned int
-D__FLT64X_HAS_INFINITY__=1
-Dunix=1
-D__INT16_MAX__=0x7fff
-D__SIZE_TYPE__=long unsigned int
-D__UINT64_MAX__=0xffffffffffffffffUL
-D__FLT64X_DIG__=18
-D__INT8_TYPE__=signed char
-D__ELF__=1
-D__GCC_ASM_FLAG_OUTPUTS__=1
-D__FLT_RADIX__=2
-D__INT_LEAST16_TYPE__=short int
-D__LDBL_EPSILON__=1.08420217248550443400745280086994171e-19L
-D__UINTMAX_C(c)=c ## UL
-D__k8=1
-D__SIG_ATOMIC_MAX__=0x7fffffff
-D__GCC_ATOMIC_WCHAR_T_LOCK_FREE=2
-D__SIZEOF_PTRDIFF_T__=8
-D__FLT32X_MANT_DIG__=53
-D__x86_64__=1
-D__FLT32X_MIN_EXP__=(-1021)
-D__DEC32_SUBNORMAL_MIN__=0.000001E-95DF
-D__INT_FAST16_MAX__=0x7fffffffffffffffL
-D__FLT64_DIG__=15
-D__UINT_FAST32_MAX__=0xffffffffffffffffUL
-D__UINT_LEAST64_TYPE__=long unsigned int
-D__FLT_HAS_QUIET_NAN__=1
-D__FLT_MAX_10_EXP__=38
-D__LONG_MAX__=0x7fffffffffffffffL
-D__FLT64X_HAS_DENORM__=1
-D__DEC128_SUBNORMAL_MIN__=0.000000000000000000000000000000001E-6143DL
-D__FLT_HAS_INFINITY__=1
-D__UINT_FAST16_TYPE__=long unsigned int
-D__DEC64_MAX__=9.999999999999999E384DD
-D__INT_FAST32_WIDTH__=64
-D__CHAR16_TYPE__=short unsigned int
-D__PRAGMA_REDEFINE_EXTNAME=1
-D__SIZE_WIDTH__=64
-D__SEG_FS=1
-D__INT_LEAST16_MAX__=0x7fff
-D__DEC64_MANT_DIG__=16
-D__INT64_MAX__=0x7fffffffffffffffL
-D__UINT_LEAST32_MAX__=0xffffffffU
-D__SEG_GS=1
-D__FLT32_DENORM_MIN__=1.40129846432481707092372958328991613e-45F32
-D__GCC_ATOMIC_LONG_LOCK_FREE=2
-D__SIG_ATOMIC_WIDTH__=32
-D__INT_LEAST64_TYPE__=long int
-D__INT16_TYPE__=short int
-D__INT_LEAST8_TYPE__=signed char
-D__DEC32_MAX_EXP__=97
-D__INT_FAST8_MAX__=0x7f
-D__FLT128_MAX__=1.18973149535723176508575932662800702e+4932F128
-D__INTPTR_MAX__=0x7fffffffffffffffL
-Dlinux=1
-D__FLT64_HAS_QUIET_NAN__=1
-D__FLT32_MIN_10_EXP__=(-37)
-D__FLT32X_DIG__=15
-D__LDBL_MANT_DIG__=64
-D__DBL_HAS_QUIET_NAN__=1
-D__FLT64_HAS_INFINITY__=1
-D__FLT64X_MAX__=1.18973149535723176502126385303097021e+4932F64x
-D__SIG_ATOMIC_MIN__=(-__SIG_ATOMIC_MAX__ - 1)
-D__code_model_small__=1
-D__k8__=1
-D__INTPTR_TYPE__=long int
-D__UINT16_TYPE__=short unsigned int
-D__WCHAR_TYPE__=int
-D__SIZEOF_FLOAT__=4
-D__pic__=2
-D__UINTPTR_MAX__=0xffffffffffffffffUL
-D__INT_FAST64_WIDTH__=64
-D__DEC64_MIN_EXP__=(-382)
-D__FLT32_DECIMAL_DIG__=9
-D__INT_FAST64_MAX__=0x7fffffffffffffffL
-D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1
-D__FLT_DIG__=6
-D__FLT32_HAS_INFINITY__=1
-D__FLT64X_MAX_EXP__=16384
-D__UINT_FAST64_TYPE__=long unsigned int
-D__INT_MAX__=0x7fffffff
-D__amd64__=1
-D__INT64_TYPE__=long int
-D__FLT_MAX_EXP__=128
-D__ORDER_BIG_ENDIAN__=4321
-D__DBL_MANT_DIG__=53
-D__SIZEOF_FLOAT128__=16
-D__INT_LEAST64_MAX__=0x7fffffffffffffffL
-D__GCC_ATOMIC_CHAR16_T_LOCK_FREE=2
-D__DEC64_MIN__=1E-383DD
-D__WINT_TYPE__=unsigned int
-D__UINT_LEAST32_TYPE__=unsigned int
-D__SIZEOF_SHORT__=2
-D__LDBL_MIN_EXP__=(-16381)
-D__FLT64_MAX__=1.79769313486231570814527423731704357e+308F64
-D__WINT_WIDTH__=32
-D__INT_LEAST8_MAX__=0x7f
-D__FLT32X_MAX_10_EXP__=308
-D__SIZEOF_INT128__=16
-D__LDBL_MAX_10_EXP__=4932
-D__ATOMIC_RELAXED=0
-D__DBL_EPSILON__=((double)2.22044604925031308084726333618164062e-16L)
-D__FLT128_MIN__=3.36210314311209350626267781732175260e-4932F128
-D_LP64=1
-D__UINT8_C(c)=c
-D__FLT64_MAX_EXP__=1024
-D__INT_LEAST32_TYPE__=int
-D__SIZEOF_WCHAR_T__=4
-D__UINT64_TYPE__=long unsigned int
-D__FLT128_HAS_QUIET_NAN__=1
-D__INT_FAST8_TYPE__=signed char
-D__FLT64X_MIN__=3.36210314311209350626267781732175260e-4932F64x
-D__FLT64_HAS_DENORM__=1
-D__FLT32_EPSILON__=1.19209289550781250000000000000000000e-7F32
-D__DBL_DECIMAL_DIG__=17
-D__INT_FAST8_WIDTH__=8
-D__FXSR__=1
-D__DEC_EVAL_METHOD__=2
-D__FLT32X_MAX__=1.79769313486231570814527423731704357e+308F32x
-D__UINT32_C(c)=c ## U
-D__INTMAX_MAX__=0x7fffffffffffffffL
-D__BYTE_ORDER__=__ORDER_LITTLE_ENDIAN__
-D__FLT_DENORM_MIN__=1.40129846432481707092372958328991613e-45F
-D__INT8_MAX__=0x7f
-D__LONG_WIDTH__=64
-D__PIC__=2
-D__UINT_FAST32_TYPE__=long unsigned int
-D__CHAR32_TYPE__=unsigned int
-D__FLT_MAX__=3.40282346638528859811704183484516925e+38F
-D__INT32_TYPE__=int
-D__SIZEOF_DOUBLE__=8
-D__FLT_MIN_10_EXP__=(-37)
-D__FLT64_MIN__=2.22507385850720138309023271733240406e-308F64
-D__INT_LEAST32_WIDTH__=32
-D__INTMAX_TYPE__=long int
-D__DEC128_MAX_EXP__=6145
-D__FLT32X_HAS_QUIET_NAN__=1
-D__ATOMIC_CONSUME=1
-D__INT_FAST16_WIDTH__=64
-D__UINTMAX_MAX__=0xffffffffffffffffUL
-D__DEC32_MANT_DIG__=7
-D__FLT32X_DENORM_MIN__=4.94065645841246544176568792868221372e-324F32x
-D__DBL_MAX_10_EXP__=308
-D__LDBL_DENORM_MIN__=3.64519953188247460252840593361941982e-4951L
-D__INT16_C(c)=c
-D__STDC__=1
-D__PTRDIFF_TYPE__=long int
-D__ATOMIC_SEQ_CST=5
-D__UINT32_TYPE__=unsigned int
-D__FLT32X_MIN_10_EXP__=(-307)
-D__UINTPTR_TYPE__=long unsigned int
-D__DEC64_SUBNORMAL_MIN__=0.000000000000001E-383DD
-D__DEC128_MANT_DIG__=34
-D__LDBL_MIN_10_EXP__=(-4931)
-D__FLT128_EPSILON__=1.92592994438723585305597794258492732e-34F128
-D__SIZEOF_LONG_LONG__=8
-D__FLT128_DECIMAL_DIG__=36
-D__GCC_ATOMIC_LLONG_LOCK_FREE=2
-D__FLT32X_MIN__=2.22507385850720138309023271733240406e-308F32x
-D__LDBL_DIG__=18
-D__FLT_DECIMAL_DIG__=9
-D__UINT_FAST16_MAX__=0xffffffffffffffffUL
-D__GNUC_GNU_INLINE__=1
-D__GCC_ATOMIC_SHORT_LOCK_FREE=2
-D__INT_LEAST64_WIDTH__=64
-D__UINT_FAST8_TYPE__=unsigned char
-D__ATOMIC_ACQ_REL=4
-D__ATOMIC_RELEASE=3
-isystem/usr/lib/gcc/x86_64-linux-gnu/9/include
-isystem/usr/local/include
-isystem/usr/include/x86_64-linux-gnu
-isystem/usr/include
LSP: (received) cpptools/fileChanged: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) cpptools/fileChanged: file: ///home/tobias/code/c-test/src/helloworld.c
warning: redefining builtin macro [clang-diagnostic-builtin-macro-redefined
]
IntelliSense update scheduled and TU acquisition started for: file: ///home/tobias/code/c-test/src/helloworld.c
Update IntelliSense time (sec): 0.002
LSP: (received) cpptools/getFoldingRanges: file: ///home/tobias/code/c-test/src/helloworld.c (id: 600)
LSP: (invoked) cpptools/getFoldingRanges: file: ///home/tobias/code/c-test/src/helloworld.c (id: 600)
LSP: Sending response (id: 600)
LSP: (received) cpptools/getDocumentSymbols: file: ///home/tobias/code/c-test/src/helloworld.c (id: 601)
LSP: (invoked) cpptools/getDocumentSymbols: file: ///home/tobias/code/c-test/src/helloworld.c (id: 601)
LSP: Sending response (id: 601)
LSP: (received) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file: ///home/tobias/code/c-test/src/helloworld.c (id: 602)
LSP: (invoked) cpptools/getCodeActions: file: ///home/tobias/code/c-test/src/helloworld.c (id: 602)
LSP: Sending response (id: 602)
Database safe to open.
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (invoked) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (invoked) cpptools/didChangeActiveEditor: file: ///home/tobias/code/c-test/src/helloworld.c
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors


### Other Extensions

_No response_

### Additional context

_No response_
sean-mcmanus commented 1 month ago

Your screenshot says the clang-tidy warning is from a "GCC" source, which is not our extension. Are you able to repro the bug using the clang-tidy integration from our extension?

thernstig commented 1 month ago

@sean-mcmanus I do not have any other C/C++ extensions in my repo. The problems look like this in the problems pane:

image

These are the enabled extensions:

image

It is from your extensions. See here:

image

thernstig commented 1 month ago

@sean-mcmanus I accidantelly closed this, can you please re-open?

I did some more extensive testing. You can see in this image that the only extensions enabled are the Remote Development (locally) and the 4 extensions you see in the remote in the picture below.

image

For reference, It seems it is your sister extension CMake Tools that does add the extra warnings seen.

But neither your, nor the CMake Tools extension is clearing the issues properly on save. It is very easy to reproduce. Just introduce a variable with a short name of one character, save, change it to a longer one, save again etc.

sean-mcmanus commented 1 month ago

@thernstig I think the C/C++ issues may be our bugs.

bobbrow commented 1 month ago

My recollection is that the CMake Tools extension only adds and removes problems after a build. If the GCC problems are coming from CMake Tools, the way to clear them is to rebuild. If you don't want CMake Tools to report build errors in the Problems, I believe there is a setting for that.

thernstig commented 1 month ago

@bobbrow @sean-mcmanus you are entirely correct! I am tracking it with the CMake Tools extension here instead https://github.com/microsoft/vscode-cmake-tools/issues/4079 A way to disable this have been given in that thread. I believe there is a better UX around this that makes sense and has proposed it in that thread.

However, there is still a bug with also the C/C++ extension. See this video:

https://github.com/user-attachments/assets/2fc3f4b1-73bb-490f-a3b0-eecc47235bdc

Notice how the error from this extension is visible. I then just plainly save the file. And then this extensions' error is gone even though I did not fix the problem.

So the error seen here is not exactly as described in the original post, but related. Should I create a new issue or reopen this one?