Skip to content

Commit

Permalink
fix: revert some code
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed Sep 5, 2022
1 parent c716521 commit 51b79b5
Showing 1 changed file with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,28 +191,30 @@ export class EoMonacoEditorComponent implements AfterViewInit, OnInit, OnChanges
}

private initMonacoEditorEvent() {
// this.completionItemProvider = window.monaco.languages.registerCompletionItemProvider('javascript', {
// provideCompletionItems: (model, position) => {
// // find out if we are completing a property in the 'dependencies' object.
// const textUntilPosition = model.getValueInRange({
// startLineNumber: 1,
// startColumn: 1,
// endLineNumber: position.lineNumber,
// endColumn: position.column,
// });
if (this.completions?.length) {
this.completionItemProvider = window.monaco.languages.registerCompletionItemProvider('javascript', {
provideCompletionItems: (model, position) => {
// find out if we are completing a property in the 'dependencies' object.
const textUntilPosition = model.getValueInRange({
startLineNumber: 1,
startColumn: 1,
endLineNumber: position.lineNumber,
endColumn: position.column,
});

// const word = model.getWordUntilPosition(position);
// const range = {
// startLineNumber: position.lineNumber,
// endLineNumber: position.lineNumber,
// startColumn: word.startColumn,
// endColumn: word.endColumn,
// };
// return {
// suggestions: this.completions.map((n) => ({ ...n, range })),
// } as any;
// },
// });
const word = model.getWordUntilPosition(position);
const range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: word.startColumn,
endColumn: word.endColumn,
};
return {
suggestions: this.completions.map((n) => ({ ...n, range })),
} as any;
},
});
}

// this.codeEdtor.onDidChangeModelDecorations(() => {
// updateEditorHeight(); // typing
Expand Down

0 comments on commit 51b79b5

Please sign in to comment.