Skip to main content
Module

x/ddc_vim/deps.ts>fn.setqflist

Dark deno-powered completion framework for neovim/Vim
Latest
function fn.setqflist
import { fn } from "https://deno.land/x/ddc_vim@v4.3.1/deps.ts";
const { setqflist } = fn;

Create or replace or add to the quickfix list.

If the optional {what} dictionary argument is supplied, then only the items listed in {what} are set. The first {list} argument is ignored. See below for the supported items in {what}.

When {what} is not present, the items in {list} are used. Each item must be a dictionary. Non-dictionary items in {list} are ignored. Each dictionary item can contain the following entries:

bufnr       buffer number; must be the number of a valid
            buffer
filename    name of a file; only used when "bufnr" is not
            present or it is invalid.
module      name of a module; if given it will be used in
            quickfix error window instead of the filename.
lnum        line number in the file
end_lnum    end of lines, if the item spans multiple lines
pattern     search pattern used to locate the error
col         column number
vcol        when non-zero: "col" is visual column
            when zero: "col" is byte index
end_col     end column, if the item spans multiple columns
nr          error number
text        description of the error
type        single-character error type, 'E', 'W', etc.
valid       recognized error message

The "col", "vcol", "nr", "type" and "text" entries are optional. Either "lnum" or "pattern" entry can be used to locate a matching error line. If the "filename" and "bufnr" entries are not present or neither the "lnum" or "pattern" entries are present, then the item will not be handled as an error line. If both "pattern" and "lnum" are present then "pattern" will be used. If the "valid" entry is not supplied, then the valid flag is set when "bufnr" is a valid buffer or "filename" exists. If you supply an empty {list}, the quickfix list will be cleared. Note that the list is not exactly the same as what getqflist() returns.

{action} values: 'a' The items from {list} are added to the existing quickfix list. If there is no existing list, then a new list is created.

'r' The items from the current quickfix list are replaced with the items from {list}. This can also be used to clear the list:

        :call setqflist([], 'r')

'f' All the quickfix lists in the quickfix stack are freed.

If {action} is not present or is set to ' ', then a new list is created. The new quickfix list is added after the current quickfix list in the stack and all the following lists are freed. To add a new quickfix list at the end of the stack, set "nr" in {what} to "$".

The following items can be specified in dictionary {what}: context quickfix list context. See quickfix-context efm errorformat to use when parsing text from "lines". If this is not present, then the 'errorformat' option value is used. See quickfix-parse id quickfix list identifier quickfix-ID idx index of the current entry in the quickfix list specified by 'id' or 'nr'. If set to '$', then the last entry in the list is set as the current entry. See quickfix-index items list of quickfix entries. Same as the {list} argument. lines use 'errorformat' to parse a list of lines and add the resulting entries to the quickfix list {nr} or {id}. Only a List value is supported. See quickfix-parse nr list number in the quickfix stack; zero means the current quickfix list and "$" means the last quickfix list. quickfixtextfunc function to get the text to display in the quickfix window. The value can be the name of a function or a funcref or a lambda. Refer to quickfix-window-function for an explanation of how to write the function and an example. title quickfix list title text. See quickfix-title Unsupported keys in {what} are ignored. If the "nr" item is not present, then the current quickfix list is modified. When creating a new quickfix list, "nr" can be set to a value one greater than the quickfix stack size. When modifying a quickfix list, to guarantee that the correct list is modified, "id" should be used instead of "nr" to specify the list.

Examples (See also setqflist-examples):

:call setqflist([], 'r', {'title': 'My search'})
:call setqflist([], 'r', {'nr': 2, 'title': 'Errors'})
:call setqflist([], 'a', {'id':qfid, 'lines':["F1:10:L10"]})

Returns zero for success, -1 for failure.

This function can be used to create a quickfix list independent of the 'errorformat' setting. Use a command like :cc 1 to jump to the first position.

Can also be used as a method, the base is passed as the second argument:

GetErrorlist()->setqflist()

Parameters

denops: Denops
list: unknown
optional
action: unknown
optional
what: unknown

Returns

Promise<number>