|
462 | 462 | ---@param opts { search: obsidian.SearchOpts|?, notes: obsidian.note.LoadOpts|? }|?
|
463 | 463 | Client.find_notes_async = function(self, term, callback, opts)
|
464 | 464 | opts = opts or {}
|
| 465 | + opts.notes = opts.notes or {} |
| 466 | + if not opts.notes.max_lines then |
| 467 | + opts.notes.max_lines = self.opts.search_max_lines |
| 468 | + end |
465 | 469 |
|
466 | 470 | local next_path = self:_search_iter_async(term, opts.search)
|
467 | 471 | local executor = AsyncExecutor.new()
|
|
606 | 610 | ---@return obsidian.Note|?
|
607 | 611 | Client.resolve_note_async = function(self, query, callback, opts)
|
608 | 612 | opts = opts or {}
|
| 613 | + opts.notes = opts.notes or {} |
| 614 | + if not opts.notes.max_lines then |
| 615 | + opts.notes.max_lines = self.opts.search_max_lines |
| 616 | + end |
609 | 617 |
|
610 | 618 | -- Autocompletion for command args will have this format.
|
611 | 619 | local note_path, count = string.gsub(query, "^.* ", "")
|
@@ -803,6 +811,7 @@ Client.resolve_link_async = function(self, link, callback)
|
803 | 811 | local load_opts = {
|
804 | 812 | collect_anchor_links = anchor_link and true or false,
|
805 | 813 | collect_blocks = block_link and true or false,
|
| 814 | + max_lines = self.opts.search_max_lines, |
806 | 815 | }
|
807 | 816 |
|
808 | 817 | -- Assume 'location' is current buffer path if empty, like for TOCs.
|
@@ -986,6 +995,10 @@ Client.current_note = function(self, bufnr, opts)
|
986 | 995 | return nil
|
987 | 996 | end
|
988 | 997 |
|
| 998 | + opts = opts or {} |
| 999 | + if not opts.max_lines then |
| 1000 | + opts.max_lines = self.opts.search_max_lines |
| 1001 | + end |
989 | 1002 | return Note.from_buffer(bufnr, opts)
|
990 | 1003 | end
|
991 | 1004 |
|
@@ -1086,7 +1099,7 @@ Client.find_tags_async = function(self, term, callback, opts)
|
1086 | 1099 | ---@param path obsidian.Path
|
1087 | 1100 | ---@return { [1]: obsidian.Note, [2]: {[1]: integer, [2]: integer}[] }
|
1088 | 1101 | local load_note = function(path)
|
1089 |
| - local note, contents = Note.from_file_with_contents_async(path, { max_lines = self.opts.search_max_lines or 1000 }) |
| 1102 | + local note, contents = Note.from_file_with_contents_async(path, { max_lines = self.opts.search_max_lines }) |
1090 | 1103 | return { note, search.find_code_blocks(contents) }
|
1091 | 1104 | end
|
1092 | 1105 |
|
@@ -1347,7 +1360,11 @@ Client.find_backlinks_async = function(self, note, callback, opts)
|
1347 | 1360 | end
|
1348 | 1361 |
|
1349 | 1362 | ---@type obsidian.note.LoadOpts
|
1350 |
| - local load_opts = { collect_anchor_links = opts.anchor ~= nil, collect_blocks = opts.block ~= nil } |
| 1363 | + local load_opts = { |
| 1364 | + collect_anchor_links = opts.anchor ~= nil, |
| 1365 | + collect_blocks = opts.block ~= nil, |
| 1366 | + max_lines = self.opts.search_max_lines, |
| 1367 | + } |
1351 | 1368 |
|
1352 | 1369 | ---@param match MatchData
|
1353 | 1370 | local function on_match(match)
|
|
0 commit comments