Environment
- OS and Version: Windows 11 version 10.0.22631
- VS Code Version: 1.103.1
- C/C++ Extension Version: 1.26.3
Bug Summary and Steps to Reproduce
Bug Summary: When using a custom configuration provider for intellisense and the provider hits the two second timeout for providing a configuration for a file, the C/C++ language service sometimes hangs. In this state, it doesn't respond to LSP requests (e.g. hovering a symbol shows "Loading..." forever), running C/C++: Log Diagnostics does nothing and the Language Status popup shows as parsing indefinitely:
Steps to reproduce:
I can reproduce the issue with this sample configuration provider:
import { dirname } from 'path';
import * as vscode from 'vscode';
import { CppToolsApi, Version, CustomConfigurationProvider, getCppToolsApi, SourceFileConfigurationItem, WorkspaceBrowseConfiguration } from 'vscode-cpptools';
let api: CppToolsApi | undefined = undefined;
export async function activate(context: vscode.ExtensionContext) {
api = await getCppToolsApi(Version.v2);
const provider = new Provider();
if (api) {
if (api.notifyReady) {
api.registerCustomConfigurationProvider(provider);
api.notifyReady(provider);
}
}
}
export function deactivate() {
api?.dispose();
}
class Provider implements CustomConfigurationProvider {
name: string = "cpptools-provider";
extensionId: string = "cpptools-provider";
canProvideConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken): Thenable<boolean> {
return Promise.resolve(true);
}
async provideConfigurations(uris: vscode.Uri[], token?: vscode.CancellationToken): Promise<SourceFileConfigurationItem[]> {
console.log(`cpptools-provider: provideConfigurations called for ${uris.length} URIs.`);
await new Promise(resolve => setTimeout(resolve, 5000)); // Simulate async work
return uris.map(uri => {
return {
uri,
configuration: {
defines: [],
includePath: [dirname(uri.fsPath)],
compilerPath: "",
standard: "c17",
compilerArgs: [],
intelliSenseMode: "windows-clang-arm",
}
};
});
}
canProvideBrowseConfiguration(token?: vscode.CancellationToken): Thenable<boolean> {
return Promise.resolve(true);
}
provideBrowseConfiguration(token?: vscode.CancellationToken): Thenable<WorkspaceBrowseConfiguration | null> {
return Promise.resolve(null);
}
canProvideBrowseConfigurationsPerFolder(token?: vscode.CancellationToken): Thenable<boolean> {
return Promise.resolve(false);
}
provideFolderBrowseConfiguration(uri: vscode.Uri, token?: vscode.CancellationToken): Thenable<WorkspaceBrowseConfiguration | null> {
throw new Error('Method not implemented.');
}
dispose() {
}
}
Steps:
- Run the code above as an extension (with "*" as the activation event)
- Open a folder with a C/C++ codebase that is large enough that it takes more than ~6 seconds to index
- Open a C/C++ file to trigger the configuration provider
- Wait until the indexing would normally be finished. As far as I can tell, if running
C/C++: Log Diagnostics produces any output, the language service is still indexing; if it does not, the language service has hanged.
For me, this takes a few tries to hit. It only hangs about once every four tries.
Configuration and Logs
loggingLevel: 6
Custom configuration provider 'cpptools-provider' registered
LSP: (received - deferred) textDocument/didOpen: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
LSP: (received) cpptools/initialize (id: 1)
LSP: (invoked) cpptools/initialize (id: 1)
cpptools version (TypeScript): 1.26.3
cpptools version (native): 1.26.3.0
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
LSP: Sending response (id: 1)
LSP: (received) cpptools/queryCompilerDefaults (id: 2)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 2)
Compiler info database not connected - skipping load.
Compiler info database not connected - skipping load.
LSP: Sending response (id: 2)
LSP: (received) cpptools/queryCompilerDefaults (id: 3)
LSP: (invoked) cpptools/queryCompilerDefaults (id: 3)
Compiler info database not connected - skipping load.
Compiler info database not connected - skipping load.
LSP: Sending response (id: 3)
LSP: (received) cpptools/didChangeCppProperties (id: 4)
LSP: (invoked) cpptools/didChangeCppProperties (id: 4)
Code browsing service initialized
LSP: (received - deferred) cpptools/didChangeVisibleTextEditors
Populating file name cache...
LSP: (received) cpptools/didChangeSettings
Attempting to get defaults from C compiler in "compilerPath" property: 'cl.exe'
Attempting to get defaults from C++ compiler in "compilerPath" property: 'cl.exe'
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\ATLMFC\INCLUDE will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\INCLUDE will be indexed
Folder: D:\EW PROJECTS\ARM\9.50.1\ST\STM32F0XX\IAR-STM32F051R8-SK\UART-LCD will be indexed
LSP: (queued) textDocument/didOpen: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
LSP: (queued) cpptools/didChangeVisibleTextEditors
LSP: Sending response (id: 4)
LSP: (invoked) cpptools/didChangeSettings
Discovering files...
Autocomplete is enabled.
Error squiggles are enabled if all header dependencies are resolved.
Hover is enabled.
IntelliSense Engine = default.
Enhanced Colorization is enabled.
LSP: (invoked) textDocument/didOpen: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Intellisense update pending for: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
Requesting a custom configuration for: D:\EW PROJECTS\ARM\9.50.1\ST\STM32F0XX\IAR-STM32F051R8-SK\UART-LCD\MAIN.C
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM
LSP: (received) cpptools/didChangeCppProperties (id: 5)
LSP: (invoked) cpptools/didChangeCppProperties (id: 5)
Attempting to get defaults from C compiler in "compilerPath" property: 'cl.exe'
LSP: (received) cpptools/didChangeVisibleTextEditors
Attempting to get defaults from C++ compiler in "compilerPath" property: 'cl.exe'
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\CPPWINRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\SHARED will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UCRT will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\UM will be indexed
Folder: C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\ATLMFC\INCLUDE will be indexed
Folder: C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\INCLUDE will be indexed
Folder: D:\EW PROJECTS\ARM\9.50.1\ST\STM32F0XX\IAR-STM32F051R8-SK\UART-LCD will be indexed
LSP: Sending response (id: 5)
LSP: (invoked) cpptools/didChangeVisibleTextEditors
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.22621.0\WINRT
LSP: (received) cpptools/didChangeVisibleTextEditors
LSP: (invoked) cpptools/didChangeVisibleTextEditors
LSP: (received) cpptools/getDocumentSymbols: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 6)
LSP: (invoked) cpptools/getDocumentSymbols: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 6)
LSP: Sending response (id: 6)
Processing folder (non-recursive): C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\ATLMFC\INCLUDE
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 7)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 7)
LSP: Sending response (id: 7)
LSP: (received) cpptools/getFoldingRanges: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 8)
LSP: (invoked) cpptools/getFoldingRanges: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 8)
LSP: Sending response (id: 8)
LSP: (received) cpptools/pauseParsing
LSP: (invoked) cpptools/pauseParsing
LSP: (received) cpptools/clearCustomConfigurations
LSP: (invoked) cpptools/clearCustomConfigurations
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 9)
LSP: (invoked) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 9)
LSP: Sending response (id: 9)
LSP: $/cancelRequest (<unknown/completed>, id: 7)
LSP: (received) cpptools/clearCustomConfigurations
LSP: (invoked) cpptools/clearCustomConfigurations
Processing folder (non-recursive): C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\PROFESSIONAL\VC\TOOLS\MSVC\14.40.33807\INCLUDE
Processing folder (recursive): D:\EW PROJECTS\ARM\9.50.1\ST\STM32F0XX\IAR-STM32F051R8-SK\UART-LCD
Done populating filename cache. Elapsed time: 159 ms
Discovering files: 5926 file(s) processed
0 file(s) removed from database
Done discovering files.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
IntelliSense update scheduled and TU acquisition started for: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
Requesting a custom configuration for: D:\EW PROJECTS\ARM\9.50.1\ST\STM32F0XX\IAR-STM32F051R8-SK\UART-LCD\MAIN.C
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 10)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 10)
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 11)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 11)
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 12)
LSP: (received) cpptools/resumeParsing
LSP: (received) cpptools/finishedRequestCustomConfig: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
LSP: (invoked) cpptools/finishedRequestCustomConfig: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: $/cancelRequest (cpptools/getCodeActions, id: 12)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 13)
LSP: $/cancelRequest (cpptools/hover, id: 13)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 14)
LSP: $/cancelRequest (cpptools/hover, id: 14)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 15)
LSP: $/cancelRequest (cpptools/hover, id: 15)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 16)
LSP: $/cancelRequest (cpptools/hover, id: 16)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 17)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 18)
LSP: $/cancelRequest (cpptools/hover, id: 17)
LSP: (received) cpptools/hover: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 19)
LSP: $/cancelRequest (cpptools/hover, id: 19)
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/didChangeTextEditorSelection
LSP: (received) cpptools/getCodeActions: file:///d%3A/EW%20Projects/arm/9.50.1/ST/STM32F0xx/IAR-STM32F051R8-SK/UART-LCD/main.c (id: 20)
LSP: $/cancelRequest (cpptools/getCodeActions, id: 18)
Other Extensions
No response
Additional context
No response
Environment
Bug Summary and Steps to Reproduce
Bug Summary: When using a custom configuration provider for intellisense and the provider hits the two second timeout for providing a configuration for a file, the C/C++ language service sometimes hangs. In this state, it doesn't respond to LSP requests (e.g. hovering a symbol shows "Loading..." forever), running
C/C++: Log Diagnosticsdoes nothing and the Language Status popup shows as parsing indefinitely:Steps to reproduce:
I can reproduce the issue with this sample configuration provider:
Steps:
C/C++: Log Diagnosticsproduces any output, the language service is still indexing; if it does not, the language service has hanged.For me, this takes a few tries to hit. It only hangs about once every four tries.
Configuration and Logs
Other Extensions
No response
Additional context
No response