How to use the monaco-editor/esm/vs/editor/editor.api.js.languages function in monaco-editor

To help you get started, we’ve selected a few monaco-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mermaid-js / mermaid-live-editor / src / editor.js View on Github external
// import 'monaco-editor/esm/vs/basic-languages/redis/redis.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/redshift/redshift.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/ruby/ruby.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/sb/sb.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/scss/scss.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/solidity/solidity.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/sql/sql.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/swift/swift.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/vb/vb.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/xml/xml.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution.js';
// import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
// import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';


monaco.languages.register({ id: 'mermaid' });

// Register a tokens provider for the language
monaco.languages.setMonarchTokensProvider('mermaid', {
	tokenizer: {
		root: [
			[/\[graph.*/, "custom-error"],
			[/\[notice.*/, "custom-notice"],
			[/\[info.*/, "custom-info"],
			[/\[[a-zA-Z 0-9:]+\]/, "custom-date"],
		]
	}
});


self.MonacoEnvironment = {
	getWorkerUrl: function (moduleId, label) {
github mlajtos / L1 / src / components / MonacoEditor / index.js View on Github external
const theme = {
    base: "vs",
    inherit: true,
    rules: [
        { token: "operator", foreground: "ff0000" },
        { token: "identifier", foreground: "3b8e23" },
        { token: "symbol", foreground: "327a1f" },
        { token: "type.identifier", foreground: "1459a9" },
        { token: "number", foreground: "b1871b" },
        { token: "string", foreground: "c225ca" },
        { token: "comment", foreground: "73c0e2" },
    ]
}

monaco.languages.register(language)
monaco.languages.setLanguageConfiguration(languageName, languageConfiguration)
monaco.editor.defineTheme(languageName, theme)
monaco.languages.setMonarchTokensProvider(languageName, provider)

const functions = ["Shape", "Rank", "Min", "Max", "RankUp", "Transpose", "RandomNormal", "RandomUniform"]

monaco.languages.registerCompletionItemProvider(languageName, {
    provideCompletionItems: () => {
        return [
            ...(functions.map(label => ({
                label,
                kind: monaco.languages.CompletionItemKind.Function,
                documentation: "mu"
            }))),
            {
                label: 'ifelse',
github agneym / json-formatter / src / utils / editor-actions.js View on Github external
const updateJsonOptions = options => {
    if (!editor) {
      return;
    }
    monaco.languages.json.jsonDefaults.setDiagnosticsOptions(options);
  };
github mlajtos / L1 / src / components / MonacoEditor / index.js View on Github external
{ token: "symbol", foreground: "327a1f" },
        { token: "type.identifier", foreground: "1459a9" },
        { token: "number", foreground: "b1871b" },
        { token: "string", foreground: "c225ca" },
        { token: "comment", foreground: "73c0e2" },
    ]
}

monaco.languages.register(language)
monaco.languages.setLanguageConfiguration(languageName, languageConfiguration)
monaco.editor.defineTheme(languageName, theme)
monaco.languages.setMonarchTokensProvider(languageName, provider)

const functions = ["Shape", "Rank", "Min", "Max", "RankUp", "Transpose", "RandomNormal", "RandomUniform"]

monaco.languages.registerCompletionItemProvider(languageName, {
    provideCompletionItems: () => {
        return [
            ...(functions.map(label => ({
                label,
                kind: monaco.languages.CompletionItemKind.Function,
                documentation: "mu"
            }))),
            {
                label: 'ifelse',
                kind: monaco.languages.CompletionItemKind.Snippet,
                insertText: {
                    value: [
                        'if (${1:condition}) {',
                        '\t$0',
                        '} else {',
                        '\t',
github mermaid-js / mermaid-live-editor / src / editor.js View on Github external
provideCompletionItems: () => {
		var suggestions = [{
			label: 'simpleText',
			kind: monaco.languages.CompletionItemKind.Text,
			insertText: 'simpleText'
		}, {
			label: 'testing',
			kind: monaco.languages.CompletionItemKind.Keyword,
			insertText: 'testing(${1:condition})',
			insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
		}, {
			label: 'ifelse',
			kind: monaco.languages.CompletionItemKind.Snippet,
			insertText: [
				'if (${1:condition}) {',
				'\t$0',
				'} else {',
				'\t',
				'}'
			].join('\n'),
			insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
			documentation: 'If-Else Statement'
		}];
		return { suggestions: suggestions };
github elastic / kibana / x-pack / legacy / plugins / code / public / monaco / monaco.ts View on Github external
{ token: '', foreground: syntaxTheme.foreground },
  ],
  colors: {
    'editor.foreground': syntaxTheme.foreground,
    'editor.background': syntaxTheme.editorBackground,
    'editorLineNumber.foreground': syntaxTheme.lineNumbers,
    'editorLineNumber.activeForeground': syntaxTheme.lineNumbers,
    'editorIndentGuide.background': syntaxTheme.editorIndentGuide,
    'editor.selectionBackground': syntaxTheme.selectionBackground,
    'editorWidget.border': syntaxTheme.editorWidgetBorder,
    'editorWidget.background': syntaxTheme.editorWidgetBackground,
  },
});
monaco.editor.setTheme('euiColors');

monaco.languages.registerDefinitionProvider('java', definitionProvider);
monaco.languages.registerDefinitionProvider('typescript', definitionProvider);
monaco.languages.registerDefinitionProvider('javascript', definitionProvider);
if (chrome.getInjected('enableLangserversDeveloping', false) === true) {
  monaco.languages.registerDefinitionProvider('go', definitionProvider);
}
CTAGS_SUPPORT_LANGS.forEach(language =>
  monaco.languages.registerDefinitionProvider(language, definitionProvider)
);

export { monaco };
github elastic / kibana / x-pack / legacy / plugins / code / public / monaco / monaco.ts View on Github external
CTAGS_SUPPORT_LANGS.forEach(language =>
  monaco.languages.registerDefinitionProvider(language, definitionProvider)
);