-
-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: new lua API (using metatables) #183
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If anyone finds this destructive, then they can stick with https://github.com/numToStr/Comment.nvim/releases/tag/v0.6.1 |
numToStr
force-pushed
the
meta/api
branch
5 times, most recently
from
July 26, 2022 08:17
a3a2ab1
to
4d97e28
Compare
numToStr
force-pushed
the
meta/api
branch
2 times, most recently
from
August 2, 2022 10:13
fbcc2e7
to
31e12c4
Compare
This deprecates the old API and will be removed in the next tagged releases probably v0.7 Currently every Lua API is a function call, which is fine, but most of them are similar to others only having different arguments and uses same call under the hood. This is not extensible if we want to create a new mode #17 and have slight maintenance burden. Using setmetatable we can probably build-up the API as we go. This will be extensible and have less maintenance overhead. This also changes the `ctype` utility. If you are using it then you might wanna migrate to the following: - `U.ctype.line` → `U.ctype.linewise` - `U.ctype.block` → `U.ctype.blockwise` Resolves #180
…blockwise}_current)
This was referenced Aug 12, 2022
numToStr
added a commit
that referenced
this pull request
Oct 2, 2022
If you are using these old APIs, which I highly doubt that by now, then you should have a look at #183. Beside removing old APIs, this PR also includes some doc updates.
Fryuni
added a commit
to Fryuni/doom-nvim
that referenced
this pull request
Oct 9, 2022
The call convention for the `Comment.nvim` plugin has changed on the latest version. Previously the methods were flattened in the required object with `_` separators, now they are organized in a nested structure using metatables. - Added upstream on numToStr/Comment.nvim#183
NTBBloodbath
pushed a commit
to doom-neovim/doom-nvim
that referenced
this pull request
Oct 9, 2022
The call convention for the `Comment.nvim` plugin has changed on the latest version. Previously the methods were flattened in the required object with `_` separators, now they are organized in a nested structure using metatables. - Added upstream on numToStr/Comment.nvim#183
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This deprecates the old Lua API and will be removed in the next
tagged release of the plugin, probably
v0.7.0
.Currently every Lua API is a function call, which is fine, and they are
similar to one another having few different arguments. This is not
extensible and have slight maintenance burden if we want to create
new mode (ref: #17) or introduce new API functions.
Using
setmetatable
we can build-up the API as we go. This willbe extensible and have less maintenance overhead.
Following is the new Lua API:
This also introduces couple of (breaking) changes apart from the lua API:
Rename the following
<Plug>
mappings (to be consistent with API)<Plug>(comment_toggle_current_linewise)
-><Plug>(comment_toggle_linewise_current)
<Plug>(comment_toggle_current_blockwise)
-><Plug>(comment_toggle_blockwise_current)
Changed field names of
utils.ctype
objectU.ctype.line
→U.ctype.linewise
U.ctype.block
→U.ctype.blockwise
Now
require('Comment.api').locked
is a function whichtakes the name of the new lua API call (old signature is deprecated)
cmotion
(last) argument fromrequire('Comment.opfunc').opfunc()
functionResolves #180