|
@@ -59,18 +59,49 @@ class display_handler (jsonrpc : jsonrpc_handler) com (cs : CompilationCache.t)
|
|
let file = jsonrpc#get_string_param "file" in
|
|
let file = jsonrpc#get_string_param "file" in
|
|
Path.get_full_path file
|
|
Path.get_full_path file
|
|
) file_input_marker in
|
|
) file_input_marker in
|
|
- let pos = if requires_offset then jsonrpc#get_int_param "offset" else (-1) in
|
|
|
|
- com.file_contents <- jsonrpc#get_opt_param (fun () ->
|
|
|
|
|
|
+ let contents = jsonrpc#get_opt_param (fun () ->
|
|
let s = jsonrpc#get_string_param "contents" in
|
|
let s = jsonrpc#get_string_param "contents" in
|
|
- let file_unique = com.file_keys#get file in
|
|
|
|
- Some [file_unique, Some s]
|
|
|
|
- ) None;
|
|
|
|
|
|
+ Some s
|
|
|
|
+ ) None in
|
|
|
|
+
|
|
|
|
+ let pos = if requires_offset then jsonrpc#get_int_param "offset" else (-1) in
|
|
Parser.was_auto_triggered := was_auto_triggered;
|
|
Parser.was_auto_triggered := was_auto_triggered;
|
|
- DisplayPosition.display_position#set {
|
|
|
|
- pfile = file;
|
|
|
|
- pmin = pos;
|
|
|
|
- pmax = pos;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ if file <> file_input_marker then begin
|
|
|
|
+ let file_unique = com.file_keys#get file in
|
|
|
|
+
|
|
|
|
+ DisplayPosition.display_position#set {
|
|
|
|
+ pfile = file;
|
|
|
|
+ pmin = pos;
|
|
|
|
+ pmax = pos;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ com.file_contents <- [file_unique, contents];
|
|
|
|
+ end else begin
|
|
|
|
+ let file_contents = jsonrpc#get_opt_param (fun () ->
|
|
|
|
+ jsonrpc#get_opt_param (fun () -> jsonrpc#get_array_param "fileContents") []
|
|
|
|
+ ) [] in
|
|
|
|
+
|
|
|
|
+ let file_contents = List.map (fun fc -> match fc with
|
|
|
|
+ | JObject fl ->
|
|
|
|
+ let file = jsonrpc#get_string_field "fileContents" "file" fl in
|
|
|
|
+ let file = Path.get_full_path file in
|
|
|
|
+ let file_unique = com.file_keys#get file in
|
|
|
|
+ let contents = jsonrpc#get_opt_param (fun () ->
|
|
|
|
+ let s = jsonrpc#get_string_field "fileContents" "contents" fl in
|
|
|
|
+ Some s
|
|
|
|
+ ) None in
|
|
|
|
+ (file_unique, contents)
|
|
|
|
+ | _ -> invalid_arg "fileContents"
|
|
|
|
+ ) file_contents in
|
|
|
|
+
|
|
|
|
+ let files = (List.map (fun (k, _) -> k) file_contents) in
|
|
|
|
+ com.file_contents <- file_contents;
|
|
|
|
+
|
|
|
|
+ match files with
|
|
|
|
+ | [] | [_] -> DisplayPosition.display_position#set { pfile = file; pmin = pos; pmax = pos; };
|
|
|
|
+ | _ -> DisplayPosition.display_position#set_files files;
|
|
|
|
+ end
|
|
end
|
|
end
|
|
|
|
|
|
type handler_context = {
|
|
type handler_context = {
|
|
@@ -126,56 +157,14 @@ let handler =
|
|
hctx.display#enable_display DMDefinition;
|
|
hctx.display#enable_display DMDefinition;
|
|
);
|
|
);
|
|
"display/diagnostics", (fun hctx ->
|
|
"display/diagnostics", (fun hctx ->
|
|
|
|
+ hctx.display#set_display_file false false;
|
|
hctx.display#enable_display DMNone;
|
|
hctx.display#enable_display DMNone;
|
|
|
|
+ hctx.com.report_mode <- RMDiagnostics (List.map (fun (f,_) -> f) hctx.com.file_contents);
|
|
|
|
|
|
- let file = hctx.jsonrpc#get_opt_param (fun () ->
|
|
|
|
- let file = hctx.jsonrpc#get_string_param "file" in
|
|
|
|
- Path.get_full_path file
|
|
|
|
- ) file_input_marker in
|
|
|
|
-
|
|
|
|
- if file <> file_input_marker then begin
|
|
|
|
- let file_unique = hctx.com.file_keys#get file in
|
|
|
|
-
|
|
|
|
- let contents = hctx.jsonrpc#get_opt_param (fun () ->
|
|
|
|
- let s = hctx.jsonrpc#get_string_param "contents" in
|
|
|
|
- Some s
|
|
|
|
- ) None in
|
|
|
|
-
|
|
|
|
- DisplayPosition.display_position#set {
|
|
|
|
- pfile = file;
|
|
|
|
- pmin = -1;
|
|
|
|
- pmax = -1;
|
|
|
|
- };
|
|
|
|
-
|
|
|
|
- hctx.com.file_contents <- Some [file_unique, contents];
|
|
|
|
- hctx.com.report_mode <- RMDiagnostics [file_unique];
|
|
|
|
|
|
+ (match hctx.com.file_contents with
|
|
|
|
+ | [file, None] ->
|
|
hctx.com.display <- { hctx.com.display with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = !ServerConfig.populate_cache_from_display};
|
|
hctx.com.display <- { hctx.com.display with dms_display_file_policy = DFPAlso; dms_per_file = true; dms_populate_cache = !ServerConfig.populate_cache_from_display};
|
|
- end else begin
|
|
|
|
- let file_contents = hctx.jsonrpc#get_opt_param (fun () ->
|
|
|
|
- hctx.jsonrpc#get_opt_param (fun () -> hctx.jsonrpc#get_array_param "fileContents") []
|
|
|
|
- ) [] in
|
|
|
|
-
|
|
|
|
- if (List.length file_contents) = 0 then begin
|
|
|
|
- hctx.com.report_mode <- RMDiagnostics []
|
|
|
|
- end else
|
|
|
|
- let file_contents = List.map (fun fc -> match fc with
|
|
|
|
- | JObject fl ->
|
|
|
|
- let file = hctx.jsonrpc#get_string_field "fileContents" "file" fl in
|
|
|
|
- let file = Path.get_full_path file in
|
|
|
|
- let file_unique = hctx.com.file_keys#get file in
|
|
|
|
- let contents = hctx.jsonrpc#get_opt_param (fun () ->
|
|
|
|
- let s = hctx.jsonrpc#get_string_field "fileContents" "contents" fl in
|
|
|
|
- Some s
|
|
|
|
- ) None in
|
|
|
|
- (file_unique, contents)
|
|
|
|
- | _ -> invalid_arg "fileContents"
|
|
|
|
- ) file_contents in
|
|
|
|
-
|
|
|
|
- let files = (List.map (fun (k, _) -> k) file_contents) in
|
|
|
|
- DisplayPosition.display_position#set_files files;
|
|
|
|
- hctx.com.file_contents <- Some file_contents;
|
|
|
|
- hctx.com.report_mode <- RMDiagnostics files
|
|
|
|
- end
|
|
|
|
|
|
+ | _ -> ());
|
|
);
|
|
);
|
|
"display/implementation", (fun hctx ->
|
|
"display/implementation", (fun hctx ->
|
|
hctx.display#set_display_file false true;
|
|
hctx.display#set_display_file false true;
|