vscode-cpptools icon indicating copy to clipboard operation
vscode-cpptools copied to clipboard

`provideConfigurations` is called with duplicate URI:s

Open HampusAdolfsson opened this issue 1 year ago • 2 comments

Environment

  • OS and Version: WSL Ubuntu 22 / Windows 11
  • VS Code Version: 1.89.0-insider
  • C/C++ Extension Version: 1.20.0 pre-release
  • If using SSH remote, specify OS of remote machine:

Bug Summary and Steps to Reproduce

Bug Summary: When cpptools calls provideConfigurations of a custom configuration provider, the uris parameter always contains the same uri twice:

image

This first appears in version 1.19.5 -- if I downgrade to 1.19.4 it works as expected.

Steps to reproduce:

  1. Run an extension that registers a CustomConfigurationProvider
  2. Put a breakpoint in your CustomConfigurationProvider's provideConfigurations.
  3. Open a file to trigger cpptools to query your extension for the file's intellisense configuration.
  4. Look at the uris parameter passed in -- it contains the same URI that you just opened twice.

Expected behavior: Each uri should only appear once.

Configuration and Logs

Relevant section from the `C/C++` output channel (here using CMake Tools):

LSP: (received) textDocument/didOpen: file:///home/hampusad/EW%20Projects/CMakeTest/func.c
LSP: (invoked) cpptools/queryTranslationUnitSource: file:///home/hampusad/EW%20Projects/CMakeTest/func.c (id: 7)
LSP: (invoked) textDocument/didOpen: file:///home/hampusad/EW%20Projects/CMakeTest/func.c
Populating file name cache...
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///home/hampusad/EW%20Projects/CMakeTest/func.c
Done populating filename cache. Elapsed time: 28 ms
LSP: Sending response (id: 7)
Custom configurations received:
  uri: file:///home/hampusad/EW%20Projects/CMakeTest/func.c
  config: {
  "includePath": [],
  "defines": [],
  "compilerPath": "/usr/bin/gcc",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "--debug"
  ]
}
  uri: file:///home/hampusad/EW%20Projects/CMakeTest/func.c
  config: {
  "includePath": [],
  "defines": [],
  "compilerPath": "/usr/bin/gcc",
  "compilerArgs": [],
  "compilerFragments": [
    "-g",
    "--debug"
  ]
}

Other Extensions

No response

Additional context

No response

HampusAdolfsson avatar Apr 09 '24 12:04 HampusAdolfsson

@Colengms do you know what might have caused this?

bobbrow avatar Apr 09 '24 22:04 bobbrow

@HampusAdolfsson Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.20.2 .

sean-mcmanus avatar Apr 22 '24 21:04 sean-mcmanus