Integration of monaco-editor into angular application: monaco-editor@0.36.1, ngx-monaco-editor-v2@15.0.1

monaco-config.ts 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { NgxMonacoEditorConfig } from "ngx-monaco-editor-v2";
  2. export function onMonacoEditorLoad() {
  3. (window as any).monaco.languages.register({id:'java'});
  4. (window as any).monaco.languages.registerCompletionItemProvider('java',{
  5. providerCompletionItems:function(){
  6. var suggestions = [
  7. {
  8. label:'simpleText',
  9. kind: (window as any).monaco.languages.CompletionItemKind.Text,
  10. insertText: 'simpleText'
  11. },
  12. {
  13. label:'testing',
  14. kind: (window as any).monaco.languages.CompletionItemKind.Keyword,
  15. insertText: 'testing(${1:condition})',
  16. insertTextRules: (window as any).monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet
  17. },
  18. {
  19. label: 'ifelse',
  20. kind: (window as any).monaco.languages.CompletionItemKind.Snippet,
  21. insertTest: ['if (${1:condition}) {', '\t$0', '} else {', '\t', '}'].join('\n'),
  22. insertTextRules: (window as any).monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
  23. documentation: 'If-Else Statement'
  24. },
  25. ];
  26. return {suggestions: suggestions};
  27. }
  28. });
  29. }
  30. export const monacoConfig: NgxMonacoEditorConfig = {
  31. onMonacoLoad: onMonacoEditorLoad
  32. };

Powered by TurnKey Linux.