Skip to content

Update api #185

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@

Neovim/go-client is a [Neovim](https://neovim.io/) client for [Go](https://golang.org/).

Update API
----------

The API can be updated with the api tool.

```sh
cd nvim

# The compare command indicates what functions need to be changed. The results
# should be added to `api_def.go`.
go run api_tool.go -compare

# After applying the chages from compare to `api_def.go`, generate the `api.go`
# and `api_deprecated.go` files.
go generate
```

Release
-------

Expand Down
186 changes: 74 additions & 112 deletions nvim/api.go

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

27 changes: 27 additions & 0 deletions nvim/api_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ func DeleteTabpageVar(tabpage Tabpage, name string) {
name(nvim_tabpage_del_var)
}

// TabpageSetWindow sets the current window in a tabpage.
func TabpageSetWindow(tabpage Tabpage, win Window) {
name(nvim_tabpage_set_win)
}

// TabpageWindow gets the current window in a tabpage.
func TabpageWindow(tabpage Tabpage) Window {
name(nvim_tabpage_get_win)
Expand Down Expand Up @@ -951,33 +956,39 @@ func OptionInfo(name string, opts map[string]any) (opinfo OptionInfo) {
// SetOption sets an option value.
func SetOption(name string, value any) {
name(nvim_set_option)
deprecatedSince(11)
}

// Option gets an option value string.
func Option(name string) (option any) {
name(nvim_get_option)
deprecatedSince(11)
}

// BufferOption gets a buffer option value.
func BufferOption(buffer Buffer, name string) (value any) {
name(nvim_buf_get_option)
deprecatedSince(11)
}

// SetBufferOption sets a buffer option value.
//
// Passing nil as value arg to deletes the option (only works if there's a global fallback).
func SetBufferOption(buffer Buffer, name string, value any) {
name(nvim_buf_set_option)
deprecatedSince(11)
}

// WindowOption gets a window option value.
func WindowOption(window Window, name string) (value any) {
name(nvim_win_get_option)
deprecatedSince(11)
}

// SetWindowOption sets a window option value. Passing "nil" as value deletes the option(only works if there's a global fallback).
func SetWindowOption(window Window, name string, value any) {
name(nvim_win_set_option)
deprecatedSince(11)
}

// ui.c
Expand Down Expand Up @@ -1015,6 +1026,11 @@ func TryResizeUI(width, height int) {
name(nvim_ui_try_resize)
}

// UITermEvent sends a terminal event to the UI.
func UITermEvent(event string, value any) {
name(nvim_ui_term_event)
}

// SetUIOption sets a UI option.
func SetUIOption(name string, value any) {
name(nvim_ui_set_option)
Expand Down Expand Up @@ -1136,6 +1152,12 @@ func HLByName(name string, rgb bool) (highlight HLAttrs) {
deprecatedSince(9)
}

// GetHighlightNamespace gets highlight namespace.
func GetHighlightNamespace(opts map[string]any) (ns int) {
name(nvim_get_hl_ns)
}


// SetHighlight sets a highlight group.
//
// nsID is number of namespace for this highlight.
Expand Down Expand Up @@ -1904,6 +1926,11 @@ func SetWindowWidth(window Window, width int) {
name(nvim_win_set_width)
}

// WindowTextHeight calculates the height of window text.
func WindowTextHeight(window Window, opts map[string]any) (result map[string]any) {
name(nvim_win_text_height)
}

// WindowVar gets a window-scoped (w:) variable.
func WindowVar(window Window, name string) (value any) {
name(nvim_win_get_var)
Expand Down
Loading
Loading