-
-
Notifications
You must be signed in to change notification settings - Fork 959
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(completion): source using vim9script module
Related #5263
- Loading branch information
Showing
9 changed files
with
84 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,23 @@ folder. With code: | |
`init` and `complete` are required functions for vim sources, error message | ||
will be shown when not exists. | ||
|
||
vim9script can be also used on vim9 (not supported on neovim), the function | ||
first letter need to be uppercased, like: | ||
> | ||
vim9script | ||
export def Init(): dict<any> | ||
return { | ||
priority: 9, | ||
shortcut: 'Email', | ||
triggerCharacters: ['@'] | ||
} | ||
enddef | ||
export def Complete(option: dict<any>, Callback: func(list<any>)) | ||
const items = ['[email protected]', '[email protected]'] | ||
Callback(items) | ||
enddef | ||
< | ||
Source option: ~ | ||
|
||
The source option object is returned by `coc#source#{name}#init` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
vim9script | ||
export def Init(): dict<any> | ||
return { | ||
priority: 9, | ||
shortcut: 'Email', | ||
triggerCharacters: ['@'] | ||
} | ||
enddef | ||
|
||
export def Complete(option: dict<any>, Callback: func(list<any>)) | ||
const items = ['[email protected]', '[email protected]'] | ||
Callback(items) | ||
enddef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters