Ich benutze ace editor und versuche, Auto-Vervollständigung im Editor zu erreichen. Ich habe versucht mit Optionen, aber es funktioniert nicht und ich bekomme Warnungen. Irgendeine Idee?Ace Editor automatische Vervollständigung in Angular 2?
Ace Editorkomponente
import {
Component, EventEmitter, Input, OnInit, Output, ViewChild
} from '@angular/core';
@Component({
selector: 'neon-ace-editor',
templateUrl: './ace-editor.component.html',
styleUrls: ['./ace-editor.component.scss']
})
export class AceEditorComponent implements OnInit {
@Input() mode = 'html';
@Input() autoUpdateContent = true;
@Input() content: string;
@Output() onContentChange: EventEmitter<string> = new EventEmitter();
@ViewChild('editor') editor;
options = {
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
};
ngOnInit(): void {
this.editor._editor.$blockScrolling = Infinity;
}
onContentChanging(): void {
this.onContentChange.emit(this.content);
}
}
Ace Editor Html
<ace-editor [(text)]="content"
#editor
(textChanged)="onContentChanging()"
[options]="options"
[autoUpdateContent]="autoUpdateContent"
style="min-height: 500px; width:100%; font-size:18px;overflow: auto;"
[mode]="mode"></ace-editor>
Ausgabe:
Auto-complete funktioniert nicht.
Warnmeldungen in der Konsole
https://stackoverflow.com/questions/24651222/misspelled-ace-editor-options –
set-Optionen innerhalb 'ngAfterViewInit' wie' ngAfterViewInit() { \t this.editor.getEditor(). SetOptions ({ \t \t enableBasicAutokomplettierung: true \t}); } ' –
@Yatinpate funktioniert nicht. Übrigens danke für Ihre Antwort –