File tree Expand file tree Collapse file tree 2 files changed +65
-2
lines changed Expand file tree Collapse file tree 2 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -115,8 +115,20 @@ impl DebugPanel {
115
115
match event {
116
116
Events :: Initialized ( _) => {
117
117
let client = this. debug_client_by_id ( * client_id, cx) ;
118
- cx. spawn ( |_, _| async move {
119
- // TODO: send all the current breakpoints
118
+
119
+ cx. spawn ( |this, mut cx| async move {
120
+ let task = this. update ( & mut cx, |this, cx| {
121
+ this. workspace . update ( cx, |workspace, cx| {
122
+ workspace. project ( ) . update ( cx, |project, cx| {
123
+ let client = client. clone ( ) ;
124
+
125
+ project. send_breakpoints ( client, cx)
126
+ } )
127
+ } )
128
+ } ) ??;
129
+
130
+ task. await ?;
131
+
120
132
client. configuration_done ( ) . await
121
133
} )
122
134
. detach_and_log_err ( cx) ;
Original file line number Diff line number Diff line change @@ -1059,6 +1059,57 @@ impl Project {
1059
1059
} )
1060
1060
}
1061
1061
1062
+ pub fn send_breakpoints (
1063
+ & self ,
1064
+ client : Arc < DebugAdapterClient > ,
1065
+ cx : & mut ModelContext < Self > ,
1066
+ ) -> Task < Result < ( ) > > {
1067
+ cx. spawn ( |project, mut cx| async move {
1068
+ let task = project. update ( & mut cx, |project, cx| {
1069
+ let mut tasks = Vec :: new ( ) ;
1070
+
1071
+ for ( buffer_id, breakpoints) in project. breakpoints . iter ( ) {
1072
+ let res = maybe ! ( {
1073
+ let buffer = project. buffer_for_id( * buffer_id) ?;
1074
+
1075
+ let project_path = buffer. read( cx) . project_path( cx) ?;
1076
+ let worktree = project. worktree_for_id( project_path. worktree_id, cx) ?;
1077
+ let path = worktree. read( cx) . absolutize( & project_path. path) . ok( ) ?;
1078
+
1079
+ Some ( ( path, breakpoints) )
1080
+ } ) ;
1081
+
1082
+ if let Some ( ( path, breakpoints) ) = res {
1083
+ tasks. push (
1084
+ client. set_breakpoints (
1085
+ path,
1086
+ Some (
1087
+ breakpoints
1088
+ . iter ( )
1089
+ . map ( |b| SourceBreakpoint {
1090
+ line : b. row as u64 ,
1091
+ condition : None ,
1092
+ hit_condition : None ,
1093
+ log_message : None ,
1094
+ column : None ,
1095
+ mode : None ,
1096
+ } )
1097
+ . collect :: < Vec < _ > > ( ) ,
1098
+ ) ,
1099
+ ) ,
1100
+ ) ;
1101
+ }
1102
+ }
1103
+
1104
+ try_join_all ( tasks)
1105
+ } ) ?;
1106
+
1107
+ task. await ?;
1108
+
1109
+ Ok ( ( ) )
1110
+ } )
1111
+ }
1112
+
1062
1113
pub fn start_debug_adapter_client (
1063
1114
& mut self ,
1064
1115
debug_task : task:: ResolvedTask ,
You can’t perform that action at this time.
0 commit comments