Skip to content

Support neovim/neovim@a225374 api #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Apr 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
35716b2
nvim: add map[string]int to Dictionary for ColorMap
zchee Aug 5, 2018
1a23e03
nvim: support neovim/neovim@a225374 api
zchee Aug 5, 2018
85f3eec
nvim: go generate
zchee Aug 5, 2018
f960998
nvim: add CallDict(nvim_call_dict_function)
zchee Aug 5, 2018
5f95f94
nvim: fix typo
zchee Aug 5, 2018
2e83092
nvim: trim 'List' prefix and Channels returns the pointer slice
zchee Aug 5, 2018
0d87f45
nvim: add Process and UI struct
zchee Aug 5, 2018
dea6f4c
nvim: change UIs and Proc(Children) return type to correspond type
zchee Aug 5, 2018
cf564a6
nvim: go generate
zchee Aug 5, 2018
0c7ac61
nvim: change ChannelInfo return type to pointer
zchee Aug 28, 2018
87af94e
nvim: change Channel to pointer on nvimTypes map
zchee Aug 28, 2018
8206bdf
nvim: go generate
zchee Aug 28, 2018
33382bc
nvim: implements Client struct
zchee Aug 28, 2018
ef3c0b7
nvim: add godoc comment to Channel and Process struct
zchee Aug 28, 2018
4ae47cc
nvim: split additional struct types to types.go
zchee Aug 28, 2018
c13a168
nvim/apitool: add some C type to nvimTypes map
zchee Sep 12, 2018
ea2d236
nvim: add Version,ClientType,Methods,Attributes and Client for Channel
zchee Dec 1, 2018
606b164
nvim: go generate
zchee Dec 1, 2018
2c7dd6c
nvim: add Command type and fix {Buffer}Commands return map type
zchee Mar 4, 2019
d1b7993
nvim: go generate
zchee Mar 4, 2019
44b42c1
nvim: change Version type to struct instead of map
zchee Mar 4, 2019
060a4c2
nvim: `map[string]*Command` type to Dictionary
zchee Mar 9, 2019
12eff30
nvim: fix SetClientInfo arguments type
zchee Mar 26, 2019
1e4b674
nvim: re-implements several types for SetClientInfo function
zchee Mar 26, 2019
272d59a
nvim: go generate
zchee Mar 26, 2019
92cba7f
nvim: fix Version.Major msgpack struct tag
zchee Mar 26, 2019
8525170
nvim: increase LICENSE Year
zchee Mar 26, 2019
c23f16a
nvim: rename some Client related type name to add `Client` prefix
zchee Apr 21, 2019
12a1e2e
nvim: go generate
zchee Apr 21, 2019
abf9cd9
nvim: add some godoc comment and format
zchee Apr 21, 2019
da61368
nvim: fix spell "Deprecated: Use etc" consistently
zchee Apr 21, 2019
c8e9cd2
nvim: go generate
zchee Apr 21, 2019
06d42d7
nvim: gofmt
zchee Apr 21, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion nvim/apidef.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ func BufferLines(buffer Buffer, start int, end int, strict bool) [][]byte {
name(nvim_buf_get_lines)
}

// AttachBuffer activate updates from this buffer to the current channel.
//
// If sendBuffer is true, initial notification should contain the whole buffer.
// If false, the first notification will be a `nvim_buf_lines_event`.
// Otherwise, the first notification will be a `nvim_buf_changedtick_event`
//
// opts is optional parameters. Currently not used.
//
// returns whether the updates couldn't be enabled because the buffer isn't loaded or opts contained an invalid key.
func AttachBuffer(buffer Buffer, sendBuffer bool, opts map[string]interface{}) bool {
name(nvim_buf_attach)
}

// DetachBuffer deactivate updates from this buffer to the current channel.
//
// returns whether the updates couldn't be disabled because the buffer isn't loaded.
func DetachBuffer(buffer Buffer) bool {
name(nvim_buf_detach)
}

// SetBufferLines replaces a line range on a buffer.
//
// Indexing is zero-based, end-exclusive. Negative indices are interpreted as
Expand Down Expand Up @@ -72,6 +92,13 @@ func BufferKeyMap(buffer Buffer, mode string) []*Mapping {
name(nvim_buf_get_keymap)
}

// BufferCommands gets a map of buffer-local user-commands.
//
// opts is optional parameters. Currently not used.
func BufferCommands(buffer Buffer, opts map[string]interface{}) map[string]*Command {
name(nvim_buf_get_commands)
}

// SetBufferVar sets a buffer-scoped (b:) variable.
func SetBufferVar(buffer Buffer, name string, value interface{}) {
name(nvim_buf_set_var)
Expand All @@ -95,7 +122,7 @@ func SetBufferOption(buffer Buffer, name string, value interface{}) {

// BufferNumber gets a buffer's number.
//
// Deprecated: use int(buffer) to get the buffer's number as an integer.
// Deprecated: Use int(buffer) to get the buffer's number as an integer.
func BufferNumber(buffer Buffer) int {
name(nvim_buf_get_number)
deprecatedSince(2)
Expand All @@ -112,6 +139,12 @@ func SetBufferName(buffer Buffer, name string) {
name(nvim_buf_set_name)
}

// IsBufferLoaded Checks if a buffer is valid and loaded.
// See api-buffer for more info about unloaded buffers.
func IsBufferLoaded(buffer Buffer) bool {
name(nvim_buf_is_loaded)
}

// IsBufferValid returns true if the buffer is valid.
func IsBufferValid(buffer Buffer) bool {
name(nvim_buf_is_valid)
Expand Down Expand Up @@ -441,10 +474,56 @@ func KeyMap(mode string) []*Mapping {
name(nvim_get_keymap)
}

// Commands gets a map of global (non-buffer-local) Ex commands.
// Currently only user-commands are supported, not builtin Ex commands.
//
// opts is optional parameters. Currently only supports {"builtin":false}.
func Commands(opts map[string]interface{}) map[string]*Command {
name(nvim_get_commands)
}

func APIInfo() []interface{} {
name(nvim_get_api_info)
}

// SetClientInfo identify the client for nvim.
//
// Can be called more than once, but subsequent calls will remove earlier info, which should be resent if it is still valid.
// (This could happen if a library first identifies the channel, and a plugin using that library later overrides that info)
func SetClientInfo(name string, version *ClientVersion, typ string, methods map[string]*ClientMethod, attributes ClientAttributes) {
name(nvim_set_client_info)
}

// ChannelInfo get information about a channel.
func ChannelInfo(channel int) *Channel {
name(nvim_get_chan_info)
}

// Channels get information about all open channels.
func Channels() []*Channel {
name(nvim_list_chans)
}

// ParseExpression parse a VimL expression.
func ParseExpression(expr string, flags string, highlight bool) map[string]interface{} {
name(nvim_parse_expression)
}

// UIs gets a list of dictionaries representing attached UIs.
func UIs() []*UI {
name(nvim_list_uis)
}

// ProcChildren gets the immediate children of process `pid`.
func ProcChildren(pid int) []*Process {
name(nvim_get_proc_children)
}

// Proc gets info describing process `pid`.
func Proc(pid int) Process {
name(nvim_get_proc)
}

// WindowBuffer returns the current buffer in a window.
func WindowBuffer(window Window) Buffer {
name(nvim_win_get_buf)
Expand Down
184 changes: 182 additions & 2 deletions nvim/apiimp.go

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

17 changes: 14 additions & 3 deletions nvim/apitool.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,14 @@ var nvimTypes = map[string]string{
"int": "Integer",
"interface{}": "Object",
"string": "String",
"Process": "Object",

"map[string]interface{}": "Dictionary",
"map[string]int": "Dictionary",
"map[string]*Command": "Dictionary",
"*ClientVersion": "Dictionary",
"ClientMethods": "Dictionary",
"ClientAttributes": "Dictionary",

"[2]int": "ArrayOf(Integer, 2)",
"[]Buffer": "ArrayOf(Buffer)",
Expand All @@ -317,7 +323,11 @@ var nvimTypes = map[string]string{

"Mode": "Dictionary",
"*HLAttrs": "Dictionary",
"*Channel": "Dictionary",
"[]*Channel": "Array",
"[]*Mapping": "ArrayOf(Dictionary)",
"[]*Process": "Array",
"[]*UI": "Array",
}

func convertToNvimTypes(f *Function) *Function {
Expand Down Expand Up @@ -351,9 +361,10 @@ var compareTemplate = template.Must(template.New("").Funcs(template.FuncMap{

// specialAPIs lists API calls that are implemented by hand.
var specialAPIs = map[string]bool{
"nvim_call_atomic": true,
"nvim_call_function": true,
"nvim_execute_lua": true,
"nvim_call_atomic": true,
"nvim_call_function": true,
"nvim_call_dict_function": true,
"nvim_execute_lua": true,
}

func compareFunctions(functions []*Function) error {
Expand Down
Loading