summaryrefslogtreecommitdiff
path: root/packages/core/src/ide/detect-ide.ts
blob: ae46789e3b0cd3d5501135534747459ca7652468 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
 * @license
 * Copyright 2025 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

export enum DetectedIde {
  VSCode = 'vscode',
}

export function getIdeDisplayName(ide: DetectedIde): string {
  switch (ide) {
    case DetectedIde.VSCode:
      return 'VSCode';
    default:
      throw new Error(`Unsupported IDE: ${ide}`);
  }
}

export function detectIde(): DetectedIde | undefined {
  if (process.env.TERM_PROGRAM === 'vscode') {
    return DetectedIde.VSCode;
  }
  return undefined;
}