microsoft / vscode-cpptools

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

header files are flickers on VSCode window #9850

Closed zafersn closed 1 year ago

zafersn commented 2 years ago

Environment

image

here is my issue: when I open the header file. the header file is flicker.

ezgif-4-74814b6326

Bug Summary and Steps to Reproduce

Bug Summary:

The header file is flicker. please have a look at gif files I shared with you

Steps to reproduce:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

No response

Code sample and Logs

/**
  ******************************************************************************
  * Copyright (c) 2016 Intel Corporation.
  *
  * SPDX-License-Identifier: Apache-2.0
  * @file    bsl.h
  * @author  Zafer
  * @version V1.0.0
  * @date    Sep 05, 2022
  * @brief   
  * @verbatim
  * @file Header where utility code can be found for PCAL9539A IO EXPANDER GPIO drivers
  *     V1.0.0 :    First version of library.
  *     <describe this file>
  * @endverbatim
  * ===========================================================================
  *                       ##### How to use this file #####
  * ===========================================================================
  * @attention
  *
  * @todo
  *
  *
  *
  * ===========================================================================
  *                       ##### Change Activity #####
  * ===========================================================================
  * mm/dd/yy   author   description
  * --------  -------   -----------
  * 05/09/22   Zafer   Initial coding
  *
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef NETFEASA_DRIVERS_PCAL9539A_GPIO_UTILS_H_
#define NETFEASA_DRIVERS_PCAL9539A_GPIO_UTILS_H_

/* Includes ------------------------------------------------------------------*/

/* END Of Includes ------------------------------------------------------------------*/

/* Exported macro ------------------------------------------------------------*/

/* Register definitions */
#define REG_INPUT_PORT0                 0x00
#define REG_INPUT_PORT1                 0x01
#define REG_OUTPUT_PORT0                0x02
#define REG_OUTPUT_PORT1                0x03
#define REG_POL_INV_PORT0               0x04
#define REG_POL_INV_PORT1               0x05
#define REG_CONF_PORT0                  0x06
#define REG_CONG_PORT1                  0x07
#define REG_OUT_DRV_STRENGTH_PORT0_L    0x40
#define REG_OUT_DRV_STRENGTH_PORT0_H    0x41
#define REG_OUT_DRV_STRENGTH_PORT1_L    0x42
#define REG_OUT_DRV_STRENGTH_PORT1_H    0x43
#define REG_INPUT_LATCH_PORT0           0x44
#define REG_INPUT_LATCH_PORT1           0x45
#define REG_PUD_EN_PORT0                0x46
#define REG_PUD_EN_PORT1                0x47
#define REG_PUD_SEL_PORT0               0x48
#define REG_PUD_SEL_PORT1               0x49
#define REG_INT_MASK_PORT0              0x4A
#define REG_INT_MASK_PORT1              0x4B
#define REG_INT_STATUS_PORT0            0x4C
#define REG_INT_STATUS_PORT1            0x4D
#define REG_OUTPUT_PORT_CONF            0x4F

/* Driver flags */
#define PCA_HAS_PUD                     BIT(0)
#define PCA_HAS_INTERRUPT               BIT(1)

#define GPIO_PCAL9539A_DEVICE_INSTANCE(inst)                \
static const struct gpio_pcal9539a_config gpio_pcal9539a_##inst##_cfg = {   \
    .common = {                         \
        .port_pin_mask = GPIO_PORT_PIN_MASK_FROM_DT_INST(inst), \
    },                              \
    .bus = I2C_DT_SPEC_INST_GET(inst),              \
    .capabilities =                         \
        (DT_INST_PROP(inst, has_pud) ?          \
            PCA_HAS_PUD : 0) |              \
        IF_ENABLED(CONFIG_GPIO_PCAL9539A_INTERRUPT, (       \
        (DT_INST_NODE_HAS_PROP(inst, interrupt_gpios) ?     \
            PCA_HAS_INTERRUPT : 0) |            \
        ))                          \
        0,                          \
    IF_ENABLED(CONFIG_GPIO_PCAL9539A_INTERRUPT,         \
    (.int_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, interrupt_gpios, {}),)) \
};                                  \
                                    \
static struct gpio_pcal9539a_drv_data gpio_pcal9539a_##inst##_drvdata = {   \
    .reg_cache.input = 0x0,                     \
    .reg_cache.output = 0xFFFF,                 \
    .reg_cache.dir = 0xFFFF,                    \
    .reg_cache.pud_en = 0x0,                    \
    .reg_cache.pud_sel = 0xFFFF,                    \
    IF_ENABLED(CONFIG_GPIO_PCAL9539A_INTERRUPT, (           \
    .interrupt_active = false,                  \
    ))                              \
};                                  \
                                    \
DEVICE_DT_INST_DEFINE(inst,                     \
    gpio_pcal9539a_init,                        \
    NULL,                               \
    &gpio_pcal9539a_##inst##_drvdata,                   \
    &gpio_pcal9539a_##inst##_cfg,                   \
    POST_KERNEL, CONFIG_GPIO_PCAL9539A_INIT_PRIORITY,           \
    &gpio_pcal9539a_drv_api_funcs);

DT_INST_FOREACH_STATUS_OKAY(GPIO_PCAL9539A_DEVICE_INSTANCE)

/* END Of Exported macro ------------------------------------------------------------*/

/* Exported types ------------------------------------------------------------*/

/** Configuration data */
struct gpio_pcal9539a_config {
    /* gpio_driver_config needs to be first */
    struct gpio_driver_config common;
    struct i2c_dt_spec bus;
    uint8_t capabilities;
#ifdef CONFIG_GPIO_PCAL9539A_INTERRUPT
    struct gpio_dt_spec int_gpio;
#endif
};

/** Runtime driver data */
struct gpio_pcal9539a_drv_data {
    /* gpio_driver_data needs to be first */
    struct gpio_driver_data common;

    struct {
        uint16_t input;
        uint16_t output;
        uint16_t dir;
        uint16_t pud_en;
        uint16_t pud_sel;
    } reg_cache;

    struct k_sem lock;

#ifdef CONFIG_GPIO_PCAL9539A_INTERRUPT
    /* Self-reference to the driver instance */
    const struct device *instance;

    /* port ISR callback routine address */
    sys_slist_t callbacks;

    /* interrupt triggering pin masks */
    struct {
        uint16_t edge_rising;
        uint16_t edge_falling;
        uint16_t level_high;
        uint16_t level_low;
    } interrupts;

    struct gpio_callback gpio_callback;

    struct k_work interrupt_worker;

    bool interrupt_active;
#endif
};
/* END Of Exported types ------------------------------------------------------------*/

/* Exported constants --------------------------------------------------------*/
/* END Of Exported constants --------------------------------------------------------*/

/* Exported variables --------------------------------------------------------*/

/* END Of Exported variables --------------------------------------------------------*/

/* Exported functions ------------------------------------------------------- */

/* END Of Exported functions ------------------------------------------------------- */

#endif/* NETFEASA_DRIVERS_GPIO_GPIO_UTILS_H_ */
/*** (C) COPYRIGHT  Netfeasa  *****END OF FILE****/

Screenshots

ezgif-4-74814b6326

Additional context

No response

michelleangela commented 2 years ago

@zafersn This may be a VS Code client bug because it's an issue with what appears to be reloading of the theme colors.

Could you try uninstalling the C++ extension pack and the C++ extension, but only retain the C++ themes and see if it still flickers? Does this only happen with certain theme colors or only for the dark themes?

sean-mcmanus commented 2 years ago

This is a duplicate of https://github.com/microsoft/vscode-cpptools/issues/9689 -- we're not sure exactly how to repro it yet, but it seems like removing the duplicate files.associations should fix it. Maybe another setting is required to be set.

sean-mcmanus commented 2 years ago

Also, I'm seeing "Connection to server got closed. Server will not be restarted" (i.e. cpptools process crash) but that could be completely unrelated...let us know if you have any more info on that repro.

zafersn commented 2 years ago

Hi @michelleangela in some cases I need to use c++ extension and pack. So I believe it is not the solution. but anyway, I disabled those extensions and tested. yes, it worked for me and I didn't see any flickers. But the thing is I have come across an issue like that only in this piece of code, not in any other files. I was wondering why?.

And also, I came across a few times there were no flickers on that header file when I was switching between pages, although all c++ extensions were enabled

michelleangela commented 2 years ago

@zafersn It could only be happening to that particular file due to some IntelliSense parsing issue. Could you provide the following logs when the flickering happens? The logs will show operations IntelliSense is doing and how it's configured.

github-actions[bot] commented 1 year ago

This issue has been closed because it needs more information and has not had recent activity.

sean-mcmanus commented 1 year ago

The fix is available with 1.14.0 (pre-release): https://github.com/microsoft/vscode-cpptools/releases/tag/v1.14.0