|
1 | 1 | import {continuedIndent, indentNodeProp, foldNodeProp, LRLanguage, LanguageSupport} from "@codemirror/language" |
2 | 2 | import {Extension} from "@codemirror/state" |
3 | | -import {Completion, CompletionSource} from "@codemirror/autocomplete" |
| 3 | +import {Completion, CompletionSection, CompletionSource} from "@codemirror/autocomplete" |
4 | 4 | import {styleTags, tags as t} from "@lezer/highlight" |
5 | 5 | import {parser as baseParser} from "./sql.grammar" |
6 | 6 | import {tokens, Dialect, tokensFor, SQLKeywords, SQLTypes, dialect} from "./tokens" |
@@ -150,19 +150,19 @@ export interface SQLConfig { |
150 | 150 | /// When set to true, keyword completions will be upper-case. |
151 | 151 | upperCaseKeywords?: boolean, |
152 | 152 | /// When given, keyword completions will be placed in this section. |
153 | | - keywordsSection?: string, |
| 153 | + keywordsSection?: string | CompletionSection, |
154 | 154 | /// When given, keyword completions will be mapped using this function. |
155 | 155 | keywordsMapper?: (keywords: Completion[]) => Completion[] |
156 | 156 | } |
157 | 157 |
|
158 | 158 | /// Returns a completion source that provides keyword completion for |
159 | 159 | /// the given SQL dialect. |
160 | | -export function keywordCompletionSource(dialect: SQLDialect, upperCase = false, section?: string, mapper?: (keywords: Completion[]) => Completion[]): CompletionSource { |
| 160 | +export function keywordCompletionSource(dialect: SQLDialect, upperCase = false, section?: string | CompletionSection, mapper?: (keywords: Completion[]) => Completion[]): CompletionSource { |
161 | 161 | return completeKeywords(dialect.dialect.words, upperCase, section, mapper) |
162 | 162 | } |
163 | 163 |
|
164 | 164 | /// FIXME remove on 1.0 @internal |
165 | | -export function keywordCompletion(dialect: SQLDialect, upperCase = false, section?: string, mapper?: (keywords: Completion[]) => Completion[]): Extension { |
| 165 | +export function keywordCompletion(dialect: SQLDialect, upperCase = false, section?: string | CompletionSection, mapper?: (keywords: Completion[]) => Completion[]): Extension { |
166 | 166 | return dialect.language.data.of({ |
167 | 167 | autocomplete: keywordCompletionSource(dialect, upperCase, section, mapper) |
168 | 168 | }) |
|
0 commit comments