@@ -85,48 +85,71 @@ Options:
85
85
|}
86
86
87
87
let main () =
88
- match Array. to_list Sys. argv with
88
+ let args = Array. to_list Sys. argv in
89
+ let debugLevel, args =
90
+ match args with
91
+ | _ :: "debug-dump" :: logLevel :: rest ->
92
+ ( (match logLevel with
93
+ | "verbose" -> Debug. Verbose
94
+ | "regular" -> Regular
95
+ | _ -> Off ),
96
+ " dummy" :: rest )
97
+ | args -> (Off , args)
98
+ in
99
+ Debug. debugLevel := debugLevel;
100
+ let debug = debugLevel <> Debug. Off in
101
+ let printHeaderInfo path line col =
102
+ if debug then
103
+ Printf. printf " Debug level: %s\n %s:%s-%s\n\n "
104
+ (match debugLevel with
105
+ | Debug. Verbose -> " verbose"
106
+ | Regular -> " regular"
107
+ | Off -> " off" )
108
+ path line col
109
+ in
110
+ match args with
89
111
| [_; " completion" ; path; line; col; currentFile; supportsSnippets] ->
112
+ printHeaderInfo path line col;
90
113
(Cfg. supportsSnippets :=
91
114
match supportsSnippets with
92
115
| "true" -> true
93
116
| _ -> false );
94
- Commands. completion ~debug: false ~path
117
+ Commands. completion ~debug ~path
95
118
~pos: (int_of_string line, int_of_string col)
96
119
~current File
97
120
| [_; " definition" ; path; line; col] ->
98
121
Commands. definition ~path
99
122
~pos: (int_of_string line, int_of_string col)
100
- ~debug: false
123
+ ~debug
101
124
| [_; " typeDefinition" ; path; line; col] ->
102
125
Commands. typeDefinition ~path
103
126
~pos: (int_of_string line, int_of_string col)
104
- ~debug: false
127
+ ~debug
105
128
| [_; " documentSymbol" ; path] -> DocumentSymbol. command ~path
106
129
| [_; " hover" ; path; line; col; currentFile; supportsMarkdownLinks] ->
107
130
Commands. hover ~path
108
131
~pos: (int_of_string line, int_of_string col)
109
- ~current File ~debug: false
132
+ ~current File ~debug
110
133
~supports MarkdownLinks:
111
134
(match supportsMarkdownLinks with
112
135
| "true" -> true
113
136
| _ -> false )
114
137
| [_; " signatureHelp" ; path; line; col; currentFile] ->
115
138
Commands. signatureHelp ~path
116
139
~pos: (int_of_string line, int_of_string col)
117
- ~current File ~debug: false
140
+ ~current File ~debug
118
141
| [_; " inlayHint" ; path; line_start; line_end; maxLength] ->
119
142
Commands. inlayhint ~path
120
143
~pos: (int_of_string line_start, int_of_string line_end)
121
- ~max Length ~debug: false
122
- | [_; " codeLens" ; path] -> Commands. codeLens ~path ~debug: false
123
- | [_; " extractDocs" ; path] -> DocExtraction. extractDocs ~path ~debug: false
144
+ ~max Length ~debug
145
+ | [_; " codeLens" ; path] -> Commands. codeLens ~path ~debug
146
+ | [_; " extractDocs" ; path] -> DocExtraction. extractDocs ~path ~debug
124
147
| [_; " codeAction" ; path; startLine; startCol; endLine; endCol; currentFile]
125
148
->
126
149
Commands. codeAction ~path
127
150
~start Pos:(int_of_string startLine, int_of_string startCol)
128
151
~end Pos:(int_of_string endLine, int_of_string endCol)
129
- ~current File ~debug: false
152
+ ~current File ~debug
130
153
| [_; " codemod" ; path; line; col; typ; hint] ->
131
154
let typ =
132
155
match typ with
@@ -136,7 +159,7 @@ let main () =
136
159
let res =
137
160
Codemod. transform ~path
138
161
~pos: (int_of_string line, int_of_string col)
139
- ~debug: false ~typ ~hint
162
+ ~debug ~typ ~hint
140
163
|> Json. escape
141
164
in
142
165
Printf. printf " \" %s\" " res
@@ -151,11 +174,11 @@ let main () =
151
174
| [_; " references" ; path; line; col] ->
152
175
Commands. references ~path
153
176
~pos: (int_of_string line, int_of_string col)
154
- ~debug: false
177
+ ~debug
155
178
| [_; " rename" ; path; line; col; newName] ->
156
179
Commands. rename ~path
157
180
~pos: (int_of_string line, int_of_string col)
158
- ~new Name ~debug: false
181
+ ~new Name ~debug
159
182
| [_; " semanticTokens" ; currentFile] ->
160
183
SemanticTokens. semanticTokens ~current File
161
184
| [_; " createInterface" ; path; cmiFile] ->
0 commit comments