fix(entry_to_qf): handle nil entry.cwd and absolute filenames (#1058)

This commit is contained in:
bi0ha2ard
2021-08-04 08:56:15 +02:00
committed by GitHub
parent f8caad1d6b
commit b7cd8c7699
2 changed files with 31 additions and 3 deletions

View File

@@ -367,6 +367,8 @@ builtin.find_files({opts}) *builtin.find_files()*
flag for the `find` command)
{hidden} (boolean) determines whether to show hidden files or
not (default is false)
{no_ignore} (boolean) show files ignored by .gitignore, .ignore,
etc. (default is false)
{search_dirs} (table) directory/directories to search in
@@ -468,6 +470,9 @@ builtin.git_commits({opts}) *builtin.git_commits()*
Lists commits for current directory with diff preview
- Default keymaps:
- `<cr>`: checks out the currently selected commit
- `<C-r>m`: resets current branch to selected commit using mixed mode
- `<C-r>s`: resets current branch to selected commit using soft mode
- `<C-r>h`: resets current branch to selected commit using hard mode
Parameters: ~
@@ -1365,6 +1370,30 @@ actions.git_rebase_branch({prompt_bufnr}) *actions.git_rebase_branch()*
{prompt_bufnr} (number) The prompt bufnr
actions.git_reset_mixed({prompt_bufnr}) *actions.git_reset_mixed()*
Reset to selected git commit using mixed mode
Parameters: ~
{prompt_bufnr} (number) The prompt bufnr
actions.git_reset_soft({prompt_bufnr}) *actions.git_reset_soft()*
Reset to selected git commit using soft mode
Parameters: ~
{prompt_bufnr} (number) The prompt bufnr
actions.git_reset_hard({prompt_bufnr}) *actions.git_reset_hard()*
Reset to selected git commit using hard mode
Parameters: ~
{prompt_bufnr} (number) The prompt bufnr
actions.git_staging_toggle({prompt_bufnr}) *actions.git_staging_toggle()*
Stage/unstage selected file

View File

@@ -17,11 +17,10 @@ local p_scroller = require "telescope.pickers.scroller"
local action_state = require "telescope.actions.state"
local action_utils = require "telescope.actions.utils"
local action_set = require "telescope.actions.set"
local from_entry = require "telescope.from_entry"
local transform_mod = require("telescope.actions.mt").transform_mod
local Path = require "plenary.path"
local actions = setmetatable({}, {
__index = function(_, k)
-- TODO(conni2461): Remove deprecated messages
@@ -585,7 +584,7 @@ end
local entry_to_qf = function(entry)
return {
bufnr = entry.bufnr,
filename = Path:new(entry.cwd, entry.filename):absolute(),
filename = from_entry.path(entry, false),
lnum = entry.lnum,
col = entry.col,
text = entry.text or entry.value.text or entry.value,