|
26 | 26 | ---@field on_close_timeout number|nil
|
27 | 27 |
|
28 | 28 | ---@class vim_options_table: table<string, any>
|
| 29 | +---@field columns number Global option: width of the screen |
| 30 | +---@field lines number Global option: height of the screen |
| 31 | +-- Add other commonly used vim.o options as needed |
29 | 32 |
|
30 | 33 | ---@class vim_buffer_options_table: table<string, any>
|
31 | 34 |
|
32 | 35 | ---@class vim_bo_proxy: vim_buffer_options_table
|
33 |
| ----@operator #index(bufnr: number): vim_buffer_options_table Allows vim.bo[bufnr] |
| 36 | +---@field __index fun(self: vim_bo_proxy, bufnr: number): vim_buffer_options_table Allows vim.bo[bufnr] |
34 | 37 |
|
35 | 38 | ---@class vim_diagnostic_info
|
36 | 39 | ---@field bufnr number
|
|
47 | 50 | ---@field get fun(bufnr?: number, ns_id?: number): vim_diagnostic_info[]
|
48 | 51 | -- Add other vim.diagnostic functions as needed, e.g., get_namespace, set, etc.
|
49 | 52 |
|
| 53 | +---@class vim_fs_module |
| 54 | +---@field remove fun(path: string, opts?: {force?: boolean, recursive?: boolean}):boolean|nil |
| 55 | + |
| 56 | +---@class vim_fn_table |
| 57 | +---@field mode fun(mode_str?: string, full?: boolean|number):string |
| 58 | +---@field delete fun(name: string, flags?: string):integer For file deletion |
| 59 | +---@field filereadable fun(file: string):integer |
| 60 | +---@field fnamemodify fun(fname: string, mods: string):string |
| 61 | +---@field expand fun(str: string, ...):string|table |
| 62 | +---@field getcwd fun(winid?: number, tabnr?: number):string |
| 63 | +---@field mkdir fun(name: string, path?: string, prot?: number):integer |
| 64 | +---@field buflisted fun(bufnr: number|string):integer |
| 65 | +---@field bufname fun(expr?: number|string):string |
| 66 | +---@field bufnr fun(expr?: string|number, create?: boolean):number |
| 67 | +---@field win_getid fun(win?: number, tab?: number):number |
| 68 | +---@field win_gotoid fun(winid: number):boolean |
| 69 | +---@field line fun(expr: string, winid?: number):number |
| 70 | +---@field col fun(expr: string, winid?: number):number |
| 71 | +---@field virtcol fun(expr: string|string[], winid?: number):number|number[] |
| 72 | +---@field getpos fun(expr: string, winid?: number):number[] |
| 73 | +---@field setpos fun(expr: string, pos: number[], winid?: number):boolean |
| 74 | +---@field tempname fun():string |
| 75 | +---@field globpath fun(path: string, expr: string, ...):string |
| 76 | +---@field stdpath fun(type: "cache"|"config"|"data"|"log"|"run"|"state"|"config_dirs"|"data_dirs"):string|string[] |
| 77 | +---@field json_encode fun(expr: any):string |
| 78 | +---@field json_decode fun(string: string, opts?: {null_value?: any}):any |
| 79 | +---@field termopen fun(cmd: string|string[], opts?: table):number For vim.fn.termopen() |
| 80 | +-- Add other vim.fn functions as needed |
| 81 | + |
50 | 82 | ---@class vim_global_api
|
51 | 83 | ---@field notify fun(msg: string | string[], level?: number, opts?: vim_notify_opts):nil
|
52 | 84 | ---@field log vim_log
|
|
57 | 89 | ---@field diagnostic vim_diagnostic_module For vim.diagnostic.*
|
58 | 90 | ---@field empty_dict fun(): table For vim.empty_dict()
|
59 | 91 | ---@field schedule_wrap fun(fn: function): function For vim.schedule_wrap()
|
| 92 | +---@field deepcopy fun(val: any): any For vim.deepcopy() -- Added based on test mocks |
| 93 | +---@field _current_mode string? For mocks in tests |
| 94 | +---@class vim_api_table |
| 95 | +---@field nvim_create_augroup fun(name: string, opts: {clear: boolean}):integer |
| 96 | +---@field nvim_create_autocmd fun(event: string|string[], opts: {group?: string|integer, pattern?: string|string[], buffer?: number, callback?: function|string, once?: boolean, desc?: string}):integer |
| 97 | +---@field nvim_clear_autocmds fun(opts: {group?: string|integer, event?: string|string[], pattern?: string|string[], buffer?: number}):nil |
| 98 | +---@field nvim_get_current_buf fun():integer |
| 99 | +---@field nvim_get_mode fun():{mode: string, blocking: boolean} |
| 100 | +---@field nvim_win_get_cursor fun(window: integer):integer[] Returns [row, col] (1-based for row, 0-based for col) |
| 101 | +---@field nvim_buf_get_name fun(buffer: integer):string |
| 102 | +---@field nvim_buf_get_lines fun(buffer: integer, start: integer, end_line: integer, strict_indexing: boolean):string[] |
| 103 | +-- Add other nvim_api functions as needed |
| 104 | +---@field cmd fun(command: string):nil For vim.cmd() -- Added based on test mocks |
| 105 | +---@field api vim_api_table For vim.api.* |
| 106 | +---@field fn vim_fn_table For vim.fn.* |
| 107 | +---@field fs vim_fs_module For vim.fs.* |
| 108 | +---@field test vim_test_utils? For test utility mocks |
| 109 | +---@field split fun(str: string, pat?: string, opts?: {plain?: boolean, trimempty?: boolean}):string[] For vim.split() |
60 | 110 | -- Add other vim object definitions here if they cause linting issues
|
61 |
| --- e.g. vim.fn, vim.api, vim.loop, vim.deepcopy, etc. |
| 111 | +-- e.g. vim.api, vim.loop, vim.deepcopy, etc. |
62 | 112 |
|
63 | 113 | ---@class SpyCall
|
64 | 114 | ---@field vals table[] table of arguments passed to the call
|
|
83 | 133 | -- or on an object returned by `spy()`. Adjust as per your spy library's specifics.
|
84 | 134 | -- For busted's default spy, `calls` is often directly on the spied function.
|
85 | 135 |
|
| 136 | +---@class vim_test_utils |
| 137 | +---@field add_buffer fun(bufnr: number, filename: string, content: string|string[]):nil |
| 138 | +---@field set_cursor fun(bufnr: number, row: number, col: number):nil |
| 139 | +-- Add other test utility functions as needed |
| 140 | + |
86 | 141 | -- This section helps LuaLS understand that 'vim' is a global variable
|
87 | 142 | -- with the structure defined above. It's for type hinting only and
|
88 | 143 | -- does not execute or overwrite the actual 'vim' global provided by Neovim.
|
|
0 commit comments