vscode: un-recommend microsoft C/C++ extension

This commit is contained in:
Steven Hugg committed 2026-09-29 16:28:39 +02:00
1 parent b8b0172957
commit 04c0e83dcc
2 files changed
+21

No files matched your search

+5
View File
@@ -48,6 +48,11 @@ version that built keeps running until you fix them.
To use code you already have, open its folder: the extension detects the appropriate platform and main file.
You don't need Microsoft's C/C++ extension: this extension builds your C code
and reports its errors. VS Code suggests C/C++ whenever you open a `.c` file,
so new projects include a `.vscode/extensions.json` that turns the suggestion
off for that folder. Elsewhere, you can safely dismiss it.
## Settings
Project settings, saved in `.vscode/settings.json`:
+16
View File
@@ -973,6 +973,22 @@ async function writeFolderSettings(dir: vscode.Uri, s: { platform: string, mainF
if (s.tool) json[CONFIG + '.tool'] = s.tool;
await vscode.workspace.fs.createDirectory(vscode.Uri.joinPath(dir, '.vscode'));
await vscode.workspace.fs.writeFile(file, new TextEncoder().encode(JSON.stringify(json, null, 2) + '\n'));
await writeExtensionRecommendations(dir);
}
/**
* VS Code offers the C/C++ extension for every .c file, but its IntelliSense
* can't find cc65/SDCC headers and only adds false errors. Declining it in
* .vscode/extensions.json is the only way to stop the prompt for a folder.
*/
async function writeExtensionRecommendations(dir: vscode.Uri) {
var file = vscode.Uri.joinPath(dir, '.vscode', 'extensions.json');
try { await vscode.workspace.fs.stat(file); return; } catch (e) { } // leave the user's alone
var json = {
recommendations: ['8bitworkshop.8bitworkshop'],
unwantedRecommendations: ['ms-vscode.cpptools', 'ms-vscode.cpptools-extension-pack'],
};
await vscode.workspace.fs.writeFile(file, new TextEncoder().encode(JSON.stringify(json, null, 2) + '\n'));
}
async function changeMainFile() {