import * as path from 'path' ; import * as vscode from 'vscode' ; import { File , Issue } from "./models" ; param basePath param files export function restoreRelativePaths ( basePath , files ) { files . forEach ( file => { file . path = path . join ( basePath , file . path ) ; } ) ; } param issue export function getIssueSeverity ( issue ) { switch ( issue . issueType . severity ) { case 'ERROR' : return vscode . DiagnosticSeverity . Error ; case 'HINT' : return vscode . DiagnosticSeverity . Hint ; case 'INFORMATION' : return vscode . DiagnosticSeverity . Information ; case 'SUGGESTION' : return vscode . DiagnosticSeverity . Information ; case 'WARNING' : return vscode . DiagnosticSeverity . Warning ; } } param data param issue export function getIssueRange ( data , issue ) { const lineIndex = issue . line - 1 ; let startIndex = issue . offset . start ; let endIndex = issue . offset . end ; const lines = data . split ( '\n' ) ; let index = 0 ; for ( let i = 0 ; i < lineIndex ; i ++ ) { index += lines [ i ] . length + 1 ; } startIndex -= index ; endIndex -= index ; return new vscode . Range ( lineIndex , startIndex , lineIndex , endIndex ) ; }