Skip to content

Commit

Permalink
rm unused settings mv set compiler to utils (#334)
Browse files Browse the repository at this point in the history
  • Loading branch information
brianignacio5 authored Mar 3, 2021
1 parent 823c14a commit 5bff08b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
19 changes: 0 additions & 19 deletions src/examples/ExamplesPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,25 +106,6 @@ export class ExamplesPlanel {
message.project_path,
resultFolder
);
const settingsJsonPath = path.join(
resultFolder,
".vscode",
"settings.json"
);
const settingsJson = await readJSON(settingsJsonPath);
const modifiedEnv = utils.appendIdfAndToolsToPath();
const idfTarget = modifiedEnv.IDF_TARGET || "esp32";
const compilerPath = await utils.isBinInPath(
`xtensa-${idfTarget}-elf-gcc`,
resultFolder,
modifiedEnv
);
settingsJson["C_Cpp.default.compilerPath"] = compilerPath;
await writeJSON(settingsJsonPath, settingsJson, {
spaces:
vscode.workspace.getConfiguration().get("editor.tabSize") ||
2,
});
const projectPath = vscode.Uri.file(resultFolder);
vscode.commands.executeCommand("vscode.openFolder", projectPath);
} catch (error) {
Expand Down
25 changes: 25 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import {
move,
pathExists,
readFile,
readJSON,
writeFile,
writeJSON,
} from "fs-extra";
import * as HttpsProxyAgent from "https-proxy-agent";
import { EOL } from "os";
Expand Down Expand Up @@ -188,6 +190,29 @@ export async function createVscodeFolder(curWorkspaceFsPath: string) {
await copy(fSrcPath, fPath);
}
}
const cCppPropertiesJsonPath = path.join(
curWorkspaceFsPath,
".vscode",
"c_cpp_properties.json"
);
const cCppPropertiesJson = await readJSON(cCppPropertiesJsonPath);
const modifiedEnv = appendIdfAndToolsToPath();
const idfTarget = modifiedEnv.IDF_TARGET || "esp32";
const compilerPath = await isBinInPath(
`xtensa-${idfTarget}-elf-gcc`,
curWorkspaceFsPath,
modifiedEnv
);
if (
cCppPropertiesJson &&
cCppPropertiesJson.configurations &&
cCppPropertiesJson.configurations.length
) {
cCppPropertiesJson.configurations[0].compilerPath = compilerPath;
}
await writeJSON(cCppPropertiesJsonPath, cCppPropertiesJson, {
spaces: vscode.workspace.getConfiguration().get("editor.tabSize") || 2,
});
return resolve();
});
});
Expand Down
4 changes: 4 additions & 0 deletions templates/.vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@
"includePath": [
"${config:idf.espIdfPath}/components/**",
"${config:idf.espIdfPathWin}/components/**",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}/**"
],
"browse": {
"path": [
"${config:idf.espIdfPath}/components",
"${config:idf.espIdfPathWin}/components",
"${config:idf.espAdfPath}/components/**",
"${config:idf.espAdfPathWin}/components/**",
"${workspaceFolder}"
],
"limitSymbolsToIncludedHeaders": false
Expand Down
8 changes: 0 additions & 8 deletions templates/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
{
"C_Cpp.clang_format_style": "Visual Studio",
"editor.formatOnSave": false,
"[cpp]": {
"editor.quickSuggestions": true
},
"[c]": {
"editor.quickSuggestions": true
},
"C_Cpp.intelliSenseEngine": "Tag Parser"
}

0 comments on commit 5bff08b

Please sign in to comment.