Skip to content

Commit 23ee309

Browse files
authored
nvim: support v0.9.1 APIs (#156)
* 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 <[email protected]>
1 parent b71b04c commit 23ee309

File tree

8 files changed

+378
-263
lines changed

8 files changed

+378
-263
lines changed

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
uses: rhysd/action-setup-vim@v1
3535
with:
3636
neovim: true
37-
version: v0.8.3
37+
version: v0.9.1
3838

3939
- name: Run Benchmark
4040
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- 1.19.x
2929
- 1.20.x
3030
neovim-version:
31-
- v0.8.3
31+
- v0.9.1
3232
- nightly
3333
fail-fast: false
3434

nvim/api.go

Lines changed: 54 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nvim/api_def.go

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,8 @@ func AllOptionsInfo() (opinfo OptionInfo) {
951951
// flaglist
952952
//
953953
// List of single char flags.
954-
func OptionInfo(name string) (opinfo OptionInfo) {
955-
name(nvim_get_option_info)
954+
func OptionInfo(name string, opts map[string]interface{}) (opinfo OptionInfo) {
955+
name(nvim_get_option_info2)
956956
returnPtr()
957957
}
958958

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

1010+
// SetFocusUI tells the nvim server if focus was gained or lost by the GUI.
1011+
func SetFocusUI(gained bool) {
1012+
name(nvim_ui_set_focus)
1013+
}
1014+
10101015
// DetachUI unregisters the client as a remote UI.
10111016
func DetachUI() {
10121017
name(nvim_ui_detach)
@@ -1060,8 +1065,8 @@ func SetPumBounds(width, height, row, col float64) {
10601065
// Unlike Command, this function supports heredocs, script-scope (s:), etc.
10611066
//
10621067
// When fails with VimL error, does not update "v:errmsg".
1063-
func Exec(src string, output bool) (out string) {
1064-
name(nvim_exec)
1068+
func Exec(src string, opts map[string]interface{}) (out map[string]interface{}) {
1069+
name(nvim_exec2)
10651070
}
10661071

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

10791084
// vim.c
10801085

1086+
// HL gets a highlight definition by name.
1087+
//
1088+
// nsID get highlight groups for namespace ns_id [Namespaces]. Use 0 to get global highlight groups |:highlight|.
1089+
//
1090+
// opts dict:
1091+
//
1092+
// name
1093+
//
1094+
// Get a highlight definition by name.
1095+
//
1096+
// id
1097+
//
1098+
// Get a highlight definition by id.
1099+
//
1100+
// link
1101+
//
1102+
// Show linked group name instead of effective definition.
1103+
//
1104+
// 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.
1105+
func HL(nsID int, opts map[string]interface{}) (highlight HLAttrs) {
1106+
name(nvim_get_hl)
1107+
returnPtr()
1108+
}
1109+
10811110
// HLByID gets a highlight definition by name.
10821111
//
10831112
// hlID is the highlight id as returned by HLIDByName.
@@ -1088,6 +1117,7 @@ func ParseExpression(expr, flags string, highlight bool) (expression map[string]
10881117
func HLByID(hlID int, rgb bool) (highlight HLAttrs) {
10891118
name(nvim_get_hl_by_id)
10901119
returnPtr()
1120+
deprecatedSince(9)
10911121
}
10921122

10931123
// HLIDByName gets a highlight group by name.
@@ -1111,6 +1141,7 @@ func HLIDByName(name string) (hlID int) {
11111141
func HLByName(name string, rgb bool) (highlight HLAttrs) {
11121142
name(nvim_get_hl_by_name)
11131143
returnPtr()
1144+
deprecatedSince(9)
11141145
}
11151146

11161147
// SetHighlight sets a highlight group.

nvim/api_deprecated.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)