Skip to content

Commit a45dcbd

Browse files
authored
nvim: rename some type names (#105)
* 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
1 parent c757fcd commit a45dcbd

File tree

4 files changed

+19
-31
lines changed

4 files changed

+19
-31
lines changed

nvim/api.go

+8-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nvim/api_def.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ package main
1414
// vim.c
1515

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

@@ -927,7 +926,7 @@ func BufferExtmarkByID(buffer Buffer, nsID, id int, opt map[string]interface{})
927926
//
928927
// details
929928
// Whether to include the details dict. bool type.
930-
func BufferExtmarks(buffer Buffer, nsID int, start, end interface{}, opt map[string]interface{}) (marks []ExtMarks) {
929+
func BufferExtmarks(buffer Buffer, nsID int, start, end interface{}, opt map[string]interface{}) (marks []ExtMark) {
931930
name(nvim_buf_get_extmarks)
932931
}
933932

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

nvim/nvim_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1466,7 +1466,7 @@ func testVirtualText(v *Nvim) func(*testing.T) {
14661466
t.Fatal(err)
14671467
}
14681468

1469-
chunks := []VirtualTextChunk{
1469+
chunks := []TextChunk{
14701470
{
14711471
Text: "pong",
14721472
HLGroup: "String",

nvim/types.go

+6-15
Original file line numberDiff line numberDiff line change
@@ -347,21 +347,12 @@ type Command struct {
347347
Definition string `msgpack:"definition"`
348348
}
349349

350-
// VirtualTextChunk represents a virtual text chunk.
351-
type VirtualTextChunk struct {
352-
// Text is VirtualText text.
350+
// TextChunk represents a text chunk.
351+
type TextChunk struct {
352+
// Text is text.
353353
Text string `msgpack:",array"`
354354

355-
// HLGroup is VirtualText highlight group.
356-
HLGroup string
357-
}
358-
359-
// EchoChunk represents a echo chunk.
360-
type EchoChunk struct {
361-
// Text is echo text.
362-
Text string `msgpack:",array"`
363-
364-
// HLGroup is echo highlight group.
355+
// HLGroup is text highlight group.
365356
HLGroup string
366357
}
367358

@@ -449,8 +440,8 @@ type WindowConfig struct {
449440
Style string `msgpack:"style,omitempty"`
450441
}
451442

452-
// ExtMarks represents a extmarks type.
453-
type ExtMarks struct {
443+
// ExtMark represents a extmarks type.
444+
type ExtMark struct {
454445
// ID is the extmarks ID.
455446
ID int `msgpack:",array"`
456447

0 commit comments

Comments
 (0)