A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/838631e29ef3051d6117b3d5c340d2be9f1f29b4 below:

improve validation for list arguments (#16855) · neovim/neovim@838631e · GitHub

@@ -644,7 +644,11 @@ function M.set(namespace, bufnr, diagnostics, opts)

644 644

vim.validate {

645 645

namespace = {namespace, 'n'},

646 646

bufnr = {bufnr, 'n'},

647 -

diagnostics = {diagnostics, 't'},

647 +

diagnostics = {

648 +

diagnostics,

649 +

vim.tbl_islist,

650 +

"a list of diagnostics",

651 +

},

648 652

opts = {opts, 't', true},

649 653

}

650 654

@@ -810,7 +814,11 @@ M.handlers.signs = {

810 814

vim.validate {

811 815

namespace = {namespace, 'n'},

812 816

bufnr = {bufnr, 'n'},

813 -

diagnostics = {diagnostics, 't'},

817 +

diagnostics = {

818 +

diagnostics,

819 +

vim.tbl_islist,

820 +

"a list of diagnostics",

821 +

},

814 822

opts = {opts, 't', true},

815 823

}

816 824

@@ -873,7 +881,11 @@ M.handlers.underline = {

873 881

vim.validate {

874 882

namespace = {namespace, 'n'},

875 883

bufnr = {bufnr, 'n'},

876 -

diagnostics = {diagnostics, 't'},

884 +

diagnostics = {

885 +

diagnostics,

886 +

vim.tbl_islist,

887 +

"a list of diagnostics",

888 +

},

877 889

opts = {opts, 't', true},

878 890

}

879 891

@@ -921,7 +933,11 @@ M.handlers.virtual_text = {

921 933

vim.validate {

922 934

namespace = {namespace, 'n'},

923 935

bufnr = {bufnr, 'n'},

924 -

diagnostics = {diagnostics, 't'},

936 +

diagnostics = {

937 +

diagnostics,

938 +

vim.tbl_islist,

939 +

"a list of diagnostics",

940 +

},

925 941

opts = {opts, 't', true},

926 942

}

927 943

@@ -1081,7 +1097,11 @@ function M.show(namespace, bufnr, diagnostics, opts)

1081 1097

vim.validate {

1082 1098

namespace = { namespace, 'n', true },

1083 1099

bufnr = { bufnr, 'n', true },

1084 -

diagnostics = { diagnostics, 't', true },

1100 +

diagnostics = {

1101 +

diagnostics,

1102 +

function(v) return v == nil or vim.tbl_islist(v) end,

1103 +

"a list of diagnostics",

1104 +

},

1085 1105

opts = { opts, 't', true },

1086 1106

}

1087 1107

@@ -1526,7 +1546,13 @@ local errlist_type_map = {

1526 1546

---@param diagnostics table List of diagnostics |diagnostic-structure|.

1527 1547

---@return array of quickfix list items |setqflist-what|

1528 1548

function M.toqflist(diagnostics)

1529 -

vim.validate { diagnostics = {diagnostics, 't'} }

1549 +

vim.validate {

1550 +

diagnostics = {

1551 +

diagnostics,

1552 +

vim.tbl_islist,

1553 +

"a list of diagnostics",

1554 +

},

1555 +

}

1530 1556 1531 1557

local list = {}

1532 1558

for _, v in ipairs(diagnostics) do

@@ -1557,7 +1583,13 @@ end

1557 1583

--- |getloclist()|.

1558 1584

---@return array of diagnostics |diagnostic-structure|

1559 1585

function M.fromqflist(list)

1560 -

vim.validate { list = {list, 't'} }

1586 +

vim.validate {

1587 +

list = {

1588 +

list,

1589 +

vim.tbl_islist,

1590 +

"a list of quickfix items",

1591 +

},

1592 +

}

1561 1593 1562 1594

local diagnostics = {}

1563 1595

for _, item in ipairs(list) do


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4