microsoft / microsoft/vscode-cpptools

Incomplete presentation of warnings in editor when build tasks are set to use 'shared' panels, reveal policy 'silent'.

Open
#11,950 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Language Service tasks/build/debug
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows_NT x64 10.0.19045
  • VS Code Version: 1.86.1 (system setup)
  • C/C++ Extension Version: v1.18.5, also reproduced in many early versions, like v1.12.4.
  • If using SSH remote, specify OS of remote machine: Ubuntu 23.10. ONLY REPRODUCED VIA SSH REMOTE, not locally.
  • GCC Version: 13.2.0 (Ubuntu 13.2.0-4ubuntu3)
Bug Summary and Steps to Reproduce
Bug Summary

When I compile C++ code on remote machines (connected through 'Remote - SSH') multiple times, warnings thrown by GCC could not be displayed properly in editor. As number of times I compile the same piece of code increases, warnings shown correctly in editor vanish one by one.

Steps to reproduce
  1. Connect to a remote Ubuntu machine with 'C/C++' extension installed via 'Remote - SSH'.
  2. Insert the following content in .vscode/tasks.json:
{
	"version": "2.0.0",
	"tasks": [
		{
			"label": "sysGCC Compile - Debug",
			"type": "cppbuild",
			"command": "g++",
			"args": [
				"${file}",
				"-o",
				"${fileBasenameNoExtension}",
				"-Wall",
				"-Wconversion",
				"-Wshadow",
				"-Wextra",
				"-g",
				"-std=c++14"
			],
			"presentation": {
				"echo": true,
				"reveal": "silent",
				"focus": false,
				"panel": "shared",
				"showReuseMessage": false,
				"clear": true
			},
			"options": {
				"cwd": "${fileDirname}"
			}
		}
	]
}
  1. Add a new C++ source file. Here is an example. Its content doesn't matter — one may replace it with some other code that also triggers many warnings, but no errors.
  2. Run task 'sysGCC Compile - Debug' multiple times. Do not open the panel, as we set presention > reveal policy as silent. Pay attention to warnings shown in the editor at the first time the file is compiled. Then run the task again for a couple of times. Each time, only a subset of warnings shown are preserved; the others disappeared.
  3. Open the panel, take a look at the warnings thrown by GCC, output to shell. One may find that only a subset of them are shown in the editor.
  4. Press any key to terminate the shell, close the panel and run the task again. All warnings are shown correctly. One may goto step 4 and repeat the process above.
  5. Edit .vscode/tasks.json, replace section presentation with
"presentation": {
	"echo": true,
	"reveal": "always",
	"focus": false,
	"panel": "shared",
	"showReuseMessage": false,
	"clear": true
}

or whatever configuration that does not use a shared, unrevealed panel, for instance

"presentation": {
	"echo": true,
	"reveal": "silent",
	"focus": false,
	"panel": "new",
	"showReuseMessage": false,
	"clear": true
}
  1. Now run the task multiple times. The issue does not occur anymore.

This bug could not be reproduced on my local environments, neither on Windows 10 nor Ubuntu 23.10.

Expected behavior

Show all warnings correctly in editor, no matter how section presentation of a task is configured.

Configuration and Logs
c_cpp_properties.json
{
    "configurations": [
        {
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/gcc",
            "cStandard": "c17",
            "cppStandard": "gnu++17",
            "intelliSenseMode": "linux-gcc-x64"
        }
    ],
    "version": 4
}

C/C++: Log Diagnostics
-------- Diagnostics - 2024/2/10 23:35:36
Version: 1.18.5
Current Configuration:
{
    "name": "Linux",
    "includePath": [
        "/Documents/OI/temp/**"
    ],
    "defines": [],
    "compilerPath": "/usr/bin/gcc",
    "cStandard": "c17",
    "cppStandard": "gnu++17",
    "intelliSenseMode": "linux-gcc-x64",
    "compilerPathIsExplicit": true,
    "cStandardIsExplicit": true,
    "cppStandardIsExplicit": true,
    "intelliSenseModeIsExplicit": true,
    "compilerPathInCppPropertiesJson": "/usr/bin/gcc",
    "mergeConfigurations": false,
    "browse": {
        "path": [
            "/Documents/OI/temp/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
cpptools version (native): 1.18.3.0
Translation Unit Mappings:
[ /Documents/OI/temp/a.cpp ]:
    /Documents/OI/temp/a.cpp
Translation Unit Configurations:
[ /Documents/OI/temp/a.cpp ]:
    Process ID: 213821
    Memory Usage: 235 MB
    Compiler Path: /usr/bin/gcc
    Includes:
        /usr/include/c++/13
        /usr/include/x86_64-linux-gnu/c++/13
        /usr/include/c++/13/backward
        /usr/lib/gcc/x86_64-linux-gnu/13/include
        /usr/local/include
        /usr/include/x86_64-linux-gnu
        /usr/include
    Standard Version: c++17
    IntelliSense Mode: linux-gcc-x64
    Other Flags:
        --g++
        --gnu_version=130200
Total Memory Usage: 235 MB

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

Logs from the language server logging
LSP: (received) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 182)
LSP: (invoked) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 182)
LSP: (received) textDocument/documentHighlight: file:///Documents/OI/temp/a.cpp (id: 183)
LSP: (invoked) textDocument/documentHighlight: file:///Documents/OI/temp/a.cpp (id: 183)
LSP: (received) cpptools/textEditorSelectionChange
LSP: (invoked) cpptools/textEditorSelectionChange
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 184)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 184)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 185)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 185)
LSP: (received) cpptools/activeDocumentChange: file:///Documents/OI/temp/a.cpp
LSP: (received) cpptools/textEditorSelectionChange
LSP: (received) cpptools/textEditorSelectionChange
LSP: (invoked) cpptools/activeDocumentChange: file:///Documents/OI/temp/a.cpp
LSP: (invoked) cpptools/textEditorSelectionChange
LSP: (invoked) cpptools/textEditorSelectionChange
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 186)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 186)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 187)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 187)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/fileDeleted: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileDeleted: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileCreated: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileCreated: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 188)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 188)
Error squiggle count: 0
Update IntelliSense time (sec): 0.559
LSP: (received) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 189)
LSP: (invoked) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 189)
LSP: (received) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 190)
LSP: (invoked) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 190)
LSP: (received) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 191)
LSP: (invoked) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 191)
LSP: (received) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 192)
LSP: (invoked) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 192)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 193)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 193)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 194)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 194)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileDeleted: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileDeleted: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/fileCreated: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileCreated: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 195)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 195)
Error squiggle count: 0
Update IntelliSense time (sec): 0.558
LSP: (received) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 196)
LSP: (invoked) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 196)
LSP: (received) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 197)
LSP: (invoked) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 197)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 198)
LSP: (invoked) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 198)
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileDeleted: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileDeleted: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/fileCreated: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileCreated: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 199)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 199)
Error squiggle count: 0
Update IntelliSense time (sec): 0.558
LSP: (received) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 200)
LSP: (invoked) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 200)
LSP: (received) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 201)
LSP: (invoked) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 201)
LSP: (received) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 202)
LSP: (invoked) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 202)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/fileDeleted: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileDeleted: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/resumeCodeAnalysis
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/fileCreated: file:///Documents/OI/temp/a
LSP: (invoked) cpptools/fileCreated: file:///Documents/OI/temp/a
Checking for syntax errors: /Documents/OI/temp/a.cpp
Queueing IntelliSense update for files in translation unit of: /Documents/OI/temp/a.cpp
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 203)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 203)
Error squiggle count: 0
Update IntelliSense time (sec): 0.558
LSP: (received) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 204)
LSP: (invoked) cpptools/getSemanticTokens: file:///Documents/OI/temp/a.cpp (id: 204)
LSP: (received) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 205)
LSP: (invoked) cpptools/getInlayHints: file:///Documents/OI/temp/a.cpp (id: 205)
LSP: (received) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 206)
LSP: (invoked) cpptools/getFoldingRanges: file:///Documents/OI/temp/a.cpp (id: 206)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 207)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 207)
LSP: (received) cpptools/pauseCodeAnalysis
LSP: (invoked) cpptools/pauseCodeAnalysis
LSP: (received) cpptools/resumeCodeAnalysis
LSP: (invoked) cpptools/resumeCodeAnalysis
LSP: (received) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 208)
LSP: (invoked) textDocument/hover: file:///Documents/OI/temp/a.cpp (id: 208)
LSP: (received) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 209)
LSP: (invoked) cpptools/getCodeActions: file:///Documents/OI/temp/a.cpp (id: 209)
LSP: (received) textDocument/definition: file:///Documents/OI/temp/a.cpp (id: 210)
LSP: (invoked) textDocument/definition: file:///Documents/OI/temp/a.cpp (id: 210)
Other Extensions

Only a language pack and 'Remote - SSH' are activated, locally and remotely.

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue using the .vscode/tasks.json presentation settings, Remote - SSH, GCC, and the C/C++ extension; compare repeated task runs with shared/silent panels against new or revealed panels. Trace how task output becomes editor diagnostics, using c_cpp_properties.json and the supplied C/C++ logs as context. Done means all compiler warnings remain visible in the editor across repeated runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.