File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -106,7 +106,7 @@ pub struct StopEvent {
106106}
107107
108108pub async fn handle_after_edit ( ) -> anyhow:: Result < CursorHookOutput > {
109- let input: FileEditEvent = serde_json:: from_str ( & stdin ( ) ?)
109+ let mut input: FileEditEvent = serde_json:: from_str ( & stdin ( ) ?)
110110 . map_err ( |e| anyhow:: anyhow!( "Failed to parse input JSON: {}" , e) ) ?;
111111 let hook_headers = input
112112 . edits
@@ -120,6 +120,14 @@ pub async fn handle_after_edit() -> anyhow::Result<CursorHookOutput> {
120120 . first ( )
121121 . ok_or_else ( || anyhow:: anyhow!( "No workspace roots provided" ) )
122122 . map ( std:: path:: Path :: new) ?;
123+
124+ // Convert file_path from absolute to relative
125+ let absolute_path = std:: path:: Path :: new ( & input. file_path ) ;
126+ input. file_path = absolute_path
127+ . strip_prefix ( dir)
128+ . map ( |p| p. to_string_lossy ( ) . to_string ( ) )
129+ . unwrap_or ( input. file_path ) ;
130+
123131 let repo = gix:: discover ( dir) ?;
124132 let project = Project :: from_path (
125133 repo. workdir ( )
You can’t perform that action at this time.
0 commit comments