@@ -24,37 +24,44 @@ defmodule ElixirLS.LanguageServer.Dialyzer.Manifest do
24
24
25
25
def write ( root_path , active_plt , mod_deps , md5 , warnings , timestamp ) do
26
26
Task . start_link ( fn ->
27
- manifest_path = manifest_path ( root_path )
28
-
29
- plt (
30
- info: info ,
31
- types: types ,
32
- contracts: contracts ,
33
- callbacks: callbacks ,
34
- exported_types: exported_types
35
- ) = active_plt
36
-
37
- manifest_data = {
38
- @ manifest_vsn ,
39
- mod_deps ,
40
- md5 ,
41
- warnings ,
42
- :ets . tab2list ( info ) ,
43
- :ets . tab2list ( types ) ,
44
- :ets . tab2list ( contracts ) ,
45
- :ets . tab2list ( callbacks ) ,
46
- :ets . tab2list ( exported_types )
47
- }
48
-
49
- # Because the manifest file can be several megabytes, we do a write-then-rename
50
- # to reduce the likelihood of corrupting the manifest
51
- JsonRpc . log_message ( :info , "[ElixirLS Dialyzer] Writing manifest..." )
52
- File . mkdir_p! ( Path . dirname ( manifest_path ) )
53
- tmp_manifest_path = manifest_path <> ".new"
54
- File . write! ( tmp_manifest_path , :erlang . term_to_binary ( manifest_data , compressed: 9 ) )
55
- File . rename ( tmp_manifest_path , manifest_path )
56
- File . touch! ( manifest_path , timestamp )
57
- JsonRpc . log_message ( :info , "[ElixirLS Dialyzer] Done writing manifest." )
27
+ { us , _ } =
28
+ :timer . tc ( fn ->
29
+ manifest_path = manifest_path ( root_path )
30
+
31
+ plt (
32
+ info: info ,
33
+ types: types ,
34
+ contracts: contracts ,
35
+ callbacks: callbacks ,
36
+ exported_types: exported_types
37
+ ) = active_plt
38
+
39
+ manifest_data = {
40
+ @ manifest_vsn ,
41
+ mod_deps ,
42
+ md5 ,
43
+ warnings ,
44
+ :ets . tab2list ( info ) ,
45
+ :ets . tab2list ( types ) ,
46
+ :ets . tab2list ( contracts ) ,
47
+ :ets . tab2list ( callbacks ) ,
48
+ :ets . tab2list ( exported_types )
49
+ }
50
+
51
+ # Because the manifest file can be several megabytes, we do a write-then-rename
52
+ # to reduce the likelihood of corrupting the manifest
53
+ JsonRpc . log_message ( :info , "[ElixirLS Dialyzer] Writing manifest..." )
54
+ File . mkdir_p! ( Path . dirname ( manifest_path ) )
55
+ tmp_manifest_path = manifest_path <> ".new"
56
+ File . write! ( tmp_manifest_path , :erlang . term_to_binary ( manifest_data , compressed: 1 ) )
57
+ File . rename ( tmp_manifest_path , manifest_path )
58
+ File . touch! ( manifest_path , timestamp )
59
+ end )
60
+
61
+ JsonRpc . log_message (
62
+ :info ,
63
+ "[ElixirLS Dialyzer] Done writing manifest in #{ div ( us , 1000 ) } milliseconds."
64
+ )
58
65
end )
59
66
end
60
67
0 commit comments