build: add doc and lint check
This commit is contained in:
parent
bd0f4d518d
commit
e308a4f5dd
|
@ -21,7 +21,7 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
neovim_branch:
|
neovim_branch:
|
||||||
- 'v0.8.3'
|
- 'v0.8.3'
|
||||||
- 'v0.9.1'
|
- 'v0.9.2'
|
||||||
- 'nightly'
|
- 'nightly'
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
@ -42,3 +42,27 @@ jobs:
|
||||||
|
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
run: make test
|
run: make test
|
||||||
|
|
||||||
|
lint:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Download stylua
|
||||||
|
run: make stylua
|
||||||
|
|
||||||
|
- name: Lint
|
||||||
|
run: make stylua-check
|
||||||
|
|
||||||
|
doc:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Download Nvim
|
||||||
|
run: make nvim
|
||||||
|
|
||||||
|
- name: Doc Check
|
||||||
|
run: make doc-check
|
||||||
|
|
43
Makefile
43
Makefile
|
@ -7,11 +7,15 @@ NVIM_RUNNER_VERSION := v0.9.1
|
||||||
NVIM_TEST_VERSION ?= v0.9.1
|
NVIM_TEST_VERSION ?= v0.9.1
|
||||||
|
|
||||||
ifeq ($(shell uname -s),Darwin)
|
ifeq ($(shell uname -s),Darwin)
|
||||||
NVIM_PLATFORM ?= macos
|
UNAME ?= MACOS
|
||||||
else
|
else
|
||||||
NVIM_PLATFORM ?= linux64
|
UNAME ?= LINUX
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
NVIM_PLATFORM_MACOS := macos
|
||||||
|
NVIM_PLATFORM_LINUX := linux64
|
||||||
|
NVIM_PLATFORM ?= $(NVIM_PLATFORM_$(UNAME))
|
||||||
|
|
||||||
NVIM_URL := https://github.com/neovim/neovim/releases/download
|
NVIM_URL := https://github.com/neovim/neovim/releases/download
|
||||||
|
|
||||||
NVIM_RUNNER := nvim-runner-$(NVIM_RUNNER_VERSION)
|
NVIM_RUNNER := nvim-runner-$(NVIM_RUNNER_VERSION)
|
||||||
|
@ -60,9 +64,38 @@ test: $(NVIM_RUNNER) $(NVIM_TEST) .luarocks/bin/busted
|
||||||
-@stty sane
|
-@stty sane
|
||||||
|
|
||||||
.PHONY: gen_help
|
.PHONY: gen_help
|
||||||
gen_help:
|
gen_help: $(NVIM_RUNNER)
|
||||||
@./gen_help.lua
|
@$(NVIM_RUNNER)/bin/nvim -l ./gen_help.lua
|
||||||
@echo Updated help
|
@echo Updated help
|
||||||
|
|
||||||
|
STYLUA_PLATFORM_MACOS := macos-aarch64
|
||||||
|
STYLUA_PLATFORM_LINUX := linux-x86_64
|
||||||
|
STYLUA_PLATFORM := $(STYLUA_PLATFORM_$(UNAME))
|
||||||
|
|
||||||
|
STYLUA_VERSION := v0.18.2
|
||||||
|
STYLUA_ZIP := stylua-$(STYLUA_PLATFORM).zip
|
||||||
|
STYLUA_URL_BASE := https://github.com/JohnnyMorganz/StyLua/releases/download
|
||||||
|
STYLUA_URL := $(STYLUA_URL_BASE)/$(STYLUA_VERSION)/$(STYLUA_ZIP)
|
||||||
|
|
||||||
|
.INTERMEDIATE: $(STYLUA_ZIP)
|
||||||
|
$(STYLUA_ZIP):
|
||||||
|
wget $(STYLUA_URL)
|
||||||
|
|
||||||
|
stylua: $(STYLUA_ZIP)
|
||||||
|
unzip $<
|
||||||
|
|
||||||
|
.PHONY: stylua-check
|
||||||
|
stylua-check: stylua
|
||||||
|
./stylua --check lua/**/*.lua
|
||||||
|
|
||||||
|
.PHONY: stylua-run
|
||||||
|
stylua-run: stylua
|
||||||
|
./stylua lua/**/*.lua lua/*.lua
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build: gen_help
|
build: gen_help stylua-run
|
||||||
|
|
||||||
|
.PHONY: doc-check
|
||||||
|
doc-check: gen_help
|
||||||
|
git diff --exit-code -- doc
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ setup({cfg}) *gitsigns.setup()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{cfg} (table|nil): Configuration for Gitsigns.
|
{cfg} (table|nil): Configuration for Gitsigns.
|
||||||
See |gitsigns-usage| for more details.
|
See |gitsigns-usage| for more details.
|
||||||
|
|
||||||
attach({bufnr}, {ctx}) *gitsigns.attach()*
|
attach({bufnr}, {ctx}) *gitsigns.attach()*
|
||||||
|
@ -108,8 +108,8 @@ attach({bufnr}, {ctx}) *gitsigns.attach()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{bufnr} (integer): Buffer number
|
{bufnr} (integer): Buffer number
|
||||||
{ctx} (table|nil):
|
{ctx} (table|nil):
|
||||||
Git context data that may optionally be used to attach to any
|
Git context data that may optionally be used to attach to any
|
||||||
buffer that represents a real git object.
|
buffer that represents a real git object.
|
||||||
• {file}: (string)
|
• {file}: (string)
|
||||||
|
@ -130,7 +130,7 @@ detach({bufnr}) *gitsigns.detach()*
|
||||||
provided then the current buffer is used.
|
provided then the current buffer is used.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{bufnr} (integer): Buffer number
|
{bufnr} (integer): Buffer number
|
||||||
|
|
||||||
detach_all() *gitsigns.detach_all()*
|
detach_all() *gitsigns.detach_all()*
|
||||||
Detach Gitsigns from all buffers it is attached to.
|
Detach Gitsigns from all buffers it is attached to.
|
||||||
|
@ -147,7 +147,7 @@ get_actions() *gitsigns.get_actions()*
|
||||||
|
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(table|nil): Dictionary of action name to function which when called
|
(table|nil): Dictionary of action name to function which when called
|
||||||
performs action.
|
performs action.
|
||||||
|
|
||||||
setloclist({nr}, {target}) *gitsigns.setloclist()*
|
setloclist({nr}, {target}) *gitsigns.setloclist()*
|
||||||
|
@ -160,9 +160,9 @@ setloclist({nr}, {target}) *gitsigns.setloclist()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{nr} (integer): Window number or the |window-ID|.
|
{nr} (integer): Window number or the |window-ID|.
|
||||||
`0` for the current window (default).
|
`0` for the current window (default).
|
||||||
{target} (integer|string): See |gitsigns.setqflist()|.
|
{target} (integer|string): See |gitsigns.setqflist()|.
|
||||||
|
|
||||||
setqflist({target}, {opts}) *gitsigns.setqflist()*
|
setqflist({target}, {opts}) *gitsigns.setqflist()*
|
||||||
Populate the quickfix list with hunks. Automatically opens the
|
Populate the quickfix list with hunks. Automatically opens the
|
||||||
|
@ -172,7 +172,7 @@ setqflist({target}, {opts}) *gitsigns.setqflist()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{target} (integer|string):
|
{target} (integer|string):
|
||||||
Specifies which files hunks are collected from.
|
Specifies which files hunks are collected from.
|
||||||
Possible values.
|
Possible values.
|
||||||
• [integer]: The buffer with the matching buffer
|
• [integer]: The buffer with the matching buffer
|
||||||
|
@ -181,7 +181,7 @@ setqflist({target}, {opts}) *gitsigns.setqflist()*
|
||||||
• `"all"`: All modified files for each git
|
• `"all"`: All modified files for each git
|
||||||
directory of all attached buffers in addition
|
directory of all attached buffers in addition
|
||||||
to the current working directory.
|
to the current working directory.
|
||||||
{opts} (table|nil): Additional options:
|
{opts} (table|nil): Additional options:
|
||||||
• {use_location_list}: (boolean)
|
• {use_location_list}: (boolean)
|
||||||
Populate the location list instead of the
|
Populate the location list instead of the
|
||||||
quickfix list. Default to `false`.
|
quickfix list. Default to `false`.
|
||||||
|
@ -236,8 +236,8 @@ diffthis({base}, {opts}) *gitsigns.diffthis()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{base} (string|nil): Revision to diff against. Defaults to index.
|
{base} (string|nil): Revision to diff against. Defaults to index.
|
||||||
{opts} (table|nil): Additional options:
|
{opts} (table|nil): Additional options:
|
||||||
• {vertical}: {boolean}. Split window vertically. Defaults to
|
• {vertical}: {boolean}. Split window vertically. Defaults to
|
||||||
config.diff_opts.vertical. If running via command line, then
|
config.diff_opts.vertical. If running via command line, then
|
||||||
this is taken from the command modifiers.
|
this is taken from the command modifiers.
|
||||||
|
@ -284,8 +284,8 @@ change_base({base}, {global}) *gitsigns.change_base()*
|
||||||
|gitsigns-revision|.
|
|gitsigns-revision|.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{base} (string|nil): The object/revision to diff against.
|
{base} (string|nil): The object/revision to diff against.
|
||||||
{global} (boolean|nil): Change the base of all buffers.
|
{global} (boolean|nil): Change the base of all buffers.
|
||||||
|
|
||||||
blame_line({opts}) *gitsigns.blame_line()*
|
blame_line({opts}) *gitsigns.blame_line()*
|
||||||
Run git blame on the current line and show the results in a
|
Run git blame on the current line and show the results in a
|
||||||
|
@ -296,7 +296,7 @@ blame_line({opts}) *gitsigns.blame_line()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{opts} (table|nil): Additional options:
|
{opts} (table|nil): Additional options:
|
||||||
• {full}: (boolean)
|
• {full}: (boolean)
|
||||||
Display full commit message with hunk.
|
Display full commit message with hunk.
|
||||||
• {ignore_whitespace}: (boolean)
|
• {ignore_whitespace}: (boolean)
|
||||||
|
@ -306,11 +306,11 @@ get_hunks({bufnr}) *gitsigns.get_hunks()*
|
||||||
Get hunk array for specified buffer.
|
Get hunk array for specified buffer.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{bufnr} (integer): Buffer number, if not provided (or 0)
|
{bufnr} (integer): Buffer number, if not provided (or 0)
|
||||||
will use current buffer.
|
will use current buffer.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(table|nil): Array of hunk objects.
|
(table|nil): Array of hunk objects.
|
||||||
Each hunk object has keys:
|
Each hunk object has keys:
|
||||||
• `"type"`: String with possible values: "add", "change",
|
• `"type"`: String with possible values: "add", "change",
|
||||||
"delete"
|
"delete"
|
||||||
|
@ -350,7 +350,7 @@ next_hunk({opts}) *gitsigns.next_hunk()*
|
||||||
at the next hunk.
|
at the next hunk.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{opts} (table|nil): Configuration table. Keys:
|
{opts} (table|nil): Configuration table. Keys:
|
||||||
• {wrap}: (boolean)
|
• {wrap}: (boolean)
|
||||||
Whether to loop around file or not. Defaults
|
Whether to loop around file or not. Defaults
|
||||||
to the value 'wrapscan'
|
to the value 'wrapscan'
|
||||||
|
@ -402,11 +402,11 @@ reset_hunk({range}, {opts}) *gitsigns.reset_hunk()*
|
||||||
hunk, only the lines within the range will be reset.
|
hunk, only the lines within the range will be reset.
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{range} (table|nil): List-like table of two integers making
|
{range} (table|nil): List-like table of two integers making
|
||||||
up the line range from which you want to reset the hunks.
|
up the line range from which you want to reset the hunks.
|
||||||
If running via command line, then this is taken from the
|
If running via command line, then this is taken from the
|
||||||
command modifiers.
|
command modifiers.
|
||||||
{opts} (table|nil): Additional options:
|
{opts} (table|nil): Additional options:
|
||||||
• {greedy}: (boolean)
|
• {greedy}: (boolean)
|
||||||
Stage all contiguous hunks. Only useful if 'diff_opts'
|
Stage all contiguous hunks. Only useful if 'diff_opts'
|
||||||
contains `linematch`. Defaults to `true`.
|
contains `linematch`. Defaults to `true`.
|
||||||
|
@ -422,11 +422,11 @@ stage_hunk({range}, {opts}) *gitsigns.stage_hunk()*
|
||||||
{async}
|
{async}
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{range} (table|nil): List-like table of two integers making
|
{range} (table|nil): List-like table of two integers making
|
||||||
up the line range from which you want to stage the hunks.
|
up the line range from which you want to stage the hunks.
|
||||||
If running via command line, then this is taken from the
|
If running via command line, then this is taken from the
|
||||||
command modifiers.
|
command modifiers.
|
||||||
{opts} (table|nil): Additional options:
|
{opts} (table|nil): Additional options:
|
||||||
• {greedy}: (boolean)
|
• {greedy}: (boolean)
|
||||||
Stage all contiguous hunks. Only useful if 'diff_opts'
|
Stage all contiguous hunks. Only useful if 'diff_opts'
|
||||||
contains `linematch`. Defaults to `true`.
|
contains `linematch`. Defaults to `true`.
|
||||||
|
@ -435,62 +435,62 @@ toggle_deleted({value}) *gitsigns.toggle_deleted()*
|
||||||
Toggle |gitsigns-config-show_deleted|
|
Toggle |gitsigns-config-show_deleted|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-show_deleted|
|
(boolean): Current value of |gitsigns-config-show_deleted|
|
||||||
|
|
||||||
toggle_current_line_blame({value}) *gitsigns.toggle_current_line_blame()*
|
toggle_current_line_blame({value}) *gitsigns.toggle_current_line_blame()*
|
||||||
Toggle |gitsigns-config-current_line_blame|
|
Toggle |gitsigns-config-current_line_blame|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-current_line_blame|
|
(boolean): Current value of |gitsigns-config-current_line_blame|
|
||||||
|
|
||||||
toggle_word_diff({value}) *gitsigns.toggle_word_diff()*
|
toggle_word_diff({value}) *gitsigns.toggle_word_diff()*
|
||||||
Toggle |gitsigns-config-word_diff|
|
Toggle |gitsigns-config-word_diff|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-word_diff|
|
(boolean): Current value of |gitsigns-config-word_diff|
|
||||||
|
|
||||||
toggle_linehl({value}) *gitsigns.toggle_linehl()*
|
toggle_linehl({value}) *gitsigns.toggle_linehl()*
|
||||||
Toggle |gitsigns-config-linehl|
|
Toggle |gitsigns-config-linehl|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-linehl|
|
(boolean): Current value of |gitsigns-config-linehl|
|
||||||
|
|
||||||
toggle_numhl({value}) *gitsigns.toggle_numhl()*
|
toggle_numhl({value}) *gitsigns.toggle_numhl()*
|
||||||
Toggle |gitsigns-config-numhl|
|
Toggle |gitsigns-config-numhl|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-numhl|
|
(boolean): Current value of |gitsigns-config-numhl|
|
||||||
|
|
||||||
toggle_signs({value}) *gitsigns.toggle_signs()*
|
toggle_signs({value}) *gitsigns.toggle_signs()*
|
||||||
Toggle |gitsigns-config-signbooleancolumn|
|
Toggle |gitsigns-config-signbooleancolumn|
|
||||||
|
|
||||||
Parameters: ~
|
Parameters: ~
|
||||||
{value} (boolean|nil): Value to set toggle. If `nil`
|
{value} (boolean|nil): Value to set toggle. If `nil`
|
||||||
the toggle value is inverted.
|
the toggle value is inverted.
|
||||||
|
|
||||||
Returns: ~
|
Returns: ~
|
||||||
(boolean): Current value of |gitsigns-config-signcolumn|
|
(boolean): Current value of |gitsigns-config-signcolumn|
|
||||||
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
|
@ -220,7 +220,7 @@ local function render_param_or_return(name, ty, desc, name_pad)
|
||||||
local r = {} --- @type string[]
|
local r = {} --- @type string[]
|
||||||
|
|
||||||
local desc1 = desc[1] == '' and '' or ' ' .. desc[1]
|
local desc1 = desc[1] == '' and '' or ' ' .. desc[1]
|
||||||
r[#r + 1] = string.format(' %s(%s): %s', name_str, ty, desc1)
|
r[#r + 1] = string.format(' %s(%s):%s', name_str, ty, desc1)
|
||||||
|
|
||||||
local remain_desc = trim_lines(vim.list_slice(desc, 2))
|
local remain_desc = trim_lines(vim.list_slice(desc, 2))
|
||||||
for _, d in ipairs(remain_desc) do
|
for _, d in ipairs(remain_desc) do
|
||||||
|
|
|
@ -1105,7 +1105,7 @@ local function hunks_to_qflist(buf_or_filename, hunks, qflist)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param target? 'all'|'attached'|integer
|
---@param target 'all'|'attached'|integer|nil
|
||||||
---@return table[]?
|
---@return table[]?
|
||||||
local function buildqflist(target)
|
local function buildqflist(target)
|
||||||
target = target or current_buf()
|
target = target or current_buf()
|
||||||
|
@ -1160,7 +1160,7 @@ end
|
||||||
--- Attributes: ~
|
--- Attributes: ~
|
||||||
--- {async}
|
--- {async}
|
||||||
---
|
---
|
||||||
--- @param target? integer|string
|
--- @param target integer|string
|
||||||
--- Specifies which files hunks are collected from.
|
--- Specifies which files hunks are collected from.
|
||||||
--- Possible values.
|
--- Possible values.
|
||||||
--- • [integer]: The buffer with the matching buffer
|
--- • [integer]: The buffer with the matching buffer
|
||||||
|
@ -1225,9 +1225,9 @@ end
|
||||||
--- Attributes: ~
|
--- Attributes: ~
|
||||||
--- {async}
|
--- {async}
|
||||||
---
|
---
|
||||||
--- @param nr? integer Window number or the |window-ID|.
|
--- @param nr integer Window number or the |window-ID|.
|
||||||
--- `0` for the current window (default).
|
--- `0` for the current window (default).
|
||||||
--- @param target? integer|string See |gitsigns.setqflist()|.
|
--- @param target integer|string See |gitsigns.setqflist()|.
|
||||||
M.setloclist = function(nr, target)
|
M.setloclist = function(nr, target)
|
||||||
M.setqflist(target, {
|
M.setqflist(target, {
|
||||||
nr = nr,
|
nr = nr,
|
||||||
|
|
Loading…
Reference in New Issue