docs: handle whitespace in emmycomments

This commit is contained in:
Lewis Russell 2023-07-16 09:34:50 +01:00
parent a54f88ea64
commit 3fd504dbec
4 changed files with 100 additions and 90 deletions

View File

@ -1189,8 +1189,8 @@ format({options}) *vim.lsp.buf.format()*
server clients.
Parameters: ~
• {options} table|nil Optional table which holds the following optional
fields:
• {options} (table|nil) Optional table which holds the following
optional fields:
• formatting_options (table|nil): Can be used to specify
FormattingOptions. Some unspecified options will be
automatically derived from the current Nvim options. See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#formattingOptions

View File

@ -1423,15 +1423,16 @@ keycode({str}) *vim.keycode()*
Translate keycodes.
Example: >lua
local k = vim.keycode
vim.g.mapleader = k'<bs>'
<
Parameters: ~
• {str} string String to be converted.
• {str} (string) String to be converted.
Return: ~
string
(string)
See also: ~
• |nvim_replace_termcodes()|
@ -1527,6 +1528,7 @@ print({...}) *vim.print()*
"Pretty prints" the given arguments and returns them unmodified.
Example: >lua
local hl_normal = vim.print(vim.api.nvim_get_hl_by_name('Normal', true))
<
@ -1775,8 +1777,8 @@ gsplit({s}, {sep}, {opts}) *vim.gsplit()*
<
Parameters: ~
• {s} string String to split
• {sep} string Separator or pattern
• {s} (string) String to split
• {sep} (string) Separator or pattern
• {opts} (table|nil) Keyword arguments |kwargs|:
• plain: (boolean) Use `sep` literally (as in string.find).
• trimempty: (boolean) Discard empty segments at start and end
@ -2501,6 +2503,7 @@ get_option({filetype}, {option}) *vim.filetype.get_option()*
files.
Example: >lua
vim.filetype.get_option('vim', 'commentstring')
<
@ -2509,8 +2512,8 @@ get_option({filetype}, {option}) *vim.filetype.get_option()*
may not reflect later changes.
Parameters: ~
• {filetype} string Filetype
• {option} string Option name
• {filetype} (string) Filetype
• {option} (string) Option name
Return: ~
string|boolean|integer: Option value
@ -2649,7 +2652,7 @@ dir({path}, {opts}) *vim.fs.dir()*
• {path} (string) An absolute or relative path to the directory to
iterate over. The path is first normalized
|vim.fs.normalize()|.
• {opts} table|nil Optional keyword arguments:
• {opts} (table|nil) Optional keyword arguments:
• depth: integer|nil How deep the traverse (default 1)
• skip: (fun(dir_name: string): boolean)|nil Predicate to
control traversal. Return false to stop searching the
@ -3010,7 +3013,7 @@ range({spec}) *vim.version.range()*
<
Parameters: ~
• {spec} string Version range "spec"
• {spec} (string) Version range "spec"
See also: ~
• # https://github.com/npm/node-semver#ranges

View File

@ -793,17 +793,17 @@ get_filetypes({lang}) *vim.treesitter.language.get_filetypes()*
Get the filetypes associated with the parser named {lang}.
Parameters: ~
• {lang} string Name of parser
• {lang} (string) Name of parser
Return: ~
string[] filetypes
get_lang({filetype}) *vim.treesitter.language.get_lang()*
Parameters: ~
• {filetype} string
• {filetype} (string)
Return: ~
string|nil
(string|nil)
inspect({lang}) *vim.treesitter.language.inspect()*
Inspects the provided language.
@ -821,7 +821,7 @@ register({lang}, {filetype}) *vim.treesitter.language.register()*
Register a parser named {lang} to be used for {filetype}(s).
Parameters: ~
• {lang} string Name of parser
• {lang} (string) Name of parser
• {filetype} string|string[] Filetype(s) to associate with lang
@ -1051,7 +1051,9 @@ contents.
To create a LanguageTree (parser object) for a given buffer and language, use:
>lua
local parser = vim.treesitter.get_parser(bufnr, lang)
<
(where `bufnr=0` means current buffer). `lang` defaults to 'filetype'.
@ -1062,7 +1064,9 @@ it wants incremental updates.
Whenever you need to access the current syntax tree, parse the buffer:
>lua
local tree = parser:parse()
<
This returns a table of immutable |treesitter-tree| objects representing
@ -1178,19 +1182,20 @@ LanguageTree:register_cbs({cbs}, {recursive})
• {cbs} (table) An |nvim_buf_attach()|-like table argument with
the following handlers:
• `on_bytes` : see |nvim_buf_attach()|, but this will be called after the parsers callback.
• `on_changedtree` : a callback that will be called
every time the tree has syntactical changes. It will
be passed two arguments: a table of the ranges (as
node ranges) that changed and the changed tree.
• `on_child_added` : emitted when a child is added to
the tree.
• `on_changedtree` : a callback that will be called every
time the tree has syntactical changes. It will be
passed two arguments: a table of the ranges (as node
ranges) that changed and the changed tree.
• `on_child_added` : emitted when a child is added to the
tree.
• `on_child_removed` : emitted when a child is removed
from the tree.
• `on_detach` : emitted when the buffer is detached, see
|nvim_buf_detach_event|. Takes one argument, the
number of the buffer.
• {recursive?} boolean Apply callbacks recursively for all children.
Any new children will also inherit the callbacks.
|nvim_buf_detach_event|. Takes one argument, the number
of the buffer.
• {recursive} (boolean|nil) Apply callbacks recursively for all
children. Any new children will also inherit the
callbacks.
LanguageTree:source() *LanguageTree:source()*
Returns the source content of the language tree (bufnr or string).

View File

@ -328,6 +328,7 @@ function TLua2DoX_filter.filter(this, AppStamp, Filename)
line = string_trim(inStream:getLine())
l = l + 1
if string.sub(line, 1, 2) == '--' then -- it's a comment
line = line:gsub('^---%s+@', '---@')
-- Allow people to write style similar to EmmyLua (since they are basically the same)
-- instead of silently skipping things that start with ---
if string.sub(line, 3, 3) == '@' then -- it's a magic comment
@ -341,6 +342,7 @@ function TLua2DoX_filter.filter(this, AppStamp, Filename)
if vim.startswith(line, '---@cast')
or vim.startswith(line, '---@diagnostic')
or vim.startswith(line, '---@overload')
or vim.startswith(line, '---@meta')
or vim.startswith(line, '---@type') then
-- Ignore LSP directives
outStream:writeln('// gg:"' .. line .. '"')