IssueCollection

An IssueCollection object coordinates a group of results from a diagnostic pass within a file or workspace, represented using Issue objects. IssueCollection objects conform to the Disposable interface.

The IssueCollection class is not subclassable.

class MyLinterClass() {
    constructor() {
        this.issueCollection = new IssueCollection();
    }
    
    deliverResults(fileURI, issues) {
        this.issueCollection.set(fileURI, issues);
    }
}

Class Methods

constructor([name])

Creates a new IssueCollection object with a provided name. If no name is provided, the name of the extension will be displayed to the user when required.

Properties

name

The name of the collection, potentially shown to the user. Most commonly the name is that of a diagnostic tool, such as "jslint".

This property is readonly.

Methods

append(uri, issues)

Appends an array of issues to the collection for a provided file URI.

Attempting to invoke this method after the collection has been disposed will throw an Error.

dispose()

Removes all issues from the collection, and removes the collection from its owning workspace. The collection will no longer be displayed to the user. Subsequent attempts to set new issues on the collection will do nothing.

clear()

Removes all issues from the collection.

has(uri)

Returns a boolean value indicating whether the collection contains any issues for the provided file URI.

get(uri)

Returns all issues within the collection for a provided file URI.

set(uri, issues)

Replaces all issues within the collection for a provided file URI.

Attempting to invoke this method after the collection has been disposed will throw an Error.

remove(uri)

Removes all issues within the collection for a provided file URI.

Attempting to invoke this method after the collection has been disposed will throw an Error.