@@ -68,6 +68,7 @@ import {
68
68
OpenFileDialogResult ,
69
69
CheckDiagnosticsRequestType ,
70
70
CheckDiagnosticsParams ,
71
+ DiagnosticInfo ,
71
72
openWorkspaceFileRequestType ,
72
73
OpenWorkspaceFileParams ,
73
74
} from '@aws/language-server-runtimes/protocol'
@@ -565,16 +566,16 @@ export function registerMessageListeners(
565
566
registerHandlerWithResponseRouter ( getSerializedChatRequestType . method )
566
567
// Register diagnostic check handler
567
568
languageClient . onRequest ( CheckDiagnosticsRequestType . method , async ( params : CheckDiagnosticsParams ) => {
568
- const result : Record < string , any > = { }
569
+ const result : Record < string , DiagnosticInfo [ ] > = { }
569
570
570
- for ( const [ filePath , diagnosticJson ] of Object . entries ( params . filePaths ) ) {
571
+ for ( const [ filePath , diagnosticJson ] of Object . entries ( params . filePath ) ) {
571
572
try {
572
573
const uri = vscode . Uri . file ( filePath )
573
574
const diagnostics = vscode . languages . getDiagnostics ( uri )
574
575
575
576
if ( diagnostics && diagnostics . length > 0 ) {
576
577
// Convert VSCode diagnostics to JSON format
577
- const diagnosticsJson = diagnostics . map ( ( diagnostic ) => ( {
578
+ const diagnosticsJson : DiagnosticInfo [ ] = diagnostics . map ( ( diagnostic ) => ( {
578
579
range : {
579
580
start : {
580
581
line : diagnostic . range . start . line ,
@@ -585,7 +586,10 @@ export function registerMessageListeners(
585
586
severity : diagnostic . severity ,
586
587
message : diagnostic . message ,
587
588
source : diagnostic . source ,
588
- code : diagnostic . code ,
589
+ code :
590
+ typeof diagnostic . code === 'object' && diagnostic . code !== null
591
+ ? diagnostic . code . value
592
+ : diagnostic . code ,
589
593
} ) )
590
594
result [ filePath ] = diagnosticsJson
591
595
} else {
@@ -597,7 +601,7 @@ export function registerMessageListeners(
597
601
result [ filePath ] = diagnosticJson || [ ]
598
602
}
599
603
}
600
- return { filePaths : result }
604
+ return { filePath : result }
601
605
} )
602
606
603
607
// Register openWorkspaceFile handler
0 commit comments