1234567891011121314151617181920212223242526272829303132333435363738 |
- import { NgxMonacoEditorConfig } from "ngx-monaco-editor-v2";
-
- export function onMonacoEditorLoad() {
-
- (window as any).monaco.languages.register({id:'java'});
-
- (window as any).monaco.languages.registerCompletionItemProvider('java',{
-
- providerCompletionItems:function(){
- var suggestions = [
- {
- label:'simpleText',
- kind: (window as any).monaco.languages.CompletionItemKind.Text,
- insertText: 'simpleText'
- },
- {
- label:'testing',
- kind: (window as any).monaco.languages.CompletionItemKind.Keyword,
- insertText: 'testing(${1:condition})',
- insertTextRules: (window as any).monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
- },
- {
- label: 'ifelse',
- kind: (window as any).monaco.languages.CompletionItemKind.Snippet,
- insertTest: ['if (${1:condition}) {', '\t$0', '} else {', '\t', '}'].join('\n'),
- insertTextRules: (window as any).monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
- documentation: 'If-Else Statement'
- },
- ];
- return {suggestions: suggestions};
- }
- });
-
- }
-
- export const monacoConfig: NgxMonacoEditorConfig = {
- onMonacoLoad: onMonacoEditorLoad
- };
|