Skip to content

Commit

Permalink
nvim: move QuickfixError and CommandCompletionArgs type to types.go
Browse files Browse the repository at this point in the history
  • Loading branch information
zchee committed Dec 31, 2020
1 parent af667b8 commit 620209e
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 59 deletions.
59 changes: 0 additions & 59 deletions nvim/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,6 @@ import (
"io"
)

// QuickfixError represents an item in a quickfix list.
type QuickfixError struct {
// Buffer number
Bufnr int `msgpack:"bufnr,omitempty"`

// Line number in the file.
LNum int `msgpack:"lnum,omitempty"`

// Search pattern used to locate the error.
Pattern string `msgpack:"pattern,omitempty"`

// Column number (first column is 1).
Col int `msgpack:"col,omitempty"`

// When Vcol is != 0, Col is visual column.
VCol int `msgpack:"vcol,omitempty"`

// Error number.
Nr int `msgpack:"nr,omitempty"`

// Description of the error.
Text string `msgpack:"text,omitempty"`

// Single-character error type, 'E', 'W', etc.
Type string `msgpack:"type,omitempty"`

// Name of a file; only used when bufnr is not present or it is invalid.
FileName string `msgpack:"filename,omitempty"`

// Valid is non-zero if this is a recognized error message.
Valid int `msgpack:"valid,omitempty"`

// Module name of a module. If given it will be used in quickfix error window instead of the filename.
Module string `msgpack:"module,omitempty"`
}

// CommandCompletionArgs represents the arguments to a custom command line
// completion function.
//
// :help :command-completion-custom
type CommandCompletionArgs struct {
// ArgLead is the leading portion of the argument currently being completed
// on.
ArgLead string `msgpack:",array"`

// CmdLine is the entire command line.
CmdLine string

// CursorPosString is decimal representation of the cursor position in
// bytes.
CursorPosString int
}

// CursorPos returns the cursor position.
func (a *CommandCompletionArgs) CursorPos() int {
n := a.CursorPosString
return n
}

type bufferReader struct {
v *Nvim
b Buffer
Expand Down
59 changes: 59 additions & 0 deletions nvim/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,64 @@
package nvim

// QuickfixError represents an item in a quickfix list.
type QuickfixError struct {
// Buffer number
Bufnr int `msgpack:"bufnr,omitempty"`

// Line number in the file.
LNum int `msgpack:"lnum,omitempty"`

// Search pattern used to locate the error.
Pattern string `msgpack:"pattern,omitempty"`

// Column number (first column is 1).
Col int `msgpack:"col,omitempty"`

// When Vcol is != 0, Col is visual column.
VCol int `msgpack:"vcol,omitempty"`

// Error number.
Nr int `msgpack:"nr,omitempty"`

// Description of the error.
Text string `msgpack:"text,omitempty"`

// Single-character error type, 'E', 'W', etc.
Type string `msgpack:"type,omitempty"`

// Name of a file; only used when bufnr is not present or it is invalid.
FileName string `msgpack:"filename,omitempty"`

// Valid is non-zero if this is a recognized error message.
Valid int `msgpack:"valid,omitempty"`

// Module name of a module. If given it will be used in quickfix error window instead of the filename.
Module string `msgpack:"module,omitempty"`
}

// CommandCompletionArgs represents the arguments to a custom command line
// completion function.
//
// :help :command-completion-custom
type CommandCompletionArgs struct {
// ArgLead is the leading portion of the argument currently being completed
// on.
ArgLead string `msgpack:",array"`

// CmdLine is the entire command line.
CmdLine string

// CursorPosString is decimal representation of the cursor position in
// bytes.
CursorPosString int
}

// CursorPos returns the cursor position.
func (a *CommandCompletionArgs) CursorPos() int {
n := a.CursorPosString
return n
}

// Mode represents a Nvim's current mode.
type Mode struct {
// Mode is the current mode.
Expand Down

0 comments on commit 620209e

Please sign in to comment.