@@ -105,10 +105,11 @@ local function location_handler(opts, cb, _, result, ctx, _)
105105 -- here to accurately determine `jump_to_single_result` (#980)
106106 result = vim .tbl_filter (function (x )
107107 local item = vim .lsp .util .locations_to_items ({ x }, encoding )[1 ]
108- table.insert ( items , item )
109- if opts .cwd_only and not path . is_relative_to ( item .filename , opts .cwd ) then
108+ if ( opts . cwd_only and not path . is_relative_to ( item . filename , opts . cwd )) or
109+ ( opts .regex_filter and not item .text : match ( opts .regex_filter ) ) then
110110 return false
111111 end
112+ table.insert (items , item )
112113 return true
113114 end , result )
114115 -- Jump immediately if there is only one location
@@ -575,7 +576,7 @@ local normalize_lsp_opts = function(opts, cfg, __resume_key)
575576 -- required for relative paths presentation
576577 if not opts .cwd or # opts .cwd == 0 then
577578 opts .cwd = uv .cwd ()
578- else
579+ elseif opts . cwd_only == nil then
579580 opts .cwd_only = true
580581 end
581582
@@ -592,6 +593,7 @@ local function fzf_lsp_locations(opts, fn_contents)
592593 core .__CTX = nil
593594 return
594595 end
596+ opts = core .set_header (opts , opts .headers or { " cwd" , " regex_filter" })
595597 return core .fzf_exec (opts .__contents , opts )
596598end
597599
@@ -669,6 +671,7 @@ M.finder = function(opts)
669671 core .__CTX = nil
670672 return
671673 end
674+ opts = core .set_header (opts , opts .headers or { " cwd" , " regex_filter" })
672675 opts = core .set_fzf_field_index (opts )
673676 return core .fzf_exec (contents , opts )
674677end
0 commit comments