mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
refactor(snippet): rename exit() => stop() #28628
This commit is contained in:
parent
b024643ca7
commit
783c1e596c
@ -373,6 +373,9 @@ Use existing common {verb} names (actions) if possible:
|
|||||||
- add: Appends or inserts into a collection
|
- add: Appends or inserts into a collection
|
||||||
- attach: Listens to something to get events from it (TODO: rename to "on"?)
|
- attach: Listens to something to get events from it (TODO: rename to "on"?)
|
||||||
- call: Calls a function
|
- call: Calls a function
|
||||||
|
- cancel: Cancels or dismisses an event or interaction, typically
|
||||||
|
user-initiated and without error. (Compare "abort", which
|
||||||
|
cancels and signals error/failure.)
|
||||||
- clear: Clears state but does not destroy the container
|
- clear: Clears state but does not destroy the container
|
||||||
- create: Creates a new (non-trivial) thing (TODO: rename to "def"?)
|
- create: Creates a new (non-trivial) thing (TODO: rename to "def"?)
|
||||||
- del: Deletes a thing (or group of things)
|
- del: Deletes a thing (or group of things)
|
||||||
@ -388,10 +391,14 @@ Use existing common {verb} names (actions) if possible:
|
|||||||
- open: Opens something (a buffer, window, …)
|
- open: Opens something (a buffer, window, …)
|
||||||
- parse: Parses something into a structured form
|
- parse: Parses something into a structured form
|
||||||
- set: Sets a thing (or group of things)
|
- set: Sets a thing (or group of things)
|
||||||
|
- start: Spin up a long-lived process. Prefer "enable" except when
|
||||||
|
"start" is obviously more appropriate.
|
||||||
|
- stop: Inverse of "start". Teardown a long-lived process.
|
||||||
- try_{verb}: Best-effort operation, failure returns null or error obj
|
- try_{verb}: Best-effort operation, failure returns null or error obj
|
||||||
|
|
||||||
Do NOT use these deprecated verbs:
|
Do NOT use these deprecated verbs:
|
||||||
- disable: Prefer `enable(enable: boolean)`.
|
- disable: Prefer `enable(enable: boolean)`.
|
||||||
|
- exit: Prefer "cancel" (or "stop" if appropriate).
|
||||||
- is_disabled: Prefer `is_enabled()`.
|
- is_disabled: Prefer `is_enabled()`.
|
||||||
- list: Redundant with "get"
|
- list: Redundant with "get"
|
||||||
- notify: Redundant with "print", "echo"
|
- notify: Redundant with "print", "echo"
|
||||||
|
@ -4330,9 +4330,6 @@ vim.snippet.active({filter}) *vim.snippet.active()*
|
|||||||
Return: ~
|
Return: ~
|
||||||
(`boolean`)
|
(`boolean`)
|
||||||
|
|
||||||
vim.snippet.exit() *vim.snippet.exit()*
|
|
||||||
Exits the current snippet.
|
|
||||||
|
|
||||||
vim.snippet.expand({input}) *vim.snippet.expand()*
|
vim.snippet.expand({input}) *vim.snippet.expand()*
|
||||||
Expands the given snippet text. Refer to
|
Expands the given snippet text. Refer to
|
||||||
https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax
|
https://microsoft.github.io/language-server-protocol/specification/#snippet_syntax
|
||||||
@ -4361,6 +4358,9 @@ vim.snippet.jump({direction}) *vim.snippet.jump()*
|
|||||||
• {direction} (`vim.snippet.Direction`) Navigation direction. -1 for
|
• {direction} (`vim.snippet.Direction`) Navigation direction. -1 for
|
||||||
previous, 1 for next.
|
previous, 1 for next.
|
||||||
|
|
||||||
|
vim.snippet.stop() *vim.snippet.stop()*
|
||||||
|
Exits the current snippet.
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
Lua module: vim.text *vim.text*
|
Lua module: vim.text *vim.text*
|
||||||
|
@ -176,6 +176,8 @@ cycle (Nvim HEAD, the "master" branch).
|
|||||||
• Renamed nvim_complete_set to nvim__complete_set and marked it as
|
• Renamed nvim_complete_set to nvim__complete_set and marked it as
|
||||||
experimental.
|
experimental.
|
||||||
|
|
||||||
|
• Renamed vim.snippet.exit() to vim.snippet.stop().
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
NEW FEATURES *news-features*
|
NEW FEATURES *news-features*
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ local function setup_autocmds(bufnr)
|
|||||||
or cursor_row > snippet_range[3]
|
or cursor_row > snippet_range[3]
|
||||||
or (cursor_row == snippet_range[3] and cursor_col > snippet_range[4])
|
or (cursor_row == snippet_range[3] and cursor_col > snippet_range[4])
|
||||||
then
|
then
|
||||||
M.exit()
|
M.stop()
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ local function setup_autocmds(bufnr)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- The cursor is either not on a tabstop or we reached the end, so exit the session.
|
-- The cursor is either not on a tabstop or we reached the end, so exit the session.
|
||||||
M.exit()
|
M.stop()
|
||||||
return true
|
return true
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -378,7 +378,7 @@ local function setup_autocmds(bufnr)
|
|||||||
(snippet_range[1] == snippet_range[3] and snippet_range[2] == snippet_range[4])
|
(snippet_range[1] == snippet_range[3] and snippet_range[2] == snippet_range[4])
|
||||||
or snippet_range[3] + 1 > vim.fn.line('$')
|
or snippet_range[3] + 1 > vim.fn.line('$')
|
||||||
then
|
then
|
||||||
M.exit()
|
M.stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
if not M.active() then
|
if not M.active() then
|
||||||
@ -615,7 +615,7 @@ function M.active(filter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Exits the current snippet.
|
--- Exits the current snippet.
|
||||||
function M.exit()
|
function M.stop()
|
||||||
if not M.active() then
|
if not M.active() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user