4 ms·
Is there a way to output the results in Visual Studio format, which is <filename>(<line number>)<result>? This way when I hook up ripgrep as an External Tool, t
by xrouge 8y ago
Is there a way to output the results in Visual Studio format, which is <filename>(<line number>)<result>? This way when I hook up ripgrep as an External Tool, the line shown in the Output window can be clicked on to open the file and go to the specific line. I see in the source code that the separator is ":"; VS expects () around the line number.
- burntsushi 8y agoNot natively, no. You could probably write a simple script that transforms the output into what you want though. For example, on Unix at least, rg -n pattern | sed 's/:/(/' | sed 's/:/)/' That won't work in every case (e.g., in the case of a file path containining a `:`), but it might get you pretty far. And it could probably be made more precise. Otherwise, you could always use ripgrep's --json output mode to craft its output into whatever format you like, but that's probably more work. :-) The JSON format is documented here: https://docs.rs/grep-printer/0.1.2/grep_printer/struct.JSON.html https://docs.rs/grep-printer/0.1.2/grep_printer/struct.JSON....