Skip to content

Commit

Permalink
nvim: rename some type names (#105)
Browse files Browse the repository at this point in the history
* nvim: rename VirtualTextChunk and EchoChunk to TextChunk

* nvim: go generate

* nvim: rename ExtMarks to ExtMark

* nvim: go generate

* nvim: remove duplicate documentation

* nvim: go generate
  • Loading branch information
zchee authored Mar 8, 2021
1 parent c757fcd commit a45dcbd
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
18 changes: 8 additions & 10 deletions nvim/api.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions nvim/api_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ package main
// vim.c

// Exec executes Vimscript (multiline block of Ex-commands), like anonymous source.
// Exec executes Vimscript (multiline block of Ex-commands), like anonymous |:source|.
//
// Unlike Command, this function supports heredocs, script-scope (s:), etc.
//
Expand Down Expand Up @@ -322,7 +321,7 @@ func SetOption(name string, value interface{}) {
// If history is true, add to |message-history|.
//
// The opts arg is optional parameters. Reserved for future use.
func Echo(chunks []EchoChunk, history bool, opts map[string]interface{}) {
func Echo(chunks []TextChunk, history bool, opts map[string]interface{}) {
name(nvim_echo)
}

Expand Down Expand Up @@ -927,7 +926,7 @@ func BufferExtmarkByID(buffer Buffer, nsID, id int, opt map[string]interface{})
//
// details
// Whether to include the details dict. bool type.
func BufferExtmarks(buffer Buffer, nsID int, start, end interface{}, opt map[string]interface{}) (marks []ExtMarks) {
func BufferExtmarks(buffer Buffer, nsID int, start, end interface{}, opt map[string]interface{}) (marks []ExtMark) {
name(nvim_buf_get_extmarks)
}

Expand Down Expand Up @@ -958,7 +957,7 @@ func BufferExtmarks(buffer Buffer, nsID int, start, end interface{}, opt map[str
// Name ar ID of the highlight group used to highlight this mark. string or int type.
//
// virt_text
// virtual text to link to this mark. VirtualTextChunk type.
// virtual text to link to this mark. TextChunk type.
//
// ephemeral
// For use with SetDecorationProvider callbacks. bool type.
Expand Down Expand Up @@ -1039,7 +1038,7 @@ func ClearBufferHighlight(buffer Buffer, srcID, startLine, endLine int) {
// virtual text, the allocated id is then returned.
//
// The opts arg is reserved for future use.
func SetBufferVirtualText(buffer Buffer, nsID, line int, chunks []VirtualTextChunk, opts map[string]interface{}) (id int) {
func SetBufferVirtualText(buffer Buffer, nsID, line int, chunks []TextChunk, opts map[string]interface{}) (id int) {
name(nvim_buf_set_virtual_text)
}

Expand Down
2 changes: 1 addition & 1 deletion nvim/nvim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ func testVirtualText(v *Nvim) func(*testing.T) {
t.Fatal(err)
}

chunks := []VirtualTextChunk{
chunks := []TextChunk{
{
Text: "pong",
HLGroup: "String",
Expand Down
21 changes: 6 additions & 15 deletions nvim/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,21 +347,12 @@ type Command struct {
Definition string `msgpack:"definition"`
}

// VirtualTextChunk represents a virtual text chunk.
type VirtualTextChunk struct {
// Text is VirtualText text.
// TextChunk represents a text chunk.
type TextChunk struct {
// Text is text.
Text string `msgpack:",array"`

// HLGroup is VirtualText highlight group.
HLGroup string
}

// EchoChunk represents a echo chunk.
type EchoChunk struct {
// Text is echo text.
Text string `msgpack:",array"`

// HLGroup is echo highlight group.
// HLGroup is text highlight group.
HLGroup string
}

Expand Down Expand Up @@ -449,8 +440,8 @@ type WindowConfig struct {
Style string `msgpack:"style,omitempty"`
}

// ExtMarks represents a extmarks type.
type ExtMarks struct {
// ExtMark represents a extmarks type.
type ExtMark struct {
// ID is the extmarks ID.
ID int `msgpack:",array"`

Expand Down

0 comments on commit a45dcbd

Please sign in to comment.