feat: implement base autocomplete implementation for codemirror along with preRequest autocompletion
This commit is contained in:
33
helpers/editor/completion/index.ts
Normal file
33
helpers/editor/completion/index.ts
Normal 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>
|
||||
Reference in New Issue
Block a user