Bläddra i källkod

[display] kind of support --next for completion

But don't tell anyone, it still sucks.
Simon Krajewski 6 år sedan
förälder
incheckning
82bd2c8afc
2 ändrade filer med 8 tillägg och 5 borttagningar
  1. 6 4
      src/compiler/main.ml
  2. 2 1
      src/compiler/server.ml

+ 6 - 4
src/compiler/main.ml

@@ -662,11 +662,13 @@ let rec process_params create pl =
 				loop acc l
 			| _ -> loop (arg :: acc) l
 	in
-	(* put --display in front if it was last parameter *)
-	let pl = (match List.rev pl with
-		| file :: "--display" :: pl when file <> "memory" -> "--display" :: file :: List.rev pl
+	(* put --display in each_params if it was last parameter *)
+	let pl = match List.rev pl with
+		| file :: "--display" :: pl when file <> "memory" ->
+			each_params := "--display" :: file :: !each_params;
+			List.rev pl
 		| _ -> pl
-	) in
+	in
 	loop [] pl
 
 and init ctx =

+ 2 - 1
src/compiler/server.ml

@@ -53,7 +53,8 @@ let check_display_flush ctx f_otherwise = match ctx.com.json_out with
 			f_otherwise ()
 		end
 	| Some api ->
-		if ctx.has_error then begin
+		(* If there's a --next and we're in display mode, try that one. *)
+		if ctx.has_error && not (ctx.has_next && ctx.com.display.dms_display) then begin
 			let errors = List.map (fun msg ->
 				let msg,p,i = match msg with
 					| CMInfo(msg,p) -> msg,p,3