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

Function resolveConfigIncludes

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

Source from the content-addressed store, hash-verified

106}
107
108async function resolveConfigIncludes(
109 config: Configuration,
110 configPath: string,
111 processedIncludePaths?: Set<string>,
112 processedIncludeEntries?: WeakSet<ConfigurationDirective>
113): Promise<void> {
114 processedIncludePaths = processedIncludePaths ?? new Set<string>();
115 processedIncludeEntries = processedIncludeEntries ?? new WeakSet<ConfigurationDirective>();
116 const configKey: string = getProcessedPathKey(configPath);
117 if (processedIncludePaths.has(configKey)) {
118 return;
119 }
120 processedIncludePaths.add(configKey);
121 try {
122 for (const entry of config) {
123 if (isDirective(entry) && entry.param === 'Include') {
124 // Prevent duplicate expansion of the same Include directive within a single resolution pass.
125 if (processedIncludeEntries.has(entry)) {
126 continue;
127 }
128 processedIncludeEntries.add(entry);
129 let includePath: string = resolveHome(entry.value);
130 if (isWindows && !!includePath.match(/^\/[a-z]:/i)) {
131 includePath = includePath.slice(1);
132 }
133
134 if (!path.isAbsolute(includePath)) {
135 includePath = path.resolve(path.dirname(configPath), includePath);
136 }
137
138 const pathsToGetFilesFrom: string[] = await globAsync(includePath);
139
140 for (const filePath of pathsToGetFilesFrom) {
141 const includeKey: string = getProcessedPathKey(filePath);
142 if (processedIncludePaths.has(includeKey)) {
143 continue;
144 }
145 await getIncludedConfigFile(config, filePath, processedIncludePaths, processedIncludeEntries);
146 }
147 }
148 }
149 } finally {
150 processedIncludePaths.delete(configKey);
151 }
152}
153
154async function getIncludedConfigFile(
155 config: Configuration,

Callers 2

getSshConfigurationFunction · 0.85
getIncludedConfigFileFunction · 0.85

Calls 9

resolveHomeFunction · 0.90
getProcessedPathKeyFunction · 0.85
isDirectiveFunction · 0.85
getIncludedConfigFileFunction · 0.85
hasMethod · 0.80
isAbsoluteMethod · 0.80
deleteMethod · 0.80
resolveMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected