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

Function extractHostNames

Extension/src/SSH/sshHosts.ts:57–76  ·  view source on GitHub ↗
(parsedConfig: Configuration)

Source from the content-addressed store, hash-verified

55}
56
57function extractHostNames(parsedConfig: Configuration): { [host: string]: string } {
58 const hostNames: { [host: string]: string } = Object.create(null);
59
60 extractHosts(parsedConfig).forEach(host => {
61 let resolvedConfig: ResolvedConfiguration | undefined;
62 try {
63 resolvedConfig = parsedConfig.compute(host);
64 } catch {
65 getSshChannel().appendLine(localize("failed.to.find.user.info.for.SSH",
66 "Failed to find user info for SSH. This could be caused by VS Code being installed using 'snap'. Please reinstall VS Code using the 'deb' package if you are planning to use SSH features."));
67 }
68 if (resolvedConfig?.HostName !== undefined) {
69 hostNames[host] = resolvedConfig.HostName;
70 } else {
71 hostNames[host] = host;
72 }
73 });
74
75 return hostNames;
76}
77
78/**
79 * Gets parsed SSH configuration from file. Resolves Include directives as well unless specified otherwise.

Callers 1

getSshConfigHostInfosFunction · 0.85

Calls 5

getSshChannelFunction · 0.90
extractHostsFunction · 0.85
computeMethod · 0.80
appendLineMethod · 0.80
forEachMethod · 0.45

Tested by

no test coverage detected