VS Code API
    Preparing search index...

    Interface DiagnosticCollection

    A diagnostics collection is a container that manages a set of diagnostics. Diagnostics are always scopes to a diagnostics collection and a resource.

    To get an instance of a DiagnosticCollection use createDiagnosticCollection.

    interface DiagnosticCollection {
        name: string;
        "[iterator]"(): Iterator<
            [uri: Uri, diagnostics: readonly Diagnostic[]],
            any,
            any,
        >;
        clear(): void;
        delete(uri: Uri): void;
        dispose(): void;
        forEach(
            callback: (
                uri: Uri,
                diagnostics: readonly Diagnostic[],
                collection: DiagnosticCollection,
            ) => any,
            thisArg?: any,
        ): void;
        get(uri: Uri): readonly Diagnostic[] | undefined;
        has(uri: Uri): boolean;
        set(uri: Uri, diagnostics: readonly Diagnostic[] | undefined): void;
        set(entries: readonly [Uri, readonly Diagnostic[] | undefined][]): void;
    }

    Hierarchy

    Index

    Properties

    name: string

    The name of this diagnostic collection, for instance typescript. Every diagnostic from this collection will be associated with this name. Also, the task framework uses this name when defining problem matchers.

    Methods

    • Returns Iterator<[uri: Uri, diagnostics: readonly Diagnostic[]], any, any>

    • Remove all diagnostics from this collection. The same as calling #set(undefined);

      Returns void

    • Remove all diagnostics from this collection that belong to the provided uri. The same as #set(uri, undefined).

      Parameters

      • uri: Uri

        A resource identifier.

      Returns void

    • Dispose and free associated resources. Calls clear.

      Returns void

    • Iterate over each entry in this collection.

      Parameters

      • callback: (
            uri: Uri,
            diagnostics: readonly Diagnostic[],
            collection: DiagnosticCollection,
        ) => any

        Function to execute for each entry.

      • OptionalthisArg: any

        The this context used when invoking the handler function.

      Returns void

    • Get the diagnostics for a given resource. Note that you cannot modify the diagnostics-array returned from this call.

      Parameters

      • uri: Uri

        A resource identifier.

      Returns readonly Diagnostic[] | undefined

      An immutable array of diagnostics or undefined.

    • Check if this collection contains diagnostics for a given resource.

      Parameters

      • uri: Uri

        A resource identifier.

      Returns boolean

      true if this collection has diagnostic for the given resource.

    • Assign diagnostics for given resource. Will replace existing diagnostics for that resource.

      Parameters

      • uri: Uri

        A resource identifier.

      • diagnostics: readonly Diagnostic[] | undefined

        Array of diagnostics or undefined

      Returns void

    • Replace diagnostics for multiple resources in this collection.

      Note that multiple tuples of the same uri will be merged, e.g [[file1, [d1]], [file1, [d2]]] is equivalent to [[file1, [d1, d2]]]. If a diagnostics item is undefined as in [file1, undefined] all previous but not subsequent diagnostics are removed.

      Parameters

      • entries: readonly [Uri, readonly Diagnostic[] | undefined][]

        An array of tuples, like [[file1, [d1, d2]], [file2, [d3, d4, d5]]], or undefined.

      Returns void