feat: implement base autocomplete implementation for codemirror along with preRequest autocompletion

This commit is contained in:
Andrew Bastin
2021-09-07 22:12:38 +05:30
parent a5197ee544
commit d4d3d96bbb
4 changed files with 105 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
export type CompletionEntry = {
text: string
meta: string
score: number
}
export type CompleterResult = {
/**
* List of completions to display
*/
completions: CompletionEntry[]
/**
* Start of the completion position
* (on completion the start..end region is replaced)
*/
start: { line: number; ch: number }
/**
* End of the completion position
* (on completion the start..end region is replaced)
*/
end: { line: number; ch: number }
}
export type Completer = (
/**
* The contents of the editor
*/
text: string,
/**
* Position where the completer is fired
*/
completePos: { line: number; ch: number }
) => Promise<CompleterResult>