@@ -16,13 +16,12 @@ import {
1616 Command , CodeLens , FormattingOptions , TextEdit , WorkspaceEdit
1717} from 'vscode-base-languageclient/lib/base' ;
1818import IReadOnlyModel = monaco . editor . IReadOnlyModel ;
19- import languages = monaco . languages ;
2019
2120export type RecursivePartial < T > = {
2221 [ P in keyof T ] ?: RecursivePartial < T [ P ] > ;
2322} ;
2423
25- export interface ProtocolCodeLens extends languages . ICodeLensSymbol {
24+ export interface ProtocolCodeLens extends monaco . languages . ICodeLensSymbol {
2625 data ?: any ;
2726}
2827
@@ -32,7 +31,7 @@ export namespace ProtocolCodeLens {
3231 }
3332}
3433
35- export interface ProtocolCompletionItem extends languages . CompletionItem {
34+ export interface ProtocolCompletionItem extends monaco . languages . CompletionItem {
3635 data ?: any ;
3736 fromEdit ?: boolean ;
3837}
@@ -92,15 +91,15 @@ export class MonacoToProtocolConverter {
9291 } ;
9392 }
9493
95- asCompletionItem ( item : languages . CompletionItem ) : CompletionItem {
94+ asCompletionItem ( item : monaco . languages . CompletionItem ) : CompletionItem {
9695 const result : CompletionItem = { label : item . label } ;
9796 if ( item . detail ) { result . detail = item . detail ; }
9897 if ( item . documentation ) { result . documentation = item . documentation ; }
9998 if ( item . filterText ) { result . filterText = item . filterText ; }
10099 this . fillPrimaryInsertText ( result , item as ProtocolCompletionItem ) ;
101100 // Protocol item kind is 1 based, codes item kind is zero based.
102101 if ( is . number ( item . kind ) ) {
103- if ( languages . CompletionItemKind . Text <= item . kind && item . kind <= languages . CompletionItemKind . Reference ) {
102+ if ( monaco . languages . CompletionItemKind . Text <= item . kind && item . kind <= monaco . languages . CompletionItemKind . Reference ) {
104103 result . kind = ( item . kind + 1 ) as CompletionItemKind ;
105104 } else {
106105 result . kind = CompletionItemKind . Text ;
@@ -185,7 +184,7 @@ export class MonacoToProtocolConverter {
185184 return markers . map ( marker => this . asDiagnostic ( marker ) ) ;
186185 }
187186
188- asCodeActionContext ( context : languages . CodeActionContext ) : CodeActionContext {
187+ asCodeActionContext ( context : monaco . languages . CodeActionContext ) : CodeActionContext {
189188 if ( context === void 0 || context === null ) {
190189 return context ;
191190 }
@@ -195,23 +194,23 @@ export class MonacoToProtocolConverter {
195194 }
196195 }
197196
198- asCodeActionParams ( model : IReadOnlyModel , range : monaco . Range , context : languages . CodeActionContext ) : CodeActionParams {
197+ asCodeActionParams ( model : IReadOnlyModel , range : monaco . Range , context : monaco . languages . CodeActionContext ) : CodeActionParams {
199198 return {
200199 textDocument : this . asTextDocumentIdentifier ( model ) ,
201200 range : this . asRange ( range ) ,
202201 context : this . asCodeActionContext ( context )
203202 }
204203 }
205204
206- asCommand ( item : languages . Command | undefined | null ) : Command | undefined {
205+ asCommand ( item : monaco . languages . Command | undefined | null ) : Command | undefined {
207206 if ( item ) {
208207 let args = item . arguments || [ ] ;
209208 return Command . create ( item . title , item . id , ...args ) ;
210209 }
211210 return undefined ;
212211 }
213212
214- asCodeLens ( item : languages . ICodeLensSymbol ) : CodeLens {
213+ asCodeLens ( item : monaco . languages . ICodeLensSymbol ) : CodeLens {
215214 const range = this . asRange ( item . range ) ;
216215 const data = ProtocolCodeLens . is ( item ) ? item . data : undefined ;
217216 const command = this . asCommand ( item . command ) ;
@@ -220,26 +219,26 @@ export class MonacoToProtocolConverter {
220219 }
221220 }
222221
223- asFormattingOptions ( options : languages . FormattingOptions ) : FormattingOptions {
222+ asFormattingOptions ( options : monaco . languages . FormattingOptions ) : FormattingOptions {
224223 return { tabSize : options . tabSize , insertSpaces : options . insertSpaces } ;
225224 }
226225
227- asDocumentFormattingParams ( model : IReadOnlyModel , options : languages . FormattingOptions ) : DocumentFormattingParams {
226+ asDocumentFormattingParams ( model : IReadOnlyModel , options : monaco . languages . FormattingOptions ) : DocumentFormattingParams {
228227 return {
229228 textDocument : this . asTextDocumentIdentifier ( model ) ,
230229 options : this . asFormattingOptions ( options )
231230 }
232231 }
233232
234- asDocumentRangeFormattingParams ( model : IReadOnlyModel , range : monaco . Range , options : languages . FormattingOptions ) : DocumentRangeFormattingParams {
233+ asDocumentRangeFormattingParams ( model : IReadOnlyModel , range : monaco . Range , options : monaco . languages . FormattingOptions ) : DocumentRangeFormattingParams {
235234 return {
236235 textDocument : this . asTextDocumentIdentifier ( model ) ,
237236 range : this . asRange ( range ) ,
238237 options : this . asFormattingOptions ( options )
239238 }
240239 }
241240
242- asDocumentOnTypeFormattingParams ( model : IReadOnlyModel , position : monaco . IPosition , ch : string , options : languages . FormattingOptions ) : DocumentOnTypeFormattingParams {
241+ asDocumentOnTypeFormattingParams ( model : IReadOnlyModel , position : monaco . IPosition , ch : string , options : monaco . languages . FormattingOptions ) : DocumentOnTypeFormattingParams {
243242 return {
244243 textDocument : this . asTextDocumentIdentifier ( model ) ,
245244 position : this . asPosition ( position . lineNumber , position . column ) ,
@@ -259,7 +258,7 @@ export class MonacoToProtocolConverter {
259258
260259export class ProtocolToMonacoConverter {
261260
262- asResourceEdits ( resource : monaco . Uri , edits : TextEdit [ ] ) : languages . IResourceEdit [ ] {
261+ asResourceEdits ( resource : monaco . Uri , edits : TextEdit [ ] ) : monaco . languages . IResourceEdit [ ] {
263262 return edits . map ( edit => {
264263 const range = this . asRange ( edit . range ) ! ;
265264 return {
@@ -270,14 +269,14 @@ export class ProtocolToMonacoConverter {
270269 } )
271270 }
272271
273- asWorkspaceEdit ( item : WorkspaceEdit ) : languages . WorkspaceEdit ;
272+ asWorkspaceEdit ( item : WorkspaceEdit ) : monaco . languages . WorkspaceEdit ;
274273 asWorkspaceEdit ( item : undefined | null ) : undefined ;
275- asWorkspaceEdit ( item : WorkspaceEdit | undefined | null ) : languages . WorkspaceEdit | undefined ;
276- asWorkspaceEdit ( item : WorkspaceEdit | undefined | null ) : languages . WorkspaceEdit | undefined {
274+ asWorkspaceEdit ( item : WorkspaceEdit | undefined | null ) : monaco . languages . WorkspaceEdit | undefined ;
275+ asWorkspaceEdit ( item : WorkspaceEdit | undefined | null ) : monaco . languages . WorkspaceEdit | undefined {
277276 if ( ! item ) {
278277 return undefined ;
279278 }
280- const edits : languages . IResourceEdit [ ] = [ ] ;
279+ const edits : monaco . languages . IResourceEdit [ ] = [ ] ;
281280 if ( item . documentChanges ) {
282281 for ( const change of item . documentChanges ) {
283282 const resource = monaco . Uri . parse ( change . textDocument . uri ) ;
@@ -312,10 +311,10 @@ export class ProtocolToMonacoConverter {
312311 return items . map ( item => this . asTextEdit ( item ) ) ;
313312 }
314313
315- asCodeLens ( item : CodeLens ) : languages . ICodeLensSymbol ;
314+ asCodeLens ( item : CodeLens ) : monaco . languages . ICodeLensSymbol ;
316315 asCodeLens ( item : undefined | null ) : undefined ;
317- asCodeLens ( item : CodeLens | undefined | null ) : languages . ICodeLensSymbol | undefined ;
318- asCodeLens ( item : CodeLens | undefined | null ) : languages . ICodeLensSymbol | undefined {
316+ asCodeLens ( item : CodeLens | undefined | null ) : monaco . languages . ICodeLensSymbol | undefined ;
317+ asCodeLens ( item : CodeLens | undefined | null ) : monaco . languages . ICodeLensSymbol | undefined {
319318 if ( ! item ) {
320319 return undefined ;
321320 }
@@ -326,46 +325,46 @@ export class ProtocolToMonacoConverter {
326325 return result ;
327326 }
328327
329- asCodeLenses ( items : CodeLens [ ] ) : languages . ICodeLensSymbol [ ] ;
328+ asCodeLenses ( items : CodeLens [ ] ) : monaco . languages . ICodeLensSymbol [ ] ;
330329 asCodeLenses ( items : undefined | null ) : undefined ;
331- asCodeLenses ( items : CodeLens [ ] | undefined | null ) : languages . ICodeLensSymbol [ ] | undefined ;
332- asCodeLenses ( items : CodeLens [ ] | undefined | null ) : languages . ICodeLensSymbol [ ] | undefined {
330+ asCodeLenses ( items : CodeLens [ ] | undefined | null ) : monaco . languages . ICodeLensSymbol [ ] | undefined ;
331+ asCodeLenses ( items : CodeLens [ ] | undefined | null ) : monaco . languages . ICodeLensSymbol [ ] | undefined {
333332 if ( ! items ) {
334333 return undefined ;
335334 }
336335 return items . map ( ( codeLens ) => this . asCodeLens ( codeLens ) ) ;
337336 }
338337
339338
340- asCodeActions ( commands : Command [ ] ) : languages . CodeAction [ ] {
339+ asCodeActions ( commands : Command [ ] ) : monaco . languages . CodeAction [ ] {
341340 return this . asCommands ( commands ) . map ( ( command , score ) => {
342- return < languages . CodeAction > { command, score }
341+ return < monaco . languages . CodeAction > { command, score }
343342 } ) ;
344343 }
345344
346- asCommand ( command : Command ) : languages . Command {
345+ asCommand ( command : Command ) : monaco . languages . Command {
347346 return {
348347 id : command . command ,
349348 title : command . title ,
350349 arguments : command . arguments
351350 } ;
352351 }
353352
354- asCommands ( commands : Command [ ] ) : languages . Command [ ] {
353+ asCommands ( commands : Command [ ] ) : monaco . languages . Command [ ] {
355354 return commands . map ( command => this . asCommand ( command ) ) ;
356355 }
357356
358- asSymbolInformations ( values : SymbolInformation [ ] , uri ?: monaco . Uri ) : languages . SymbolInformation [ ] ;
357+ asSymbolInformations ( values : SymbolInformation [ ] , uri ?: monaco . Uri ) : monaco . languages . SymbolInformation [ ] ;
359358 asSymbolInformations ( values : undefined | null , uri ?: monaco . Uri ) : undefined ;
360- asSymbolInformations ( values : SymbolInformation [ ] | undefined | null , uri ?: monaco . Uri ) : languages . SymbolInformation [ ] | undefined ;
361- asSymbolInformations ( values : SymbolInformation [ ] | undefined | null , uri ?: monaco . Uri ) : languages . SymbolInformation [ ] | undefined {
359+ asSymbolInformations ( values : SymbolInformation [ ] | undefined | null , uri ?: monaco . Uri ) : monaco . languages . SymbolInformation [ ] | undefined ;
360+ asSymbolInformations ( values : SymbolInformation [ ] | undefined | null , uri ?: monaco . Uri ) : monaco . languages . SymbolInformation [ ] | undefined {
362361 if ( ! values ) {
363362 return undefined ;
364363 }
365364 return values . map ( information => this . asSymbolInformation ( information , uri ) ) ;
366365 }
367366
368- asSymbolInformation ( item : SymbolInformation , uri ?: monaco . Uri ) : languages . SymbolInformation {
367+ asSymbolInformation ( item : SymbolInformation , uri ?: monaco . Uri ) : monaco . languages . SymbolInformation {
369368 // Symbol kind is one based in the protocol and zero based in code.
370369 return {
371370 name : item . name ,
@@ -375,48 +374,48 @@ export class ProtocolToMonacoConverter {
375374 } ;
376375 }
377376
378- asDocumentHighlights ( values : DocumentHighlight [ ] ) : languages . DocumentHighlight [ ] ;
377+ asDocumentHighlights ( values : DocumentHighlight [ ] ) : monaco . languages . DocumentHighlight [ ] ;
379378 asDocumentHighlights ( values : undefined | null ) : undefined ;
380- asDocumentHighlights ( values : DocumentHighlight [ ] | undefined | null ) : languages . DocumentHighlight [ ] | undefined ;
381- asDocumentHighlights ( values : DocumentHighlight [ ] | undefined | null ) : languages . DocumentHighlight [ ] | undefined {
379+ asDocumentHighlights ( values : DocumentHighlight [ ] | undefined | null ) : monaco . languages . DocumentHighlight [ ] | undefined ;
380+ asDocumentHighlights ( values : DocumentHighlight [ ] | undefined | null ) : monaco . languages . DocumentHighlight [ ] | undefined {
382381 if ( ! values ) {
383382 return undefined ;
384383 }
385384 return values . map ( item => this . asDocumentHighlight ( item ) ) ;
386385 }
387386
388- asDocumentHighlight ( item : DocumentHighlight ) : languages . DocumentHighlight {
387+ asDocumentHighlight ( item : DocumentHighlight ) : monaco . languages . DocumentHighlight {
389388 const range = this . asRange ( item . range ) ! ;
390389 const kind = is . number ( item . kind ) ? this . asDocumentHighlightKind ( item . kind ) : undefined ! ;
391390 return { range, kind } ;
392391 }
393392
394- asDocumentHighlightKind ( item : number ) : languages . DocumentHighlightKind {
393+ asDocumentHighlightKind ( item : number ) : monaco . languages . DocumentHighlightKind {
395394 switch ( item ) {
396395 case DocumentHighlightKind . Text :
397- return languages . DocumentHighlightKind . Text ;
396+ return monaco . languages . DocumentHighlightKind . Text ;
398397 case DocumentHighlightKind . Read :
399- return languages . DocumentHighlightKind . Read ;
398+ return monaco . languages . DocumentHighlightKind . Read ;
400399 case DocumentHighlightKind . Write :
401- return languages . DocumentHighlightKind . Write ;
400+ return monaco . languages . DocumentHighlightKind . Write ;
402401 }
403- return languages . DocumentHighlightKind . Text ;
402+ return monaco . languages . DocumentHighlightKind . Text ;
404403 }
405404
406- asReferences ( values : Location [ ] ) : languages . Location [ ] ;
407- asReferences ( values : undefined | null ) : languages . Location [ ] | undefined ;
408- asReferences ( values : Location [ ] | undefined | null ) : languages . Location [ ] | undefined ;
409- asReferences ( values : Location [ ] | undefined | null ) : languages . Location [ ] | undefined {
405+ asReferences ( values : Location [ ] ) : monaco . languages . Location [ ] ;
406+ asReferences ( values : undefined | null ) : monaco . languages . Location [ ] | undefined ;
407+ asReferences ( values : Location [ ] | undefined | null ) : monaco . languages . Location [ ] | undefined ;
408+ asReferences ( values : Location [ ] | undefined | null ) : monaco . languages . Location [ ] | undefined {
410409 if ( ! values ) {
411410 return undefined ;
412411 }
413412 return values . map ( location => this . asLocation ( location ) ) ;
414413 }
415414
416- asDefinitionResult ( item : Definition ) : languages . Definition ;
415+ asDefinitionResult ( item : Definition ) : monaco . languages . Definition ;
417416 asDefinitionResult ( item : undefined | null ) : undefined ;
418- asDefinitionResult ( item : Definition | undefined | null ) : languages . Definition | undefined ;
419- asDefinitionResult ( item : Definition | undefined | null ) : languages . Definition | undefined {
417+ asDefinitionResult ( item : Definition | undefined | null ) : monaco . languages . Definition | undefined ;
418+ asDefinitionResult ( item : Definition | undefined | null ) : monaco . languages . Definition | undefined {
420419 if ( ! item ) {
421420 return undefined ;
422421 }
@@ -427,10 +426,10 @@ export class ProtocolToMonacoConverter {
427426 }
428427 }
429428
430- asLocation ( item : Location ) : languages . Location ;
429+ asLocation ( item : Location ) : monaco . languages . Location ;
431430 asLocation ( item : undefined | null ) : undefined ;
432- asLocation ( item : Location | undefined | null ) : languages . Location | undefined ;
433- asLocation ( item : Location | undefined | null ) : languages . Location | undefined {
431+ asLocation ( item : Location | undefined | null ) : monaco . languages . Location | undefined ;
432+ asLocation ( item : Location | undefined | null ) : monaco . languages . Location | undefined {
434433 if ( ! item ) {
435434 return undefined ;
436435 }
@@ -442,13 +441,13 @@ export class ProtocolToMonacoConverter {
442441 }
443442
444443 asSignatureHelp ( item : undefined | null ) : undefined ;
445- asSignatureHelp ( item : SignatureHelp ) : languages . SignatureHelp ;
446- asSignatureHelp ( item : SignatureHelp | undefined | null ) : languages . SignatureHelp | undefined ;
447- asSignatureHelp ( item : SignatureHelp | undefined | null ) : languages . SignatureHelp | undefined {
444+ asSignatureHelp ( item : SignatureHelp ) : monaco . languages . SignatureHelp ;
445+ asSignatureHelp ( item : SignatureHelp | undefined | null ) : monaco . languages . SignatureHelp | undefined ;
446+ asSignatureHelp ( item : SignatureHelp | undefined | null ) : monaco . languages . SignatureHelp | undefined {
448447 if ( ! item ) {
449448 return undefined ;
450449 }
451- let result = < languages . SignatureHelp > { } ;
450+ let result = < monaco . languages . SignatureHelp > { } ;
452451 if ( is . number ( item . activeSignature ) ) {
453452 result . activeSignature = item . activeSignature ;
454453 } else {
@@ -465,31 +464,31 @@ export class ProtocolToMonacoConverter {
465464 return result ;
466465 }
467466
468- asSignatureInformations ( items : SignatureInformation [ ] ) : languages . SignatureInformation [ ] {
467+ asSignatureInformations ( items : SignatureInformation [ ] ) : monaco . languages . SignatureInformation [ ] {
469468 return items . map ( item => this . asSignatureInformation ( item ) ) ;
470469 }
471470
472- asSignatureInformation ( item : SignatureInformation ) : languages . SignatureInformation {
473- let result = < languages . SignatureInformation > { label : item . label } ;
471+ asSignatureInformation ( item : SignatureInformation ) : monaco . languages . SignatureInformation {
472+ let result = < monaco . languages . SignatureInformation > { label : item . label } ;
474473 if ( item . documentation ) { result . documentation = item . documentation ; }
475474 if ( item . parameters ) { result . parameters = this . asParameterInformations ( item . parameters ) ; }
476475 return result ;
477476 }
478477
479- asParameterInformations ( item : ParameterInformation [ ] ) : languages . ParameterInformation [ ] {
478+ asParameterInformations ( item : ParameterInformation [ ] ) : monaco . languages . ParameterInformation [ ] {
480479 return item . map ( item => this . asParameterInformation ( item ) ) ;
481480 }
482481
483- asParameterInformation ( item : ParameterInformation ) : languages . ParameterInformation {
484- let result = < languages . ParameterInformation > { label : item . label } ;
482+ asParameterInformation ( item : ParameterInformation ) : monaco . languages . ParameterInformation {
483+ let result = < monaco . languages . ParameterInformation > { label : item . label } ;
485484 if ( item . documentation ) { result . documentation = item . documentation } ;
486485 return result ;
487486 }
488487
489- asHover ( hover : Hover ) : languages . Hover ;
488+ asHover ( hover : Hover ) : monaco . languages . Hover ;
490489 asHover ( hover : undefined | null ) : undefined ;
491- asHover ( hover : Hover | undefined | null ) : languages . Hover | undefined ;
492- asHover ( hover : Hover | undefined | null ) : languages . Hover | undefined {
490+ asHover ( hover : Hover | undefined | null ) : monaco . languages . Hover | undefined ;
491+ asHover ( hover : Hover | undefined | null ) : monaco . languages . Hover | undefined {
493492 if ( ! hover ) {
494493 return undefined ;
495494 }
@@ -526,14 +525,14 @@ export class ProtocolToMonacoConverter {
526525 }
527526 }
528527
529- asCompletionResult ( result : CompletionItem [ ] | CompletionList | undefined ) : languages . CompletionItem [ ] | languages . CompletionList | undefined {
528+ asCompletionResult ( result : CompletionItem [ ] | CompletionList | undefined ) : monaco . languages . CompletionItem [ ] | monaco . languages . CompletionList | undefined {
530529 if ( ! result ) {
531530 return undefined ;
532531 }
533532 if ( Array . isArray ( result ) ) {
534533 return result . map ( item => this . asCompletionItem ( item ) ) ;
535534 }
536- return < languages . CompletionList > {
535+ return < monaco . languages . CompletionList > {
537536 isIncomplete : result . isIncomplete ,
538537 items : result . items . map ( this . asCompletionItem . bind ( this ) )
539538 }
@@ -559,7 +558,7 @@ export class ProtocolToMonacoConverter {
559558 return result ;
560559 }
561560
562- asCompletionInsertText ( item : CompletionItem ) : { text : string | languages . SnippetString , range ?: monaco . Range , fromEdit : boolean } | undefined {
561+ asCompletionInsertText ( item : CompletionItem ) : { text : string | monaco . languages . SnippetString , range ?: monaco . Range , fromEdit : boolean } | undefined {
563562 if ( item . textEdit ) {
564563 const range = this . asRange ( item . textEdit . range ) ! ;
565564 const value = item . textEdit . newText ;
0 commit comments