It is possible for the buffer to change during the async function. To
avoid this, before applying the extmark, check that the cursor is in the
same position. If it is the extmark should be ok to apply and at the
very least will avoid the `line value outside range` error.
Fixes#312
If installed and enabled (via `config.trouble`; defaults to true if
installed), `:Gitsigns setqflist` and `:Gitsigns seqloclist` will
open Trouble instead of Neovim's built-in quickfix or location list
windows.
Add deprecations to doc.
When fields are now initially deprecated, no warning messages will be
displayed. However if a deprecated field is marked with hard, then a
warning will be issued.
At the beginning of each release cycle, all deprecated fields will be
marked as hard and fields that were already marked as hard will be
removed.
Some git command likes `git checkout -b` do no update .git/index.
Instead watch the git dir itself to capture all git operations.
Renamed config.watch_index -> config.watch_gitdir
Fixes#377
- Fix duplicate items appearing (#370)
- Make setqflist/setloclist async again
- setqflist('all') now also looks in the current working directory
- Automatically open the quickfix/location list on completion
- Make setloclist an alias of setqflist
- Refactor git.tl so now there is a separate 'Repo' object to allows us
to create git objects for a directory.
Fixes#370
This change removes the use of plenary's job API.
Whilst it has served us well up until now, there are several reasons why
it isn't well fit for Gitsigns and why a simpler implementation
will serve us better.
One of the key features of plenary jobs is that it provides on line
callbacks for reading stdout/stderr. Whilst these can be really useful,
they don't provide any benefits for Gitsigns which pretty much just
consumes the full output from all the processes it spawns. Additionally
the handlers are relatively complex and have been a source of problems.
These handlers also do a lot of processing by splitting data chunks and
searching for newline characters. This processing is wasted since we
concatenate the full output.
The new API simply returns two strings for stdout and stderr and it is
up to the caller on whether they need to split these into lines to
iterate over.
Plenary jobs were designed to be composed, chained together and
interrupted. To facilitate this, it has some fairly complex logic around
the uv pipe object handling to ensure they are correctly managed and
don't leak memory.
The new API simply opens the pipes, and closes them when the jobs
finish.
Plenary does a fair amount of input validation at runtime. While this is
useful for projects written in lua, since Gitsigns is implemented in
Teal, we can get all of these checks statically by implementing a job
API which is typed.
Speculative signs are added immediately whereas updates are debounced
and throttled for each buffer. If we perform two quick updates which
result in a sign begin added then removed, we need to make sure
speculative signs don't incorrectly persist. Example:
-> buffer change
- speculative signs (#1)
- update (#1)
-> undo (quickly after buffer change)
- speculative signs (#2)
- update (#2)
Update #1 is dropped due to the debounce which results in update #2 not
updating signs due to the hunks not changing. Since signs are never
updated, the speculative signs #1 and #2 will persist.
To get around this, we just need to invalidate the hunks to force a sign
refresh.