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

Comments not displayed for typedef and macros #8320

Closed
yoavrv opened this issue Oct 23, 2021 · 3 comments
Closed

Comments not displayed for typedef and macros #8320

yoavrv opened this issue Oct 23, 2021 · 3 comments
Assignees
Labels
bug Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix Works in VS So we'd need to fix it for VS Code to reach parity.
Milestone

Comments

@yoavrv
Copy link

yoavrv commented Oct 23, 2021

Issue Type: Bug

Any comment at the start of the file seems to overrides the tooltips for typedefs and macros

for example file.c contains:

/* vim: set ts=4 sts=4 sw=4 noet : */
#include <stdio.h>
int no_description;
int my_global; //this is a global variable
typedef unsigned int my_uint; // this is my special uint
// this is some magic number
#define MAGIC_NUMBER 512

when hovering over my_global, the tooltip shows "this is my global variable", but hovering over my_uint or MAGIC_NUMBER shows " vim: set ts=4 sts=4 sw=4 noet : ".

without the comment at the top, my_uint and MAGIC_NUMBER shows nothing (which I guess is the correct behavior?).

I'm not sure if it's helpful to know, but when undoing/redoing the top comment rapidly, no_description's tooltip would occasionly show " vim: set ts=4 sts=4 sw=4 noet : " before reverting to nothing, and my_uint's would show "this is my uint" before reverting to nothing

Edit: I don't know vim, this is just the comment that the original file came with that cause the problem

Extension version: 1.7.1
VS Code version: Code 1.61.2 (6cba118ac49a1b88332f312a8f67186f7f3c1643, 2021-10-19T14:57:20.575Z)
OS version: Windows_NT x64 10.0.19043
Restricted Mode: No
Remote OS version: Linux x64 4.19.128-microsoft-standard
Remote OS version: Linux x64 4.19.128-microsoft-standard

System Info
Item Value
CPUs Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.82GB (1.58GB free)
Process Argv --folder-uri=vscode-remote://wsl+Ubuntu-20.04/opt/workspace/msc_project/cluster-trisurf --remote=wsl+Ubuntu-20.04 --crash-reporter-id 6b52cd83-0bde-4b1f-ba92-9b01751b74a4
Screen Reader no
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 4.19.128-microsoft-standard
CPUs Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800)
Memory (System) 6.05GB (5.19GB free)
VM 0%
Item Value
Remote WSL: Ubuntu-20.04
OS Linux x64 4.19.128-microsoft-standard
CPUs Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz (8 x 1800)
Memory (System) 6.05GB (5.19GB free)
VM 0%
@michelleangela michelleangela added bug Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. Language Service Works in VS So we'd need to fix it for VS Code to reach parity. labels Oct 26, 2021
@michelleangela michelleangela changed the title wrong tooltip on typedef and macros Comments not displayed for typedef and macros Oct 26, 2021
@michelleangela
Copy link
Contributor

michelleangela commented Oct 26, 2021

@yoavrv
Thanks for reporting this issue. It may be related to #5241.

However, I found simple repros below:

First sample: macros one and two will get // comment from line 1 or whatever comment or no comment precedes the macros. That is if // comment from line 1 was not there but a blank space, then the macros will have no comments on hover. int a displays the correct comment. When tested on Visual Studio, the macros display the correct comments for each macro.

// comment from line 1
// my comment
#define one 1

// another comment
#define two 2

// comment for a
int a;

Second sample: the same issue happens for typedefs, where typedef red and blue get // preceding comment.

// preceding comment
// comment for red
typedef int red;

// comment for blue
typedef int blue;

// comment for yellow
int yellow;

@tim-bargen
Copy link

I've noticed this issue as well. It seems to only affect typedefs for primitive data types; structs, enums etc. all have the correct comments show up in the tooltip.

@sean-mcmanus
Copy link
Collaborator

Fixed with 1.11.3 (pre-release): https://github.com/microsoft/vscode-cpptools/releases/tag/v1.11.3

@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Feature: Doc comments An issue related to code comments shown in hover, completion, and signature help. fixed Check the Milestone for the release in which the fix is or will be available. Language Service quick fix Works in VS So we'd need to fix it for VS Code to reach parity.
Projects
None yet
Development

No branches or pull requests

5 participants