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

Function getIncludedConfigFile

Extension/src/SSH/sshHosts.ts:154–177  ·  view source on GitHub ↗
(
    config: Configuration,
    includePath: string,
    processedIncludePaths: Set<string>,
    processedIncludeEntries: WeakSet<ConfigurationDirective>
)

Source from the content-addressed store, hash-verified

152}
153
154async function getIncludedConfigFile(
155 config: Configuration,
156 includePath: string,
157 processedIncludePaths: Set<string>,
158 processedIncludeEntries: WeakSet<ConfigurationDirective>
159): Promise<void> {
160 let includedContents: string;
161 try {
162 includedContents = (await fs.readFile(includePath)).toString();
163 } catch {
164 getSshChannel().appendLine(localize("failed.to.read.file", "Failed to read file {0}.", includePath));
165 return;
166 }
167
168 let parsedIncludedContents: Configuration | undefined;
169 try {
170 parsedIncludedContents = parse(includedContents);
171 } catch (err) {
172 getSshChannel().appendLine(localize("failed.to.parse.SSH.config", "Failed to parse SSH configuration file {0}: {1}", includePath, (err as Error).message));
173 return;
174 }
175 await resolveConfigIncludes(parsedIncludedContents, includePath, processedIncludePaths, processedIncludeEntries);
176 config.push(...parsedIncludedContents);
177}
178
179export async function writeSshConfiguration(configurationPath: string, configuration: Configuration): Promise<void> {
180 configurationPath = resolveHome(configurationPath);

Callers 1

resolveConfigIncludesFunction · 0.85

Calls 6

getSshChannelFunction · 0.90
parseFunction · 0.85
resolveConfigIncludesFunction · 0.85
toStringMethod · 0.80
appendLineMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected