@finos/legend-code-editor
Version:
Legend shared advanced application components and building blocks
71 lines • 3.53 kB
TypeScript
/**
* Copyright (c) 2020-present, Goldman Sachs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { type DocumentationEntry } from '@finos/legend-shared';
import { type editor as monacoEditorAPI, languages as monacoLanguagesAPI, type IPosition } from 'monaco-editor';
/**
* This snippet suggestion is meant for an embedded content of an element
* In other words, it is used to construct element snippet suggestions
*
* Because of that, it is expected that there are text content wrapping around
* this snippet, so the first suggestion might not start from index 1.
*/
export interface ElementEmbeddedContentSnippetSuggestion {
/**
* Brief description about the suggestion item to enable the users to quickly
* differentiate between one suggestions from another
*/
description?: string | undefined;
/**
* The snippet text to be embedded in the full snippet suggestion text for the element
*
* NOTE: The snippet syntax follows that of `monaco-editor`
* See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets
*/
text: string;
}
/**
* This mirrors `monaco-editor` completion item structure
* See https://microsoft.github.io/monaco-editor/api/interfaces/monaco.languages.CompletionItem.html
*/
export interface PureGrammarTextSuggestion {
/**
* The text label of the suggestion.
*/
text: string;
/**
* Brief description about the suggestion item to enable the users to quickly
* differentiate between one suggestions from another
*/
description?: string | undefined;
/**
* Detailed documentation that explains/elaborates the suggestion item.
*/
documentation?: DocumentationEntry | undefined;
/**
* A string or snippet that should be inserted when selecting this suggestion.
*
* NOTE: The snippet syntax follows that of `monaco-editor`
* See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_create-your-own-snippets
*/
insertText: string;
}
export declare const getParserKeywordSuggestions: (position: IPosition, model: monacoEditorAPI.ITextModel, suggestions: PureGrammarTextSuggestion[]) => monacoLanguagesAPI.CompletionItem[];
export declare const getSectionParserNameFromLineText: (lineText: string) => string | undefined;
export declare const getParserElementSnippetSuggestions: (position: IPosition, model: monacoEditorAPI.ITextModel, suggestionsGetter: (parserName: string) => PureGrammarTextSuggestion[]) => monacoLanguagesAPI.CompletionItem[];
export declare const getInlineSnippetSuggestions: (position: IPosition, model: monacoEditorAPI.ITextModel, extraSnippetSuggestions?: PureGrammarTextSuggestion[]) => monacoLanguagesAPI.CompletionItem[];
export declare const isTokenOneOf: (token: string, baseTokens: string[], exact?: boolean) => boolean;
export declare const PURE_CODE_EDITOR_WORD_SEPARATORS = "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?";
//# sourceMappingURL=PureLanguageCodeEditorSupport.d.ts.map