Documentation ¶
Index ¶
- func BazelTmpDir(t *testing.T) string
- func DeleteCommentAtCurrentLine(cl *nvim.Nvim) error
- func EditFile(cl *nvim.Nvim, filename string) error
- func GetAllLines(cl *nvim.Nvim, buf nvim.Buffer) ([]string, error)
- func GetComment(cl *nvim.Nvim) (string, error)
- func GetEventChannel(eventName string, cl *nvim.Nvim, pattern string) (chan struct{}, error)
- func GetLspAttachEvent(cl *nvim.Nvim, pattern string) (chan struct{}, error)
- func InsertText(cl *nvim.Nvim, buf nvim.Buffer, line int, text string) error
- func LogAllLines(t *testing.T, lines []string)
- func MoveToLine(cl *nvim.Nvim, line int) error
- func NewNeovim(dbfile string, args ...string) (*nvim.Nvim, error)
- func NotEmpty(s string) string
- func RemoveTextLines(cl *nvim.Nvim, buf nvim.Buffer, begin, count int) error
- func RunDBQuery(dbFilename, query string) (*sql.DB, func(), error)
- func SetComment(cl *nvim.Nvim, content string) error
- func WaitForAnn(ctx context.Context, cl *nvim.Nvim, text string) error
- func WaitForAnns(ctx context.Context, db *sql.DB, ws lsp.URI, file string, anns []pkg.Ann) error
- func WaitForLine(ctx context.Context, cl *nvim.Nvim, buf nvim.Buffer, line int, text string) error
- func WaitForNs(ctx context.Context, cl *nvim.Nvim, ns string) (int, error)
- func WaitForNsBuf(ctx context.Context, cl *nvim.Nvim, buf nvim.Buffer, name string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BazelTmpDir ¶
func GetComment ¶
GetComment gets a comment for current line of text.
func GetEventChannel ¶
GetEventChannel returns a channel that is closed when a LspAttach event happens. This is the only go-client example for handling this that I am aware of. For details, see: https://github.com/neovim/neovim/discussions/27371
GetEventChannel configures the Neovim client `cl` to close the returned channel when it gets the specified event. It seems that there is no automated way to connect nvim events such that the notifications to a go client happen automatically. Instead, we configure it ourselves.
Other subtleties are that you must ensure that you get the channel here strictly *before* sending any commands that could result in this notification. Otherwise, you can sometimes *miss* that event. For example, if you load a file from command line in Neovim, you might miss most, or all of the events emitted as a result of opening that file.
Args:
- eventName: the name of the event to get a notification for, such as 'FileType'.
- cl: a neovim client. Get one from `nvim.NewChildProcess`, for example.
- pattern: the autocmd pattern, for example, "text", or "*".
Returns: a channel that gets closed when the event is received.
func GetLspAttachEvent ¶
GetLspAttachEvent returns a channel that gets closed on receipt of a `LspAttach` event.
func LogAllLines ¶
func NewNeovim ¶
NewNeovim creates a new Neovim child process for testing.
The created Neovim is a hermetic instance.
func RunDBQuery ¶
RunDBQuery creates a database and runs a SQL query on it to populate it.
func SetComment ¶
SetComment sets a comment for current line of text.
func WaitForAnns ¶
WaitForAnns waits for annotations. Returns error if the exact annotations are not found.
func WaitForLine ¶
Types ¶
This section is empty.