vscode#DiagnosticCollection TypeScript Examples

The following examples show how to use vscode#DiagnosticCollection. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: parseSPCompErrors.ts    From sourcepawn-vscode with MIT License 6 votes vote down vote up
export function parseSPCompErrors(
  stdout: string,
  compilerDiagnostics: DiagnosticCollection,
  filePath?: string
): void {
  const DocumentDiagnostics: Map<string, Diagnostic[]> = new Map();
  const re = /([:\/\\A-Za-z\-_0-9. ]*)\((\d+)+\) : ((error|fatal error|warning) ([0-9]*)):\s+(.*)/gm;
  let matches: RegExpExecArray | null;
  let diagnostics: Diagnostic[];
  do {
    matches = re.exec(stdout.toString() || "");
    if (matches) {
      let range = new Range(
        new Position(Number(matches[2]) - 1, 0),
        new Position(Number(matches[2]) - 1, 256)
      );
      let severity =
        matches[4] === "warning"
          ? DiagnosticSeverity.Warning
          : DiagnosticSeverity.Error;
      let uri = URI.file(
        filePath === undefined ? matches[1] : filePath
      ).toString();
      diagnostics = DocumentDiagnostics.get(uri) || [];

      let message: string = generateDetailedError(matches[5], matches[6]);
      let diagnostic: Diagnostic = new Diagnostic(range, message, severity);
      diagnostics.push(diagnostic);
      DocumentDiagnostics.set(uri, diagnostics);
    }
  } while (matches);
  compilerDiagnostics.clear();
  for (let [uri, diagnostics] of DocumentDiagnostics) {
    compilerDiagnostics.set(URI.parse(uri), diagnostics);
  }
}
Example #2
Source File: ALDiagnosticCollection.ts    From vscode-alxmldocumentation with MIT License 5 votes vote down vote up
/**
     * Collection to store all gathered diagnostics.
     */
    public static Diagnostics: DiagnosticCollection = languages.createDiagnosticCollection(ALXmlDocDiagnosticPrefix);
Example #3
Source File: holes.ts    From vscode-lean4 with Apache License 2.0 5 votes vote down vote up
private collection: DiagnosticCollection;
Example #4
Source File: leanclient.ts    From vscode-lean4 with Apache License 2.0 5 votes vote down vote up
getDiagnostics() : DiagnosticCollection | undefined {
        return this.running ? this.client?.diagnostics : undefined;
    }
Example #5
Source File: stripeLinter.ts    From vscode-stripe with MIT License 5 votes vote down vote up
diagnosticCollection: DiagnosticCollection =
  languages.createDiagnosticCollection('StripeHardCodedAPIKeys')
Example #6
Source File: Diagnostics.ts    From al-objid with MIT License 5 votes vote down vote up
//#endregion

    private readonly _diagnostics: DiagnosticCollection;