Skip to content

Commit

Permalink
add detail
Browse files Browse the repository at this point in the history
Signed-off-by: Eric <[email protected]>
  • Loading branch information
mengweieric committed Aug 15, 2024
1 parent 8f7f782 commit fe6edfc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export interface QuerySuggestionGetFnArgs {

/** @public **/
export interface QuerySuggestionBasic {
type: QuerySuggestionTypes | monaco.languages.CompletionItemKind;
type: QuerySuggestionTypes;
description?: string | JSX.Element;
end: number;
start: number;
Expand All @@ -76,5 +76,15 @@ export interface QuerySuggestionField extends QuerySuggestionBasic {
field: IFieldType;
}

export interface SqlMonacoCompatibleQuerySuggestion
extends Pick<QuerySuggestionBasic, 'description' | 'insertText' | 'cursorIndex'> {
type: monaco.languages.CompletionItemKind;
text: string;
detail: string;
}

/** @public **/
export type QuerySuggestion = QuerySuggestionBasic | QuerySuggestionField;
export type QuerySuggestion =
| QuerySuggestionBasic
| QuerySuggestionField
| SqlMonacoCompatibleQuerySuggestion;
5 changes: 1 addition & 4 deletions src/plugins/data/public/ui/query_editor/query_editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ import { SimpleDataSet } from '../../../common';
import { createDQLEditor, createDefaultEditor } from './editors';
import { getQueryService, getIndexPatterns } from '../../services';

const LANGUAGE_ID_SQL = 'SQL';
monaco.languages.register({ id: LANGUAGE_ID_SQL });

const LANGUAGE_ID_KUERY = 'kuery';
monaco.languages.register({ id: LANGUAGE_ID_KUERY });

Expand Down Expand Up @@ -295,7 +292,7 @@ export default class QueryEditorUI extends Component<Props, State> {
kind: s.type as monaco.languages.CompletionItemKind,
insertText: s.insertText ?? s.text,
range,
detail: s.detail,
detail: 'detail' in s ? s.detail : '',
}))
: [],
incomplete: false,
Expand Down

0 comments on commit fe6edfc

Please sign in to comment.