Skip to content

Commit

Permalink
fix: fix ts err
Browse files Browse the repository at this point in the history
  • Loading branch information
YanYuanFE committed Sep 13, 2024
1 parent 5c438ac commit 68ebc62
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/components/Editor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ export const CairoEditor: React.FC<CairoEditorProps> = ({ value, onChange, heigh

monaco.languages.registerCompletionItemProvider('cairo', {
provideCompletionItems: (model, position) => {
const wordInfo = model.getWordUntilPosition(position);
const range = {
startLineNumber: position.lineNumber,
endLineNumber: position.lineNumber,
startColumn: wordInfo.startColumn,
endColumn: wordInfo.endColumn
};
const suggestions = [];
for (const [name, snippet] of Object.entries(cairoSnippets)) {
suggestions.push({
Expand All @@ -28,6 +35,7 @@ export const CairoEditor: React.FC<CairoEditorProps> = ({ value, onChange, heigh
insertTextRules: monaco.languages.CompletionItemInsertTextRule.InsertAsSnippet,
documentation: snippet.description,
detail: snippet.description,
range: range
});
}
return { suggestions };
Expand Down

0 comments on commit 68ebc62

Please sign in to comment.