aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-05-06 04:42:30 -0700
committerGitHub <noreply@github.com>2024-05-06 04:42:30 -0700
commit783c1e596c35e44e9699e5a1881d3c8f5c4fc596 (patch)
treefdef03ec82aa36b4d2feb96b58cbd8a45eb95f1c
parentb024643ca7571cffb3dcc79c21dbccfe14aa3a6f (diff)
downloadrneovim-783c1e596c35e44e9699e5a1881d3c8f5c4fc596.tar.gz
rneovim-783c1e596c35e44e9699e5a1881d3c8f5c4fc596.tar.bz2
rneovim-783c1e596c35e44e9699e5a1881d3c8f5c4fc596.zip
refactor(snippet): rename exit() => stop() #28628
-rw-r--r--runtime/doc/develop.txt7
-rw-r--r--runtime/doc/lua.txt6
-rw-r--r--runtime/doc/news.txt2
-rw-r--r--runtime/lua/vim/snippet.lua8
4 files changed, 16 insertions, 7 deletions
diff --git a/runtime/doc/develop.txt b/runtime/doc/develop.txt
index f2eef7b131..7fc154441f 100644
--- a/runtime/doc/develop.txt
+++ b/runtime/doc/develop.txt
@@ -373,6 +373,9 @@ Use existing common {verb} names (actions) if possible:
- add: Appends or inserts into a collection
- attach: Listens to something to get events from it (TODO: rename to "on"?)
- 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
- create: Creates a new (non-trivial) thing (TODO: rename to "def"?)
- 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, …)
- parse: Parses something into a structured form
- 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
Do NOT use these deprecated verbs:
- disable: Prefer `enable(enable: boolean)`.
+ - exit: Prefer "cancel" (or "stop" if appropriate).
- is_disabled: Prefer `is_enabled()`.
- list: Redundant with "get"
- notify: Redundant with "print", "echo"
diff --git a/runtime/doc/lua.txt b/runtime/doc/lua.txt
index 4f538f52ab..e24f5dfc7e 100644
--- a/runtime/doc/lua.txt
+++ b/runtime/doc/lua.txt
@@ -4330,9 +4330,6 @@ vim.snippet.active({filter}) *vim.snippet.active()*
Return: ~
(`boolean`)
-vim.snippet.exit() *vim.snippet.exit()*
- Exits the current snippet.
-
vim.snippet.expand({input}) *vim.snippet.expand()*
Expands the given snippet text. Refer to
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
previous, 1 for next.
+vim.snippet.stop() *vim.snippet.stop()*
+ Exits the current snippet.
+
==============================================================================
Lua module: vim.text *vim.text*
diff --git a/runtime/doc/news.txt b/runtime/doc/news.txt
index 9860e54828..07ea31e1df 100644
--- a/runtime/doc/news.txt
+++ b/runtime/doc/news.txt
@@ -176,6 +176,8 @@ cycle (Nvim HEAD, the "master" branch).
• Renamed nvim_complete_set to nvim__complete_set and marked it as
experimental.
+• Renamed vim.snippet.exit() to vim.snippet.stop().
+
==============================================================================
NEW FEATURES *news-features*
diff --git a/runtime/lua/vim/snippet.lua b/runtime/lua/vim/snippet.lua
index 18c613cb85..8fe03b3882 100644
--- a/runtime/lua/vim/snippet.lua
+++ b/runtime/lua/vim/snippet.lua
@@ -343,7 +343,7 @@ local function setup_autocmds(bufnr)
or cursor_row > snippet_range[3]
or (cursor_row == snippet_range[3] and cursor_col > snippet_range[4])
then
- M.exit()
+ M.stop()
return true
end
@@ -362,7 +362,7 @@ local function setup_autocmds(bufnr)
end
-- The cursor is either not on a tabstop or we reached the end, so exit the session.
- M.exit()
+ M.stop()
return true
end,
})
@@ -378,7 +378,7 @@ local function setup_autocmds(bufnr)
(snippet_range[1] == snippet_range[3] and snippet_range[2] == snippet_range[4])
or snippet_range[3] + 1 > vim.fn.line('$')
then
- M.exit()
+ M.stop()
end
if not M.active() then
@@ -615,7 +615,7 @@ function M.active(filter)
end
--- Exits the current snippet.
-function M.exit()
+function M.stop()
if not M.active() then
return
end