mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* migrate experimental to core grafana - update refs Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
27 lines
882 B
TypeScript
27 lines
882 B
TypeScript
import { monacoTypes } from '@grafana/ui';
|
|
|
|
// Stub for the Monaco instance. Only implements the parts that are used in cloudwatch sql
|
|
const getMonacoMock: (
|
|
testData: Map<string, Array<Array<Pick<monacoTypes.Token, 'language' | 'offset' | 'type'>>>>
|
|
) => any = (testData) => ({
|
|
editor: {
|
|
tokenize: (value: string, languageId: string) => testData.get(value),
|
|
},
|
|
Range: {
|
|
containsPosition: (range: monacoTypes.IRange, position: monacoTypes.IPosition) => {
|
|
return (
|
|
position.lineNumber >= range.startLineNumber &&
|
|
position.lineNumber <= range.endLineNumber &&
|
|
position.column >= range.startColumn &&
|
|
position.column <= range.endColumn
|
|
);
|
|
},
|
|
},
|
|
languages: {
|
|
CompletionItemKind: { Snippet: 2, Function: 1, Keyword: 3 },
|
|
CompletionItemInsertTextRule: { InsertAsSnippet: 2 },
|
|
},
|
|
});
|
|
|
|
export { getMonacoMock };
|