ngx-monaco-editor没有显示任何建议

时间:2018-04-24 12:17:36

标签: typescript visual-studio-code angular5 monaco-editor

我浏览了[ngx-monaco-editor]:https://github.com/atularen/ngx-monaco-editor

克隆项目&定制相同 - Word建议只适用于Css& JavaScript语言,因为它们是默认的。但是要求是Java,Csharp编辑器。

Html代码 -

<ngx-monaco-editor [options]="options" [(ngModel)]="displaycode" (onInit)="onInit($event)"></ngx-monaco-editor>

TypeScript代码 -

options = {theme: 'vs-dark'};
onInit(editor) {
  this.editor = editor;
}

我试过

1) options = {theme: 'vs',quickSuggestions: true,wordBasedSuggestions: true};

2) Inside ngOnInit function:

this.options = Object.assign({}, this.options, {theme: 'vs',language: java});
Theme changes are reflecting & if i debug language is updated in options.

3)  updateOptions() {
     this.toggleLanguage = !this.toggleLanguage;
     if (this.toggleLanguage) {
           this.code = this.javaCode;
           this.options = Object.assign({}, this.options, { language: 'java' });
     } else {
          this.code = this.cSharpCode;
          this.options = Object.assign({}, this.options, { language: 'csharp' });
     }

Image of editor showing - no Suggestions

我经历了像https://github.com/Microsoft/monaco-editor/issues/632这样的github链接,但没有找到任何帮助

我怎样才能在Java&amp;编辑器中找到建议。 cSharp? 提前谢谢。

1 个答案:

答案 0 :(得分:0)

如果您正在寻找内容辅助支持,则应该查看TypeFox的monaco-languageclient项目。然后,您可以将Monaco编辑器与C#或Java语言服务器连接,以获取代码完成建议。