Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line wrapping in console results in duplicate problems #77475

Closed
joelspadin opened this issue Jul 16, 2019 · 5 comments
Closed

Line wrapping in console results in duplicate problems #77475

joelspadin opened this issue Jul 16, 2019 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues verified Verification succeeded windows VS Code on Windows issues
Milestone

Comments

@joelspadin
Copy link

Issue Type: Bug

When I run a task in a split terminal such that long warning/error messages wrap to multiple lines, I get two problems for every message that wraps. The first problem only contains the text on the first line, while the second problem contains the entire warning/error message. I specifically see this problem when building a C file with GCC and using the $gcc problem matcher. I do not know if the issue is specific to that problem matcher or if it is an issue with problem matchers in general.

I use waf.io to manage my build, which has many files, but I believe the problem can be reproduced using just GCC and a single C file. I am using GCC version 6.4.0. My tasks.json looks like this:

{
  "tasks": [
    {
      "label": "build",
      "type": "process",
      "command": "python",
      "args": ["waf.py"], // gcc.exe -Wdeprecated-declarations (plus other options not relevant to this issue)
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "problemMatcher": [
        { 
          "base": "$gcc",
          "fileLocation": ["autoDetect", "${workspaceFolder}/build"]
        }
      ]
    }
  ]
}

Then I have a file which generates a long warning message:

// ./compiler.h
#if defined(__GNUC__)
    #define DEPRECATED(func)    __attribute__ ((deprecated)) func
#else
    // implementations for other compilers would go here.
    #define DEPRECATED(func)    func
#endif
// ./some/really/long/path/to/header.h
#include "compiler.h"

// This used to do something, but now it isn't necessary.
static DEPRECATED( __inline int old_function(void) )
{
    return 1;
}
// ./some/really/long/path/to/source.c
#include "header.h"

int main(void)
{
    if (old_function())
    {
        // do something
    }
}

Compiling this results in a warning which looks something like:

..\some\really\long\path\to\source.c:6:8: warning: 'old_function' is deprecated[-Wdeprecated-declarations]
     if (old_function())
         ^~~~~~~~~~~~
In file included from ..\some\really\long\path\to\header.h:2
                      ..\some\really\long\path\to\source.c:2:
C:\projects\example\some\really\long\path\to\header.h:4:51 note: declared here
 static DEPRECATED( __inline void old_function(void) )
                                  ^  
C:\projects\example\compiler.h note: in definition of macro 'DEPRECATED'
 #define DEPRECATED(func)    __attribute__ ((deprecated)) func
                                                          ^~~~

If I am running the build task in a split terminal, that first line tends to get wrapped to something like this:

..\some\really\long\path\to\source.c:5:8: warning: 'old_function' is deprecated[-Wd
eprecated-declarations]

And then in the problems pane I will get two problems:

source.c some\really\long\path\to (2)
    'old_function' is deprecated [-Wd gcc [6, 8]
    'old_function' is deprecated [-Wdeprecated-declarations] gcc [6, 8]

If I run the build task in a terminal that is wide enough that the warning does not get wrapped, then only one problem appears, as I would expect.

VS Code version: Code 1.36.1 (2213894, 2019-07-08T22:59:35.033Z)
OS version: Windows_NT x64 6.1.7601

System Info
Item Value
CPUs Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz (8 x 3392)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: unavailable_off
protected_video_decode: unavailable_off
rasterization: unavailable_off
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: unavailable_off
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 31.96GB (13.88GB free)
Process Argv -n
Screen Reader no
VM 0%
Extensions
Extension Author (truncated) Version
gitignore cod 0.6.0
arm dan 0.5.0
xml Dot 2.5.0
gitlens eam 9.8.5
tsl-problem-matcher eam 0.0.4
EditorConfig Edi 0.13.0
vscode-npm-script eg2 0.3.8
json-tools eri 1.0.2
bitbake Eug 1.1.2
gc-excelviewer Gra 2.1.32
tabsanity jed 0.0.11
nearley kar 1.0.3
rainbow-csv mec 1.1.1
python ms- 2019.6.24221
cpptools ms- 0.24.0
vscode-typescript-tslint-plugin ms- 1.2.2
autodocstring njp 0.3.0
rewrap stk 1.9.1
vscode-icons vsc 8.8.0
better-align wwm 1.1.6
@vscodebot vscodebot bot added the tasks Task system issues label Jul 16, 2019
@alexr00 alexr00 added this to the August 2019 milestone Jul 29, 2019
@alexr00 alexr00 added the bug Issue identified by VS Code Team member as probable bug label Aug 13, 2019
@roblourens roblourens added verified Verification succeeded and removed verified Verification succeeded labels Aug 29, 2019
@roblourens
Copy link
Member

I'm not able to repro this in stable. @alexr00 is there a way that I can verify it with TS or some dummy task?

@roblourens
Copy link
Member

In 1.37 I have a task that just echos that data, and uses the same problem matcher, and it looks ok:

image

image

@roblourens roblourens added the verification-steps-needed Steps to verify are needed for verification label Aug 29, 2019
@joelspadin
Copy link
Author

Are you running Windows 10? I was seeing the issue on Windows 7, so it's possible this only occurs on Windows 7 or when terminal.integrated.windowsEnableConpty is false.

@roblourens
Copy link
Member

I was using macOS, but I tried windows, and there I can't even get the problem to show up at all

@alexr00 alexr00 added the windows VS Code on Windows issues label Aug 30, 2019
@alexr00
Copy link
Member

alexr00 commented Aug 30, 2019

Sorry about that, it's a Windows specific issue and it happens regardless of the Windows version. The repro is to make your terminal very narrow then run a task that causes problems.

@alexr00 alexr00 removed the verification-steps-needed Steps to verify are needed for verification label Aug 30, 2019
@aeschli aeschli added the verified Verification succeeded label Aug 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Sep 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues verified Verification succeeded windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

4 participants