@@ -10,6 +10,7 @@ import URI from 'vs/base/common/uri';
1010import * as vscode from 'vscode' ;
1111import { MainContext , MainThreadDiagnosticsShape , ExtHostDiagnosticsShape , IMainContext } from './extHost.protocol' ;
1212import { DiagnosticSeverity } from './extHostTypes' ;
13+ import * as converter from './extHostTypeConverters' ;
1314import { mergeSort } from 'vs/base/common/arrays' ;
1415import { Event , Emitter , debounceEvent , mapEvent } from 'vs/base/common/event' ;
1516import { keys } from 'vs/base/common/map' ;
@@ -115,7 +116,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
115116 orderLoop: for ( let i = 0 ; i < 4 ; i ++ ) {
116117 for ( let diagnostic of diagnostics ) {
117118 if ( diagnostic . severity === order [ i ] ) {
118- const len = marker . push ( DiagnosticCollection . toMarkerData ( diagnostic ) ) ;
119+ const len = marker . push ( converter . fromDiagnostic ( diagnostic ) ) ;
119120 if ( len === DiagnosticCollection . _maxDiagnosticsPerFile ) {
120121 break orderLoop;
121122 }
@@ -133,7 +134,7 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
133134 endColumn : marker [ marker . length - 1 ] . endColumn
134135 } ) ;
135136 } else {
136- marker = diagnostics . map ( DiagnosticCollection . toMarkerData ) ;
137+ marker = diagnostics . map ( converter . fromDiagnostic ) ;
137138 }
138139 }
139140
@@ -185,32 +186,6 @@ export class DiagnosticCollection implements vscode.DiagnosticCollection {
185186 }
186187 }
187188
188- public static toMarkerData ( diagnostic : vscode . Diagnostic ) : IMarkerData {
189-
190- let range = diagnostic . range ;
191-
192- return < IMarkerData > {
193- startLineNumber : range . start . line + 1 ,
194- startColumn : range . start . character + 1 ,
195- endLineNumber : range . end . line + 1 ,
196- endColumn : range . end . character + 1 ,
197- message : diagnostic . message ,
198- source : diagnostic . source ,
199- severity : DiagnosticCollection . _convertDiagnosticsSeverity ( diagnostic . severity ) ,
200- code : String ( diagnostic . code )
201- } ;
202- }
203-
204- private static _convertDiagnosticsSeverity ( severity : number ) : MarkerSeverity {
205- switch ( severity ) {
206- case 0 : return MarkerSeverity . Error ;
207- case 1 : return MarkerSeverity . Warning ;
208- case 2 : return MarkerSeverity . Info ;
209- case 3 : return MarkerSeverity . Hint ;
210- default : return MarkerSeverity . Error ;
211- }
212- }
213-
214189 private static _compareIndexedTuplesByUri ( a : [ vscode . Uri , vscode . Diagnostic [ ] ] , b : [ vscode . Uri , vscode . Diagnostic [ ] ] ) : number {
215190 if ( a [ 0 ] . toString ( ) < b [ 0 ] . toString ( ) ) {
216191 return - 1 ;
0 commit comments