摩纳哥编辑器+角度的,编辑器无法正确识别语言

时间:2018-06-25 16:03:48

标签: angular typescript monaco-editor

使用angular和monaco编辑器,并且从此angular组件创建的编辑器无法着色或完成Java中的“关键字”字词,例如int,double等。在这一点上,我已经尝试了很多事情,并且我想知道问题是否在于摩纳哥如何与棱角相互作用或什么。样式由于某种原因未更改。

declare var require: any;
import { NgModule, DoCheck } from '@angular/core';
import { Component, ViewChild, Input, ElementRef, ViewEncapsulation } from '@angular/core';
import * as monaco from 'monaco-editor';
import { CommonModule } from '@angular/common';
import 'script-loader!../../../../node_modules/monaco-editor/dev/vs/editor/editor.main';
import  {registerLanguage} from 'script-loader!../../../../node_modules/monaco-editor/dev/vs/basic-languages/_.contribution';
import {conf} from 'script-loader!../../../../node_modules/monaco-editor/dev/vs/basic-languages/java/java.js';


export class ZoeComponent implements IComponent {
  capabilities: Array<Capability>;
  element: HTMLElement;
  constructor(inputCapabilities: Array<Capability>, inputEl: HTMLElement) {
    this.element = inputEl;
    this.capabilities = inputCapabilities.slice(0);
  }
  getDOMElement(): HTMLElement {
    return this.element;
  }
  getCapabilities(): Capability[] {
    return this.capabilities;
  }
}

@Component({
  selector: 'zlux-editor-window',
  templateUrl: 'zlux-editor-window.component.html',
  encapsulation: ViewEncapsulation.None,
  styleUrls: ['zlux-editor-window.component.css',
    '../../../../node_modules/monaco-editor/dev/vs/editor/editor.main.css']
})
export class ZluxEditorWindowComponent implements ComponentFactory {
  @ViewChild('editor') editorContent: ElementRef;
  editorEle: HTMLElement;
  componentClass: ComponentClass;
  capabilities: Array<Capability>;
  inputContents: fileContents = { filePath: '/u/ts6223/', fileName: 'hello.txt', fileContents: ['hi', "i'm", "right here!"] };

  constructor() {
    this.componentClass = ComponentClass.CodeEditor;
  }
  ngAfterViewInit() {

    var onGotAmdLoader = () => {

        this.initMonaco(this.inputContents.fileContents);

    };
    onGotAmdLoader();



  }
  initMonaco(inputContents: Array<string>) {
    this.editorEle = this.editorContent.nativeElement;
    let x =monaco.editor.create(this.editorEle, {
      value: inputContents
        .join('\n'),
      language: 'java',
      quickSuggestions: { other: true, comments: true, strings: true }


    }).layout({ width: 500, height: 800 });
  }
}

@NgModule({
  declarations: [ZluxEditorWindowComponent],
  imports: [CommonModule],
  exports: [ZluxEditorWindowComponent],
  entryComponents: [ZluxEditorWindowComponent]
})
export class ZluxEditorWindowModule { }

摩纳哥地区似乎有什么不正常的地方?

-

0 个答案:

没有答案