MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / getRawJson

Function getRawJson

Extension/src/common.ts:85–102  ·  view source on GitHub ↗
(path: string | undefined)

Source from the content-addressed store, hash-verified

83}
84
85export async function getRawJson(path: string | undefined): Promise<any> {
86 if (!path) {
87 return {};
88 }
89 const fileExists: boolean = await checkFileExists(path);
90 if (!fileExists) {
91 return {};
92 }
93
94 const fileContents: string = await readFileText(path);
95 let rawElement: any = {};
96 try {
97 rawElement = jsonc.parse(fileContents, undefined, true);
98 } catch {
99 throw new Error(failedToParseJson);
100 }
101 return rawElement;
102}
103
104// This function is used to stringify the rawPackageJson.
105// Do not use with util.packageJson or else the expanded

Callers

nothing calls this directly

Calls 2

checkFileExistsFunction · 0.85
readFileTextFunction · 0.85

Tested by

no test coverage detected