Explorar o código

[display] don't include vars in workspace symbols

also don't do anything if the filter is empty

closes #7056
Simon Krajewski %!s(int64=7) %!d(string=hai) anos
pai
achega
ac2c5f009f

+ 2 - 1
src/compiler/displayOutput.ml

@@ -617,6 +617,7 @@ let process_global_display_mode com tctx = match com.display.dms_kind with
 	| DMStatistics ->
 		let stats = Statistics.collect_statistics tctx in
 		raise_statistics (Statistics.Printer.print_statistics stats)
+	| DMModuleSymbols (Some "") -> ()
 	| DMModuleSymbols filter ->
 		let symbols = com.shared.shared_display_information.document_symbols in
 		let symbols = match CompilationServer.get() with
@@ -625,7 +626,7 @@ let process_global_display_mode com tctx = match com.display.dms_kind with
 				let l = CompilationServer.get_context_files cs ((Define.get_signature com.defines) :: (match com.get_macros() with None -> [] | Some com -> [Define.get_signature com.defines])) in
 				List.fold_left (fun acc (file,cfile) ->
 					if (filter <> None || is_display_file file) then
-						(file,DocumentSymbols.collect_module_symbols (cfile.c_package,cfile.c_decls)) :: acc
+						(file,DocumentSymbols.collect_module_symbols (filter = None) (cfile.c_package,cfile.c_decls)) :: acc
 					else
 						acc
 				) symbols l

+ 4 - 4
src/context/display/documentSymbols.ml

@@ -2,7 +2,7 @@ open Ast
 
 open DisplayTypes.SymbolKind
 
-let collect_module_symbols (pack,decls) =
+let collect_module_symbols with_locals (pack,decls) =
 	let l = DynArray.create() in
 	let add name kind location parent =
 		let si = DisplayTypes.SymbolInformation.make name kind location (if parent = "" then None else Some parent) in
@@ -46,13 +46,13 @@ let collect_module_symbols (pack,decls) =
 		match cff.cff_kind with
 		| FVar(_,eo) ->
 			add (fst cff.cff_name) Field cff.cff_pos parent;
-			expr_opt field_parent eo
+			if with_locals then expr_opt field_parent eo
 		| FFun f ->
 			add (fst cff.cff_name) (if fst cff.cff_name = "new" then Constructor else Method) cff.cff_pos parent;
-			func field_parent f
+			if with_locals then func field_parent f
 		| FProp(_,_,_,eo) ->
 			add (fst cff.cff_name) Property cff.cff_pos parent;
-			expr_opt field_parent eo
+			if with_locals then expr_opt field_parent eo
 	in
 	List.iter (fun (td,p) -> match td with
 		| EImport _ | EUsing _ ->

+ 2 - 1
src/typing/typeloadParse.ml

@@ -41,8 +41,9 @@ let parse_file_from_lexbuf com file p lexbuf =
 			raise e
 	in
 	begin match !Parser.display_mode with
+		| DMModuleSymbols (Some "") -> ()
 		| DMModuleSymbols filter when filter <> None || Display.is_display_file file ->
-			let ds = DocumentSymbols.collect_module_symbols data in
+			let ds = DocumentSymbols.collect_module_symbols (filter = None) data in
 			com.shared.shared_display_information.document_symbols <- (file,ds) :: com.shared.shared_display_information.document_symbols;
 		| _ ->
 			()