chunk
variable_declaration
local "local"
assignment_statement
variable_list
identifier "uv"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "uv"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "t"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
' "'"
string_content "test.testutil"
' "'"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "busted"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
' "'"
string_content "busted"
' "'"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "Session"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
' "'"
string_content "test.client.session"
' "'"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "uv_stream"
= "="
expression_list
function_call
identifier "require"
arguments
( "("
string
' "'"
string_content "test.client.uv_stream"
' "'"
) ")"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "SocketStream"
= "="
expression_list
dot_index_expression
identifier "uv_stream"
. "."
identifier "SocketStream"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "ProcStream"
= "="
expression_list
dot_index_expression
identifier "uv_stream"
. "."
identifier "ProcStream"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "check_cores"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "check_cores"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "check_logs"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "check_logs"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "dedent"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "dedent"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "eq"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "eq"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "is_os"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "is_os"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "ok"
= "="
expression_list
dot_index_expression
identifier "t"
. "."
identifier "ok"
variable_declaration
local "local"
assignment_statement
variable_list
identifier "sleep"
= "="
expression_list
dot_index_expression
identifier "uv"
. "."
identifier "sleep"
comment
-- "--"
comment_content "- Functions executing in the current nvim session/process be"...
variable_declaration
local "local"
assignment_statement
variable_list
identifier "M"
= "="
expression_list
table_constructor
{ "{"
} "}"
variable_declaration (+39 nodes collapsed)
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "runtime_set"
= "="
expression_list
binary_expression
string
' "'"
string_content "set runtimepath^="
' "'"
.. ".."
identifier "lib_path"
assignment_statement (+38 nodes collapsed)
comment
-- "--"
comment_content " Default settings for the test session."
assignment_statement (+33 nodes collapsed)
assignment_statement (+122 nodes collapsed)
if_statement (+72 nodes collapsed)
comment
-- "--"
comment_content " Directory containing nvim."
assignment_statement (+29 nodes collapsed)
if_statement (+27 nodes collapsed)
variable_declaration
local "local"
variable_list
identifier "prepend_argv"
comment
-- "--"
comment_content "- @type string[]?"
if_statement (+209 nodes collapsed)
if_statement (+108 nodes collapsed)
variable_declaration
local "local"
variable_list
identifier "session"
comment
-- "--"
comment_content "- @type test.Session?"
variable_declaration
local "local"
variable_list
identifier "loop_running"
comment
-- "--"
comment_content "- @type boolean?"
variable_declaration
local "local"
variable_list
identifier "last_error"
comment
-- "--"
comment_content "- @type string?"
variable_declaration
local "local"
variable_list
identifier "method_error"
comment
-- "--"
comment_content "- @type string?"
if_statement (+67 nodes collapsed)
function_declaration
function "function"
dot_index_expression
identifier "M"
. "."
identifier "get_session"
parameters
( "("
) ")"
block
return_statement
return "return"
expression_list
identifier "session"
end "end"
function_declaration
function "function"
dot_index_expression
identifier "M"
. "."
identifier "set_session"
parameters
( "("
identifier "s"
) ")"
block
assignment_statement
variable_list
identifier "session"
= "="
expression_list
identifier "s"
end "end"
comment
-- "--"
comment_content "- @param method string"
comment
-- "--"
comment_content "- @param ... any"
comment
-- "--"
comment_content "- @return any"
function_declaration (+113 nodes collapsed)
comment
-- "--"
comment_content "- @param method string"
comment
-- "--"
comment_content "- @param ... any"
comment
-- "--"
comment_content "- @return any"
function_declaration (+33 nodes collapsed)
comment
-- "--"
comment_content "- @param timeout? integer"
comment
-- "--"
comment_content "- @return string?"
function_declaration (+33 nodes collapsed)
function_declaration (+145 nodes collapsed)
comment
-- "--"
comment_content " Expects a sequence of next_msg() results. If multiple seque"...
comment
-- "--"
comment_content " passed they are tried until one succeeds, in order of short"...
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " Can be called with positional args (list of sequences only)"...
comment
-- "--"
comment_content " expect_msg_seq(seq1, seq2, ...)"
comment
-- "--"
comment_content " or keyword args:"
comment
-- "--"
comment_content " expect_msg_seq{ignore={...}, seqs={seq1, seq2, ...}}"
comment
-- "--"
comment_content ""
comment
-- "--"
comment_content " ignore: List of ignored event names."
comment
-- "--"
comment_content " seqs: List of one or more potential event sequences."
function_declaration (+587 nodes collapsed)
function_declaration (+65 nodes collapsed)
function_declaration
function "function"
dot_index_expression
identifier "M"
. "."
identifier "set_method_error"
parameters
( "("
identifier "err"
) ")"
block
assignment_statement
variable_list
identifier "method_error"
= "="
expression_list
identifier "err"
end "end"
comment
-- "--"
comment_content "- Runs the event loop of the given session."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param lsession test.Session"
comment
-- "--"
comment_content "- @param request_cb function?"
comment
-- "--"
comment_content "- @param notification_cb function?"
comment
-- "--"
comment_content "- @param setup_cb function?"
comment
-- "--"
comment_content "- @param timeout integer"
comment
-- "--"
comment_content "- @return [integer, string]"
function_declaration (+213 nodes collapsed)
comment
-- "--"
comment_content "- Runs the event loop of the current global session."
function_declaration (+44 nodes collapsed)
function_declaration
function "function"
dot_index_expression
identifier "M"
. "."
identifier "stop"
parameters
( "("
) ")"
block
function_call
method_index_expression
function_call
identifier "assert"
arguments
( "("
identifier "session"
) ")"
: ":"
identifier "stop"
arguments
( "("
) ")"
end "end"
comment
-- "--"
comment_content " Use for commands which expect nvim to quit."
comment
-- "--"
comment_content " The first argument can also be a timeout."
function_declaration (+163 nodes collapsed)
comment
-- "--"
comment_content "- Executes a Vimscript function via Lua."
comment
-- "--"
comment_content "- Fails on Vimscript error, but does not update v:errmsg."
comment
-- "--"
comment_content "- @param name string"
comment
-- "--"
comment_content "- @param ... any"
comment
-- "--"
comment_content "- @return any"
function_declaration (+33 nodes collapsed)
comment
-- "--"
comment_content "- Sends user input to Nvim."
comment
-- "--"
comment_content "- Does not fail on Vimscript error, but v:errmsg will be upd"...
comment
-- "--"
comment_content "- @param input string"
function_declaration (+85 nodes collapsed)
comment
-- "--"
comment_content "- @param ... string"
function_declaration (+40 nodes collapsed)
comment
-- "--"
comment_content "-@param ... string[]?"
comment
-- "--"
comment_content "-@return string[]"
function_declaration (+119 nodes collapsed)
comment
-- "--"
comment_content "- Removes Nvim startup args from `args` matching items in `a"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- - Special case: \"-u\", \"-i\", \"--cmd\" are treated specially:"...
comment
-- "--"
comment_content "- - Special case: \"runtimepath\" will remove only { '--cmd', "...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- args={'--headless', '-u', 'NONE'}"
comment
-- "--"
comment_content "- args_rm={'--cmd', '-u'}"
comment
-- "--"
comment_content "- Result:"
comment
-- "--"
comment_content "- {'--headless'}"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- All matching cases are removed."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- args={'--cmd', 'foo', '-N', '--cmd', 'bar'}"
comment
-- "--"
comment_content "- args_rm={'--cmd', '-u'}"
comment
-- "--"
comment_content "- Result:"
comment
-- "--"
comment_content "- {'-N'}"
comment
-- "--"
comment_content "- @param args string[]"
comment
-- "--"
comment_content "- @param args_rm string[]"
comment
-- "--"
comment_content "- @return string[]"
function_declaration (+272 nodes collapsed)
function_declaration (+39 nodes collapsed)
comment
-- "--"
comment_content " Creates a new Session connected by domain socket (named pip"...
function_declaration (+85 nodes collapsed)
comment
-- "--"
comment_content "- Starts a new, global Nvim session and clears the current o"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Note:"
comment
-- "--"
comment_content "- - Use `new_session()` to start a session without replacing"...
comment
-- "--"
comment_content "- - Use `spawn_wait()` to start Nvim without connecting a RP"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Parameters are interpreted as startup args, OR a map with "...
comment
-- "--"
comment_content "- - args: List: Args appended to the default `nvim_arg"...
comment
-- "--"
comment_content "- - args_rm: List: Args removed from the default set. All"...
comment
-- "--"
comment_content "- removed, e.g. args_rm={'--cmd'} removes all "...
comment
-- "--"
comment_content "- (and its value) from the default set."
comment
-- "--"
comment_content "- - env: Map: Defines the environment of the new sess"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- clear('-e')"
comment
-- "--"
comment_content "- clear{args={'-e'}, args_rm={'-i'}, env={TERM=term}}"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param ... string Nvim CLI args"
comment
-- "--"
comment_content "- @return test.Session"
comment
-- "--"
comment_content "- @overload fun(opts: test.session.Opts): test.Session"
function_declaration (+42 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "n_processes"
= "="
expression_list
number "0"
comment
-- "--"
comment_content "- Starts a new Nvim process with the given args and returns "...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Does not replace the current global session, unlike `clear"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param keep boolean (default: false) Don't close the curre"...
comment
-- "--"
comment_content "- @param ... string Nvim CLI args"
comment
-- "--"
comment_content "- @return test.Session"
comment
-- "--"
comment_content "- @overload fun(keep: boolean, opts: test.session.Opts): tes"...
function_declaration (+272 nodes collapsed)
function_call (+166 nodes collapsed)
comment
-- "--"
comment_content "- Starts a (non-RPC, `--headless --listen \"Tx\"`) Nvim proces"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param ... string Nvim CLI args, or `test.session.Opts` ta"...
comment
-- "--"
comment_content "- @return test.ProcStream"
comment
-- "--"
comment_content "- @overload fun(opts: test.session.Opts): test.ProcStream"
function_declaration (+164 nodes collapsed)
comment
-- "--"
comment_content "- @class test.session.Opts"
comment
-- "--"
comment_content "- Nvim CLI args"
comment
-- "--"
comment_content "- @field args? string[]"
comment
-- "--"
comment_content "- Remove these args from the default `nvim_argv` args set. I"...
comment
-- "--"
comment_content "- @field args_rm? string[]"
comment
-- "--"
comment_content "- (default: true) Merge `args` with the default set. Else us"...
comment
-- "--"
comment_content "- @field merge? boolean"
comment
-- "--"
comment_content "- Environment variables"
comment
-- "--"
comment_content "- @field env? table<string,string>"
comment
-- "--"
comment_content "- Used for stdin_fd, see `:help ui-option`"
comment
-- "--"
comment_content "- @field io_extra? uv.uv_pipe_t"
comment
-- "--"
comment_content "- @private"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Builds an argument list for use in `new_session()`, `clear"...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param ... string Nvim CLI args, or `test.session.Opts` ta"...
comment
-- "--"
comment_content "- @return string[]"
comment
-- "--"
comment_content "- @return string[]?"
comment
-- "--"
comment_content "- @return uv.uv_pipe_t?"
comment
-- "--"
comment_content "- @overload fun(opts: test.session.Opts): string[], string[]"...
function_declaration (+555 nodes collapsed)
comment
-- "--"
comment_content "- Dedents string arguments and inserts the resulting text in"...
comment
-- "--"
comment_content "- @param ... string"
function_declaration (+87 nodes collapsed)
comment
-- "--"
comment_content "- @deprecated Use `command()` or `feed()` instead."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Executes an ex-command by user input. Because nvim_input()"...
comment
-- "--"
comment_content "- errors will not manifest as client (lua) errors. Use comma"...
comment
-- "--"
comment_content "- @param ... string"
function_declaration (+99 nodes collapsed)
comment
-- "--"
comment_content " @deprecated use nvim_exec2()"
function_declaration (+26 nodes collapsed)
function_declaration (+29 nodes collapsed)
comment
-- "--"
comment_content "- Sets Nvim shell to powershell."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param fake boolean? Use a fake if powershell is not found"...
comment
-- "--"
comment_content "- @returns true if powershell was found on the system, else "...
function_declaration (+188 nodes collapsed)
comment
-- "--"
comment_content "-@param func function"
comment
-- "--"
comment_content "-@return table<string,function>"
function_declaration (+90 nodes collapsed)
comment
-- "--"
comment_content "- @param method string"
comment
-- "--"
comment_content "- @param ... any"
function_declaration (+52 nodes collapsed)
comment
-- "--"
comment_content "- Executes a Vimscript function via RPC."
comment
-- "--"
comment_content "- Fails on Vimscript error, but does not update v:errmsg."
comment
-- "--"
comment_content "- @param name string"
comment
-- "--"
comment_content "- @param ... any"
comment
-- "--"
comment_content "- @return any"
function_declaration (+37 nodes collapsed)
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "async_meths"
= "="
expression_list
function_call
dot_index_expression
identifier "M"
. "."
identifier "create_callindex"
arguments
( "("
dot_index_expression
identifier "M"
. "."
identifier "nvim_async"
) ")"
assignment_statement (+43 nodes collapsed)
assignment_statement (+43 nodes collapsed)
assignment_statement (+105 nodes collapsed)
comment
-- "--"
comment_content "- add for typing. The for loop after will overwrite this"
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "api"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "api"
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "fn"
= "="
expression_list
dot_index_expression
identifier "vim"
. "."
identifier "fn"
for_statement (+34 nodes collapsed)
comment
-- "--"
comment_content " Executes an ex-command. Vimscript errors manifest as client"...
comment
-- "--"
comment_content " v:errmsg will not be updated."
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "command"
= "="
expression_list
dot_index_expression
dot_index_expression
identifier "M"
. "."
identifier "api"
. "."
identifier "nvim_command"
comment
-- "--"
comment_content " Evaluates a Vimscript expression."
comment
-- "--"
comment_content " Fails on Vimscript error, but does not update v:errmsg."
assignment_statement
variable_list
dot_index_expression
identifier "M"
. "."
identifier "eval"
= "="
expression_list
dot_index_expression
dot_index_expression
identifier "M"
. "."
identifier "api"
. "."
identifier "nvim_eval"
function_declaration (+32 nodes collapsed)
function_declaration (+29 nodes collapsed)
comment
-- "--"
comment_content "-@see buf_lines()"
function_declaration (+59 nodes collapsed)
function_declaration (+35 nodes collapsed)
function_declaration (+56 nodes collapsed)
comment
-- "--"
comment_content " Checks that the Nvim session did not terminate."
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content " Asserts that buffer is loaded and visible in the current ta"...
function_declaration (+129 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "start_dir"
= "="
expression_list
function_call
dot_index_expression
identifier "uv"
. "."
identifier "cwd"
arguments
( "("
) ")"
function_declaration (+176 nodes collapsed)
comment
-- "--"
comment_content "- @deprecated Use `t.pcall_err()` to check failure, or `n.co"...
function_declaration (+106 nodes collapsed)
function_declaration (+28 nodes collapsed)
comment
-- "--"
comment_content "- @param code string"
comment
-- "--"
comment_content "- @return string"
function_declaration (+38 nodes collapsed)
comment
-- "--"
comment_content "- Execute Lua code in the wrapped Nvim session."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- When `code` is passed as a function, it is converted into "...
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Direct upvalues are copied over, however upvalues containe"...
comment
-- "--"
comment_content "- within nested functions are not. Upvalues are also copied "...
comment
-- "--"
comment_content "- finishes executing. See `:help lua-upvalue`."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Only types which can be serialized can be transferred over"...
comment
-- "--"
comment_content "- `table`, `number`, `boolean`, `string`."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- `code` runs with a different environment and thus will hav"...
comment
-- "--"
comment_content "- environment. See `:help lua-environments`."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Example:"
comment
-- "--"
comment_content "- ```lua"
comment
-- "--"
comment_content "- local upvalue1 = 'upvalue1'"
comment
-- "--"
comment_content "- exec_lua(function(a, b, c)"
comment
-- "--"
comment_content "- print(upvalue1, a, b, c)"
comment
-- "--"
comment_content "- (function()"
comment
-- "--"
comment_content "- print(upvalue2)"
comment
-- "--"
comment_content "- end)()"
comment
-- "--"
comment_content "- end, 'a', 'b', 'c'"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- Prints:"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- upvalue1 a b c"
comment
-- "--"
comment_content "- nil"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- Not supported:"
comment
-- "--"
comment_content "- ```lua"
comment
-- "--"
comment_content "- local a = vim.uv.new_timer()"
comment
-- "--"
comment_content "- exec_lua(function()"
comment
-- "--"
comment_content "- print(a) -- Error: a is of type 'userdata' which cannot "...
comment
-- "--"
comment_content "- end)"
comment
-- "--"
comment_content "- ```"
comment
-- "--"
comment_content "- @param code string|function"
comment
-- "--"
comment_content "- @param ... any"
comment
-- "--"
comment_content "- @return any"
function_declaration (+86 nodes collapsed)
function_declaration (+36 nodes collapsed)
comment
-- "--"
comment_content "- Gets the filesystem root dir, namely \"/\" or \"C:/\"."
function_declaration (+72 nodes collapsed)
comment
-- "--"
comment_content "- Gets the full `…/build/bin/{name}` path of a test program "...
comment
-- "--"
comment_content "- `test/functional/fixtures/CMakeLists.txt`."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param name (string) Name of the test program."
function_declaration (+64 nodes collapsed)
comment
-- "--"
comment_content "- Returns a valid, platform-independent Nvim listen address."
comment
-- "--"
comment_content "- Useful for communicating with child instances."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @return string"
function_declaration (+64 nodes collapsed)
comment
-- "--"
comment_content "- @param provider string"
comment
-- "--"
comment_content "- @return string|boolean?"
function_declaration (+182 nodes collapsed)
variable_declaration
local "local"
assignment_statement
variable_list
identifier "load_factor"
= "="
expression_list
number "1"
if_statement (+63 nodes collapsed)
comment
-- "--"
comment_content "- @param num number"
comment
-- "--"
comment_content "- @return number"
function_declaration (+27 nodes collapsed)
comment
-- "--"
comment_content "- @param ctx table<string,any>"
comment
-- "--"
comment_content "- @return table"
function_declaration (+197 nodes collapsed)
function_declaration (+42 nodes collapsed)
comment
-- "--"
comment_content "- Create folder with non existing parents"
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- TODO(justinmk): lift this and `t.mkdir()` into vim.fs."
comment
-- "--"
comment_content "-"
comment
-- "--"
comment_content "- @param path string"
comment
-- "--"
comment_content "- @return boolean?"
function_declaration (+72 nodes collapsed)
variable_declaration (+52 nodes collapsed)
return_statement (+259 nodes collapsed)