This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 2 files changed +37
-4
lines changed
extensions/codestory/src/server
2 files changed +37
-4
lines changed Original file line number Diff line number Diff line change 4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
6
import * as vscode from 'vscode' ;
7
+ import { SidecarDiagnostics } from './types' ;
7
8
8
- export function getDiagnosticsFromEditor ( filePath : string , interestedRange : vscode . Range ) : vscode . Diagnostic [ ] {
9
+ export function getDiagnosticsFromEditor ( filePath : string , interestedRange : vscode . Range ) : SidecarDiagnostics [ ] {
9
10
const fileUri = vscode . Uri . file ( filePath ) ;
10
11
const diagnostics = vscode . languages . getDiagnostics ( fileUri ) ;
11
- diagnostics . filter ( ( diagnostic ) => {
12
+ const sidecarDiagnostics = diagnostics . filter ( ( diagnostic ) => {
12
13
return interestedRange . contains ( diagnostic . range ) ;
14
+ } ) . map ( ( diagnostic ) => {
15
+ return {
16
+ diagnostic : diagnostic . message ,
17
+ range : {
18
+ startPosition : {
19
+ line : diagnostic . range . start . line ,
20
+ character : diagnostic . range . start . character ,
21
+ byte_offset : 0 ,
22
+ } ,
23
+ endPosition : {
24
+ line : diagnostic . range . end . line ,
25
+ character : diagnostic . range . end . character ,
26
+ byte_offset : 0 ,
27
+ } ,
28
+ } ,
29
+ } ;
13
30
} ) ;
14
- return diagnostics ;
31
+ return sidecarDiagnostics ;
15
32
}
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ export type SidecarApplyEditsRequest = {
115
115
character : number ;
116
116
} ;
117
117
} ;
118
- }
118
+ } ;
119
119
120
120
export type SidecarApplyEditsResponse = {
121
121
fs_file_path : string ;
@@ -133,3 +133,19 @@ export type SidecarApplyEditsResponse = {
133
133
} ;
134
134
} ;
135
135
} ;
136
+
137
+ export type SidecarDiagnostics = {
138
+ diagnostic : string ;
139
+ range : {
140
+ startPosition : {
141
+ line : number ;
142
+ character : number ;
143
+ byte_offset : number ;
144
+ } ;
145
+ endPosition : {
146
+ line : number ;
147
+ character : number ;
148
+ byte_offset : number ;
149
+ } ;
150
+ } ;
151
+ } ;
You can’t perform that action at this time.
0 commit comments