MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / initializeIdeIntegration

Function initializeIdeIntegration

source code/utils/ide.ts:1290–1350  ·  view source on GitHub ↗
(
  onIdeDetected: (ide: DetectedIDEInfo | null) => void,
  ideToInstallExtension: IdeType | null,
  onShowIdeOnboarding: () => void,
  onInstallationComplete: (
    status: IDEExtensionInstallationStatus | null,
  ) => void,
)

Source from the content-addressed store, hash-verified

1288 * @param onInstallationComplete Callback to be called when extension installation is complete
1289 */
1290export async function initializeIdeIntegration(
1291 onIdeDetected: (ide: DetectedIDEInfo | null) => void,
1292 ideToInstallExtension: IdeType | null,
1293 onShowIdeOnboarding: () => void,
1294 onInstallationComplete: (
1295 status: IDEExtensionInstallationStatus | null,
1296 ) => void,
1297): Promise<void> {
1298 // Don't await so we don't block startup, but return a promise that resolves with the status
1299 void findAvailableIDE().then(onIdeDetected)
1300
1301 const shouldAutoInstall = getGlobalConfig().autoInstallIdeExtension ?? true
1302 if (
1303 !isEnvTruthy(process.env.CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL) &&
1304 shouldAutoInstall
1305 ) {
1306 const ideType = ideToInstallExtension ?? getTerminalIdeType()
1307 if (ideType) {
1308 if (isVSCodeIde(ideType)) {
1309 void isIDEExtensionInstalled(ideType).then(async isAlreadyInstalled => {
1310 void maybeInstallIDEExtension(ideType)
1311 .catch(error => {
1312 const ideInstallationStatus: IDEExtensionInstallationStatus = {
1313 installed: false,
1314 error: error.message || 'Installation failed',
1315 installedVersion: null,
1316 ideType: ideType,
1317 }
1318 return ideInstallationStatus
1319 })
1320 .then(status => {
1321 onInstallationComplete(status)
1322
1323 if (status?.installed) {
1324 // If we installed and don't yet have an IDE, search again.
1325 void findAvailableIDE().then(onIdeDetected)
1326 }
1327
1328 if (
1329 !isAlreadyInstalled &&
1330 status?.installed === true &&
1331 !ideOnboardingDialog().hasIdeOnboardingDialogBeenShown()
1332 ) {
1333 onShowIdeOnboarding()
1334 }
1335 })
1336 })
1337 } else if (isJetBrainsIde(ideType)) {
1338 // Always check installation to populate the sync cache used by status notices
1339 void isIDEExtensionInstalled(ideType).then(async installed => {
1340 if (
1341 installed &&
1342 !ideOnboardingDialog().hasIdeOnboardingDialogBeenShown()
1343 ) {
1344 onShowIdeOnboarding()
1345 }
1346 })
1347 }

Callers 1

useIDEIntegrationFunction · 0.85

Calls 9

findAvailableIDEFunction · 0.85
getGlobalConfigFunction · 0.85
isEnvTruthyFunction · 0.85
getTerminalIdeTypeFunction · 0.85
isVSCodeIdeFunction · 0.85
isIDEExtensionInstalledFunction · 0.85
maybeInstallIDEExtensionFunction · 0.85
ideOnboardingDialogFunction · 0.85
isJetBrainsIdeFunction · 0.85

Tested by

no test coverage detected