Hi, I’m trying to configure some things using null-ls (or well none-ls). When providing extra arguments to a command you can use a function that gets as input “params” as the docs call it, which is structured like this (according to the null-ls docs):
local params = {
client_id, -- null-ls client id (number)
lsp_method, -- LSP method that triggered request / notification (string)
lsp_params, -- original LSP params from request / notification (table)
options, -- options from LSP params (e.g. formattingOptions) (table|nil)
content, -- current buffer content (string[])
bufnr, -- current buffer's number (number)
method, -- null-ls method (string)
row, -- cursor's current row (number, zero-indexed)
col, -- cursor's current column (number)
bufname, -- full path to current buffer (string)
filetype, -- current buffer's filetype (string)
root, -- current buffer's root directory (string)
-- method == null_ls.methods.RANGE_FORMATTING
range, -- converted LSP range (table)
-- method == null_ls.methods.COMPLETION
word_to_complete, -- keyword under cursor (string)
}
So far this all makes sense, but this table has some keys (mainly lsp_params and options) which are tables themselves and are from “LSP params”. I’d like to work with this, but I don’t know how those tables are structured, I tried simply printing out the entire table in neovim, but for some reason that doesn’t seem to work, I tried the following:
none_ls.builtins.formatting.prettierd.with({
extra_args = function(params)
vim.pretty_print(params)
return {
"--tab-width",
"4",
}
end,
}),
Anyhow, I assume the LSP params table has to be defined somewhere, but I can’t seem to find it. Does anyone know, or maybe even better yet, does anyone know how I can simply print the entire table in nvim?
Thank you in advance!