How to use the vscode-languageserver-protocol.DiagnosticSeverity.Error function in vscode-languageserver-protocol

To help you get started, we’ve selected a few vscode-languageserver-protocol examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github neoclide / coc.nvim / src / extensions / tsserver / features / watchBuild.ts View on Github external
let parseLine = (line: string): void => {
      if (startRegex.test(line)) {
        this.setStatus(TscStatus.COMPILING)
        entries = new Map()
      } else if (errorRegex.test(line)) {
        let ms = line.match(errorRegex)
        let severity = /error/.test(ms[4]) ? DiagnosticSeverity.Error : DiagnosticSeverity.Warning
        let lnum = Number(ms[2]) - 1
        let character = Number(ms[3]) - 1
        let range = Range.create(lnum, character, lnum, character)
        let uri = Uri.file(path.join(cwd, ms[1])).toString()
        let diagnostics = entries.get(uri) || []
        diagnostics.push(Diagnostic.create(range, ms[6], severity, ms[5], 'tsc'))
        entries.set(uri, diagnostics)
      } else if (countRegex.test(line)) {
        let ms = line.match(countRegex)
        if (ms[1] == '0') {
          entries = new Map()
          this.setStatus(TscStatus.RUNNING)
          this.collection.clear()
          uris = new Set()
          return
        }
github neoclide / coc-tsserver / src / server / typescriptServiceClientHost.ts View on Github external
) {
      return DiagnosticSeverity.Warning
    }

    switch (diagnostic.category) {
      case PConst.DiagnosticCategory.error:
        return DiagnosticSeverity.Error

      case PConst.DiagnosticCategory.warning:
        return DiagnosticSeverity.Warning

      case PConst.DiagnosticCategory.suggestion:
        return DiagnosticSeverity.Information

      default:
        return DiagnosticSeverity.Error
    }
  }
github neoclide / coc.nvim / src / diagnostic / util.ts View on Github external
export function getSeverityType(severity: DiagnosticSeverity): string {
  switch (severity) {
    case DiagnosticSeverity.Error:
      return 'E'
    case DiagnosticSeverity.Warning:
      return 'W'
    case DiagnosticSeverity.Information:
      return 'I'
    case DiagnosticSeverity.Hint:
      return 'I'
    default:
      return 'Error'
  }
}
github neoclide / coc.nvim / src / extensions / tsserver / typescriptServiceClientHost.ts View on Github external
private getDiagnosticSeverity(diagnostic: Proto.Diagnostic): DiagnosticSeverity {
    if (
      this.reportStyleCheckAsWarnings &&
      this.isStyleCheckDiagnostic(diagnostic.code) &&
      diagnostic.category === PConst.DiagnosticCategory.error
    ) {
      return DiagnosticSeverity.Warning
    }

    switch (diagnostic.category) {
      case PConst.DiagnosticCategory.error:
        return DiagnosticSeverity.Error

      case PConst.DiagnosticCategory.warning:
        return DiagnosticSeverity.Warning

      case PConst.DiagnosticCategory.suggestion:
        return DiagnosticSeverity.Information

      default:
        return DiagnosticSeverity.Error
    }
  }
github neoclide / coc.nvim / src / extensions / tsserver / typescriptServiceClientHost.ts View on Github external
) {
      return DiagnosticSeverity.Warning
    }

    switch (diagnostic.category) {
      case PConst.DiagnosticCategory.error:
        return DiagnosticSeverity.Error

      case PConst.DiagnosticCategory.warning:
        return DiagnosticSeverity.Warning

      case PConst.DiagnosticCategory.suggestion:
        return DiagnosticSeverity.Information

      default:
        return DiagnosticSeverity.Error
    }
  }
github neoclide / coc.nvim / src / diagnostic / manager.ts View on Github external
public setConfigurationErrors(init?: boolean): void {
    let collections = this.collections
    let collection = collections.find(o => o.name == 'config')
    if (!collection) {
      collection = this.create('config')
    } else {
      collection.clear()
    }
    let { errorItems } = workspace.configurations
    if (errorItems && errorItems.length) {
      if (init) workspace.showMessage(`settings file parse error, run ':CocList diagnostics'`, 'error')
      let entries: Map = new Map()
      for (let item of errorItems) {
        let { uri } = item.location
        let diagnostics: Diagnostic[] = entries.get(uri) || []
        diagnostics.push(Diagnostic.create(item.location.range, item.message, DiagnosticSeverity.Error))
        entries.set(uri, diagnostics)
      }
      collection.set(Array.from(entries))
    }
  }
github neoclide / coc-tsserver / src / server / typescriptServiceClientHost.ts View on Github external
private getDiagnosticSeverity(diagnostic: Proto.Diagnostic): DiagnosticSeverity {
    if (
      this.reportStyleCheckAsWarnings &&
      this.isStyleCheckDiagnostic(diagnostic.code) &&
      diagnostic.category === PConst.DiagnosticCategory.error
    ) {
      return DiagnosticSeverity.Warning
    }

    switch (diagnostic.category) {
      case PConst.DiagnosticCategory.error:
        return DiagnosticSeverity.Error

      case PConst.DiagnosticCategory.warning:
        return DiagnosticSeverity.Warning

      case PConst.DiagnosticCategory.suggestion:
        return DiagnosticSeverity.Information

      default:
        return DiagnosticSeverity.Error
    }
  }