我经历了[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的编辑器中获得单词Suggestion?提前致谢 .
1 回答
如果你're looking for content assist support, you should look at TypeFox' s monaco-languageclient项目 . 然后,您可以将Monaco编辑器与C#或Java语言服务器连接,以获取代码完成建议 .