Skip to content

Commit

Permalink
nvim: support v0.9.1 APIs (#156)
Browse files Browse the repository at this point in the history
* github/workflows: update nvim version to v0.9.1

* nvim: add alias of Cmd to Dictionary

* nvim: add deprecatedSince to some APIs and fix Exec args

* nvim: go generate

* nvim: support v0.9.1 APIs

* nvim: go generate

* nvim: fix Exec args on testcases

* nvim: add HL testcase to testHighlight

* nvim: add SetFocusUI testcase

* nvim: add ColorByName testcase

---------

Signed-off-by: Koichi Shiraishi <zchee.io@gmail.com>
  • Loading branch information
zchee committed Jun 19, 2023
1 parent b71b04c commit 23ee309
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
uses: rhysd/action-setup-vim@v1
with:
neovim: true
version: v0.8.3
version: v0.9.1

- name: Run Benchmark
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- 1.19.x
- 1.20.x
neovim-version:
- v0.8.3
- v0.9.1
- nightly
fail-fast: false

Expand Down
98 changes: 54 additions & 44 deletions nvim/api.go

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

39 changes: 35 additions & 4 deletions nvim/api_def.go
Original file line number Diff line number Diff line change
Expand Up @@ -951,8 +951,8 @@ func AllOptionsInfo() (opinfo OptionInfo) {
// flaglist
//
// List of single char flags.
func OptionInfo(name string) (opinfo OptionInfo) {
name(nvim_get_option_info)
func OptionInfo(name string, opts map[string]interface{}) (opinfo OptionInfo) {
name(nvim_get_option_info2)
returnPtr()
}

Expand Down Expand Up @@ -1007,6 +1007,11 @@ func AttachUI(width, height int, options map[string]interface{}) {
name(nvim_ui_attach)
}

// SetFocusUI tells the nvim server if focus was gained or lost by the GUI.
func SetFocusUI(gained bool) {
name(nvim_ui_set_focus)
}

// DetachUI unregisters the client as a remote UI.
func DetachUI() {
name(nvim_ui_detach)
Expand Down Expand Up @@ -1060,8 +1065,8 @@ func SetPumBounds(width, height, row, col float64) {
// Unlike Command, this function supports heredocs, script-scope (s:), etc.
//
// When fails with VimL error, does not update "v:errmsg".
func Exec(src string, output bool) (out string) {
name(nvim_exec)
func Exec(src string, opts map[string]interface{}) (out map[string]interface{}) {
name(nvim_exec2)
}

// Command executes an ex-command.
Expand All @@ -1078,6 +1083,30 @@ func ParseExpression(expr, flags string, highlight bool) (expression map[string]

// vim.c

// HL gets a highlight definition by name.
//
// nsID get highlight groups for namespace ns_id [Namespaces]. Use 0 to get global highlight groups |:highlight|.
//
// opts dict:
//
// name
//
// Get a highlight definition by name.
//
// id
//
// Get a highlight definition by id.
//
// link
//
// Show linked group name instead of effective definition.
//
// The returned HLAttrs highlight groups as a map from group name to a highlight definition map as in SetHighlight, or only a single highlight definition map if requested by name or id.
func HL(nsID int, opts map[string]interface{}) (highlight HLAttrs) {
name(nvim_get_hl)
returnPtr()
}

// HLByID gets a highlight definition by name.
//
// hlID is the highlight id as returned by HLIDByName.
Expand All @@ -1088,6 +1117,7 @@ func ParseExpression(expr, flags string, highlight bool) (expression map[string]
func HLByID(hlID int, rgb bool) (highlight HLAttrs) {
name(nvim_get_hl_by_id)
returnPtr()
deprecatedSince(9)
}

// HLIDByName gets a highlight group by name.
Expand All @@ -1111,6 +1141,7 @@ func HLIDByName(name string) (hlID int) {
func HLByName(name string, rgb bool) (highlight HLAttrs) {
name(nvim_get_hl_by_name)
returnPtr()
deprecatedSince(9)
}

// SetHighlight sets a highlight group.
Expand Down
48 changes: 48 additions & 0 deletions nvim/api_deprecated.go

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

Loading

0 comments on commit 23ee309

Please sign in to comment.