Skip to content

Types unification #1648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 25, 2025
Merged

Types unification #1648

merged 6 commits into from
Jun 25, 2025

Conversation

pelikhan
Copy link
Member

Ambient types from types.ts

Copy link
Contributor

Investigator report

Context collection

  • run id: 15885047699
  • failed job
  • last successful run not found

AI Analysis

Root cause of the failure:

The TypeScript error is:

packages/vscode prebuild: src/state.ts(407,30): error TS2304: Cannot find name 'DiagnosticSeverity'.

Analysis:

  • The code in packages/vscode/src/state.ts references DiagnosticSeverity (not vscode.DiagnosticSeverity) as a type in the mapping for diagnostic severities, but there is no definition or import of DiagnosticSeverity in this file.
  • Only ExtensionContext is imported from vscode, but no namespace import like import * as vscode from "vscode" exists, so accessing vscode.DiagnosticSeverity results in a TypeScript error.
  • The usage is:
    const severities: Record<
        DiagnosticSeverity | "notice",
        vscode.DiagnosticSeverity
    > = {
        notice: vscode.DiagnosticSeverity.Information,
        warning: vscode.DiagnosticSeverity.Warning,
        error: vscode.DiagnosticSeverity.Error,
        info: vscode.DiagnosticSeverity.Information,
    }
    Here, DiagnosticSeverity is undefined.

Problem code:

const severities: Record<
    DiagnosticSeverity | "notice",
    vscode.DiagnosticSeverity
> = {
    notice: vscode.DiagnosticSeverity.Information,
    warning: vscode.DiagnosticSeverity.Warning,
    error: vscode.DiagnosticSeverity.Error,
    info: vscode.DiagnosticSeverity.Information,
}

Fix

You need to:

  1. Import the DiagnosticSeverity type if it exists elsewhere.
  2. If this refers to vscode.DiagnosticSeverity, either use that directly or use string literal types.
  3. Import vscode as a namespace so vscode.DiagnosticSeverity and vscode.Diagnostic are valid.

Minimal viable fix:

  • Add: import * as vscode from "vscode" at the top of the file.
  • Fix the type: If the intention is to allow string severities, use Record<"notice" | "warning" | "error" | "info", vscode.DiagnosticSeverity>.

--- a/packages/vscode/src/state.ts
+++ b/packages/vscode/src/state.ts
@@
-import { ExtensionContext } from "vscode"
+import { ExtensionContext } from "vscode"
+import * as vscode from "vscode"
@@
-const severities: Record<
-    DiagnosticSeverity | "notice",
-    vscode.DiagnosticSeverity
-> = {
-    notice: vscode.DiagnosticSeverity.Information,
-    warning: vscode.DiagnosticSeverity.Warning,
-    error: vscode.DiagnosticSeverity.Error,
-    info: vscode.DiagnosticSeverity.Information,
-}
+const severities: Record<
+    "notice" | "warning" | "error" | "info",
+    vscode.DiagnosticSeverity
+> = {
+    notice: vscode.DiagnosticSeverity.Information,
+    warning: vscode.DiagnosticSeverity.Warning,
+    error: vscode.DiagnosticSeverity.Error,
+    info: vscode.DiagnosticSeverity.Information,
+}

This resolves the missing identifier and ensures all symbols are properly in scope.

AI-generated content by gai may be incorrect. Use reactions to eval.

@pelikhan pelikhan merged commit a2df468 into dev Jun 25, 2025
7 of 8 checks passed
@pelikhan pelikhan deleted the prompt_types branch June 25, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant