From acbbee42afe1a96b6759ae6b816c042b310c2434 Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Sat, 21 Dec 2024 21:46:37 +0200 Subject: [PATCH] refactor: add comment (#72) --- lua/blink-ripgrep/ripgrep_parser.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lua/blink-ripgrep/ripgrep_parser.lua b/lua/blink-ripgrep/ripgrep_parser.lua index 69088f6..e8cfe51 100644 --- a/lua/blink-ripgrep/ripgrep_parser.lua +++ b/lua/blink-ripgrep/ripgrep_parser.lua @@ -29,6 +29,11 @@ local function get_file_context(json, output) return file, line_number end +-- When ripgrep is run with the `--json` flag, it outputs a stream of jsonl +-- (json lines) objects. They show what matched the search as well as lines +-- surrounding each match. +-- This function converts the jsonl stream into a table. +-- ---@param ripgrep_output string[] ripgrep output in jsonl format ---@param cwd string the current working directory ---@param context_size number the number of lines of context to include in the output