1
votes

I went through [ngx-monaco-editor]: https://github.com/atularen/ngx-monaco-editor

Cloned the project & customizing the same - Word Suggestions are coming only for Css & JavaScript languages as they are default.But requirement is Java,Csharp editors.

Html code -

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

TypeScript code -

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

I tried

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

i went through github links like https://github.com/Microsoft/monaco-editor/issues/632, but didn't find any help

How can i get word Suggestion working in the editor for Java & cSharp ? Thanks in advance.

1

1 Answers

0
votes

If you're looking for content assist support, you should look at TypeFox's monaco-languageclient project. You can then connect your Monaco editor with a C# or Java language server to get code completion suggestions.