【发布时间】:2018-10-04 16:51:35
【问题描述】:
我浏览了 [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 和 cSharp 的编辑器中获得单词建议? 提前致谢。
【问题讨论】:
标签: typescript visual-studio-code angular5 monaco-editor