feat(watcher): re-add watch_gitdir.enable

This commit is contained in:
Lewis Russell 2022-08-10 12:06:52 +01:00
parent feff9d5618
commit ca6b3220b3
5 changed files with 22 additions and 0 deletions

View File

@ -562,6 +562,7 @@ watch_gitdir *gitsigns-config-watch_gitdir*
Type: `table`
Default: >
{
enable = true,
interval = 1000,
follow_files = true
}
@ -571,6 +572,9 @@ watch_gitdir *gitsigns-config-watch_gitdir*
update signs.
Fields: ~
• `enable`:
Whether the watcher is enabled.
• `interval`:
Interval the watcher waits between polls of the gitdir in milliseconds.

View File

@ -120,6 +120,7 @@ local M = {Config = {DiffOpts = {}, SignConfig = {}, watch_gitdir = {}, current_
M.config = {}
@ -253,6 +254,7 @@ M.schema = {
watch_gitdir = {
type = 'table',
default = {
enable = true,
interval = 1000,
follow_files = true,
},
@ -262,6 +264,9 @@ M.schema = {
update signs.
Fields: ~
`enable`:
Whether the watcher is enabled.
`interval`:
Interval the watcher waits between polls of the gitdir in milliseconds.

View File

@ -305,6 +305,10 @@ end
M.watch_gitdir = function(bufnr, gitdir)
if not config.watch_gitdir.enable then
return
end
dprintf('Watching git dir')
local w = uv.new_fs_poll()
w:start(gitdir, config.watch_gitdir.interval, void(function(err)

View File

@ -61,6 +61,7 @@ local record M
_on_attach_pre: function(bufnr: integer, callback: function(table))
on_attach: function(bufnr: integer)
record watch_gitdir
enable: boolean
interval: integer
follow_files: boolean
end
@ -253,6 +254,7 @@ M.schema = {
watch_gitdir = {
type = 'table',
default = {
enable = true,
interval = 1000,
follow_files = true
},
@ -262,6 +264,9 @@ M.schema = {
update signs.
Fields: ~
`enable`:
Whether the watcher is enabled.
`interval`:
Interval the watcher waits between polls of the gitdir in milliseconds.

View File

@ -305,6 +305,10 @@ end
M.watch_gitdir = function(bufnr: integer, gitdir: string): uv.FSPollObj
if not config.watch_gitdir.enable then
return
end
dprintf('Watching git dir')
local w = uv.new_fs_poll()
w:start(gitdir, config.watch_gitdir.interval, void(function(err: string)