Skip to content

Commit 620209e

Browse files
committed
nvim: move QuickfixError and CommandCompletionArgs type to types.go
1 parent af667b8 commit 620209e

File tree

2 files changed

+59
-59
lines changed

2 files changed

+59
-59
lines changed

nvim/helpers.go

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,6 @@ import (
44
"io"
55
)
66

7-
// QuickfixError represents an item in a quickfix list.
8-
type QuickfixError struct {
9-
// Buffer number
10-
Bufnr int `msgpack:"bufnr,omitempty"`
11-
12-
// Line number in the file.
13-
LNum int `msgpack:"lnum,omitempty"`
14-
15-
// Search pattern used to locate the error.
16-
Pattern string `msgpack:"pattern,omitempty"`
17-
18-
// Column number (first column is 1).
19-
Col int `msgpack:"col,omitempty"`
20-
21-
// When Vcol is != 0, Col is visual column.
22-
VCol int `msgpack:"vcol,omitempty"`
23-
24-
// Error number.
25-
Nr int `msgpack:"nr,omitempty"`
26-
27-
// Description of the error.
28-
Text string `msgpack:"text,omitempty"`
29-
30-
// Single-character error type, 'E', 'W', etc.
31-
Type string `msgpack:"type,omitempty"`
32-
33-
// Name of a file; only used when bufnr is not present or it is invalid.
34-
FileName string `msgpack:"filename,omitempty"`
35-
36-
// Valid is non-zero if this is a recognized error message.
37-
Valid int `msgpack:"valid,omitempty"`
38-
39-
// Module name of a module. If given it will be used in quickfix error window instead of the filename.
40-
Module string `msgpack:"module,omitempty"`
41-
}
42-
43-
// CommandCompletionArgs represents the arguments to a custom command line
44-
// completion function.
45-
//
46-
// :help :command-completion-custom
47-
type CommandCompletionArgs struct {
48-
// ArgLead is the leading portion of the argument currently being completed
49-
// on.
50-
ArgLead string `msgpack:",array"`
51-
52-
// CmdLine is the entire command line.
53-
CmdLine string
54-
55-
// CursorPosString is decimal representation of the cursor position in
56-
// bytes.
57-
CursorPosString int
58-
}
59-
60-
// CursorPos returns the cursor position.
61-
func (a *CommandCompletionArgs) CursorPos() int {
62-
n := a.CursorPosString
63-
return n
64-
}
65-
667
type bufferReader struct {
678
v *Nvim
689
b Buffer

nvim/types.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,64 @@
11
package nvim
22

3+
// QuickfixError represents an item in a quickfix list.
4+
type QuickfixError struct {
5+
// Buffer number
6+
Bufnr int `msgpack:"bufnr,omitempty"`
7+
8+
// Line number in the file.
9+
LNum int `msgpack:"lnum,omitempty"`
10+
11+
// Search pattern used to locate the error.
12+
Pattern string `msgpack:"pattern,omitempty"`
13+
14+
// Column number (first column is 1).
15+
Col int `msgpack:"col,omitempty"`
16+
17+
// When Vcol is != 0, Col is visual column.
18+
VCol int `msgpack:"vcol,omitempty"`
19+
20+
// Error number.
21+
Nr int `msgpack:"nr,omitempty"`
22+
23+
// Description of the error.
24+
Text string `msgpack:"text,omitempty"`
25+
26+
// Single-character error type, 'E', 'W', etc.
27+
Type string `msgpack:"type,omitempty"`
28+
29+
// Name of a file; only used when bufnr is not present or it is invalid.
30+
FileName string `msgpack:"filename,omitempty"`
31+
32+
// Valid is non-zero if this is a recognized error message.
33+
Valid int `msgpack:"valid,omitempty"`
34+
35+
// Module name of a module. If given it will be used in quickfix error window instead of the filename.
36+
Module string `msgpack:"module,omitempty"`
37+
}
38+
39+
// CommandCompletionArgs represents the arguments to a custom command line
40+
// completion function.
41+
//
42+
// :help :command-completion-custom
43+
type CommandCompletionArgs struct {
44+
// ArgLead is the leading portion of the argument currently being completed
45+
// on.
46+
ArgLead string `msgpack:",array"`
47+
48+
// CmdLine is the entire command line.
49+
CmdLine string
50+
51+
// CursorPosString is decimal representation of the cursor position in
52+
// bytes.
53+
CursorPosString int
54+
}
55+
56+
// CursorPos returns the cursor position.
57+
func (a *CommandCompletionArgs) CursorPos() int {
58+
n := a.CursorPosString
59+
return n
60+
}
61+
362
// Mode represents a Nvim's current mode.
463
type Mode struct {
564
// Mode is the current mode.

0 commit comments

Comments
 (0)