@@ -19,15 +19,15 @@ import {
1919 Command , CodeLens , FormattingOptions , TextEdit , WorkspaceEdit , DocumentLinkParams , DocumentLink ,
2020 MarkedString , MarkupContent , ColorInformation , ColorPresentation , FoldingRange , FoldingRangeKind ,
2121 DiagnosticRelatedInformation , MarkupKind , SymbolKind , DocumentSymbol , CodeAction , SignatureHelpContext , SignatureHelpTriggerKind ,
22- SemanticTokens , InsertTextMode , AnnotatedTextEdit , ChangeAnnotation
22+ SemanticTokens , InsertTextMode , AnnotatedTextEdit , ChangeAnnotation , CodeDescription
2323} from './services' ;
2424
2525export type RecursivePartial < T > = {
2626 [ P in keyof T ] ?: RecursivePartial < T [ P ] > ;
2727} ;
2828
2929export interface ProtocolDocumentLink extends monaco . languages . ILink {
30- data ?: any ;
30+ data ?: unknown ;
3131}
3232export namespace ProtocolDocumentLink {
3333 export function is ( item : any ) : item is ProtocolDocumentLink {
@@ -36,7 +36,7 @@ export namespace ProtocolDocumentLink {
3636}
3737
3838export interface ProtocolCodeLens extends monaco . languages . CodeLens {
39- data ?: any ;
39+ data ?: unknown ;
4040}
4141export namespace ProtocolCodeLens {
4242 export function is ( item : any ) : item is ProtocolCodeLens {
@@ -45,7 +45,7 @@ export namespace ProtocolCodeLens {
4545}
4646
4747export interface ProtocolCompletionItem extends monaco . languages . CompletionItem {
48- data ?: any ;
48+ data ?: unknown ;
4949 fromEdit ?: boolean ;
5050 documentationFormat ?: string ;
5151 originalItemKind ?: CompletionItemKind ;
@@ -57,9 +57,18 @@ export namespace ProtocolCompletionItem {
5757 return ! ! item && 'data' in item ;
5858 }
5959}
60+ export interface ProtocolIMarkerData extends monaco . editor . IMarkerData {
61+ data ?: unknown ;
62+ codeDescription ?: CodeDescription ;
63+ }
64+ export namespace ProtocolIMarkerData {
65+ export function is ( item : any ) : item is ProtocolIMarkerData {
66+ return ! ! item && 'data' in item ;
67+ }
68+ }
6069
6170export interface ProtocolCodeAction extends monaco . languages . CodeAction {
62- data ?: any ;
71+ data ?: unknown ;
6372}
6473export namespace ProtocolCodeAction {
6574 export function is ( item : any ) : item is ProtocolCodeAction {
@@ -236,7 +245,7 @@ export class MonacoToProtocolConverter {
236245 if ( item . command ) { result . command = this . asCommand ( item . command ) ; }
237246 if ( item . commitCharacters ) { result . commitCharacters = item . commitCharacters . slice ( ) ; }
238247 if ( item . command ) { result . command = this . asCommand ( item . command ) ; }
239- // TODO if (item.preselect === true || item.preselect === false) { result.preselect = item.preselect; }
248+ if ( item . preselect === true || item . preselect === false ) { result . preselect = item . preselect ; }
240249 if ( protocolItem ) {
241250 if ( protocolItem . data !== undefined ) {
242251 result . data = protocolItem . data ;
@@ -245,6 +254,7 @@ export class MonacoToProtocolConverter {
245254 result . deprecated = protocolItem . deprecated ;
246255 }
247256 }
257+ if ( item . tags ) { result . tags = item . tags ?. slice ( ) ; }
248258 return result ;
249259 }
250260
@@ -373,7 +383,12 @@ export class MonacoToProtocolConverter {
373383 asDiagnostic ( marker : monaco . editor . IMarkerData ) : Diagnostic {
374384 const range = this . asRange ( new this . _monaco . Range ( marker . startLineNumber , marker . startColumn , marker . endLineNumber , marker . endColumn ) )
375385 const severity = this . asDiagnosticSeverity ( marker . severity ) ;
376- return Diagnostic . create ( range , marker . message , severity , marker . code as string , marker . source ) ;
386+ const diag = Diagnostic . create ( range , marker . message , severity , marker . code as string , marker . source ) ;
387+ if ( ProtocolIMarkerData . is ( marker ) ) {
388+ diag . data = marker . data
389+ diag . codeDescription = marker . codeDescription ;
390+ }
391+ return diag
377392 }
378393
379394 asDiagnostics ( markers : monaco . editor . IMarkerData [ ] ) : Diagnostic [ ] {
@@ -935,16 +950,16 @@ export class ProtocolToMonacoConverter {
935950 }
936951
937952 asDiagnostics ( diagnostics : undefined ) : undefined ;
938- asDiagnostics ( diagnostics : Diagnostic [ ] ) : monaco . editor . IMarkerData [ ] ;
939- asDiagnostics ( diagnostics : Diagnostic [ ] | undefined ) : monaco . editor . IMarkerData [ ] | undefined ;
940- asDiagnostics ( diagnostics : Diagnostic [ ] | undefined ) : monaco . editor . IMarkerData [ ] | undefined {
953+ asDiagnostics ( diagnostics : Diagnostic [ ] ) : ProtocolIMarkerData [ ] ;
954+ asDiagnostics ( diagnostics : Diagnostic [ ] | undefined ) : ProtocolIMarkerData [ ] | undefined ;
955+ asDiagnostics ( diagnostics : Diagnostic [ ] | undefined ) : ProtocolIMarkerData [ ] | undefined {
941956 if ( ! diagnostics ) {
942957 return undefined ;
943958 }
944959 return diagnostics . map ( diagnostic => this . asDiagnostic ( diagnostic ) ) ;
945960 }
946961
947- asDiagnostic ( diagnostic : Diagnostic ) : monaco . editor . IMarkerData {
962+ asDiagnostic ( diagnostic : Diagnostic ) : ProtocolIMarkerData {
948963 return {
949964 code : typeof diagnostic . code === "number" ? diagnostic . code . toString ( ) : diagnostic . code ,
950965 severity : this . asSeverity ( diagnostic . severity ) ,
@@ -955,7 +970,9 @@ export class ProtocolToMonacoConverter {
955970 endLineNumber : diagnostic . range . end . line + 1 ,
956971 endColumn : diagnostic . range . end . character + 1 ,
957972 relatedInformation : this . asRelatedInformations ( diagnostic . relatedInformation ) ,
958- tags : diagnostic . tags
973+ codeDescription : diagnostic . codeDescription ,
974+ tags : diagnostic . tags ,
975+ data : diagnostic . data
959976 }
960977 }
961978
@@ -1029,7 +1046,8 @@ export class ProtocolToMonacoConverter {
10291046 if ( item . deprecated === true || item . deprecated === false ) {
10301047 result . deprecated = item . deprecated ;
10311048 }
1032- result . insertTextMode = item . insertTextMode
1049+ if ( item . insertTextMode ) { result . insertTextMode = item . insertTextMode ; }
1050+ if ( item . tags ) { result . tags = item . tags ; }
10331051 return result ;
10341052 }
10351053
0 commit comments