Skip to content

Commit

Permalink
Merge pull request #609 from FalkorDB/fix-editor
Browse files Browse the repository at this point in the history
Fix #608 fix editor
  • Loading branch information
AviAvni authored Jan 15, 2025
2 parents 99d06e2 + 64f2a32 commit 368b7d0
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/components/EditorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const KEYWORDS = [
"ORDER BY",
"SKIP",
"LIMIT",
"MARGE",
"MERGE",
"DELETE",
"SET",
"WITH",
Expand Down Expand Up @@ -357,6 +357,8 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
if (!graph.Id || (!monacoInstance && !monacoI)) return
const m = monacoI || monacoInstance
const sug: Suggestions = getEmptySuggestions()

sugProvider?.dispose()

await Promise.all([
addLabelsSuggestions(sug.labels),
Expand Down Expand Up @@ -463,20 +465,16 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
run()
}, [graph])


useEffect(() => {
getSuggestions()
}, [graph.Id])

useEffect(() => {
const interval = setInterval(() => {
getSuggestions()
}, 5000)

return () => {
clearInterval(interval)
sugProvider?.dispose()
}
}, [])
}, [graph.Id])

const handleEditorWillMount = (monacoI: Monaco) => {
monacoI.languages.setMonarchTokensProvider('custom-language', {
Expand Down Expand Up @@ -557,7 +555,6 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
updatePlaceholderVisibility();
});

// Initial check
updatePlaceholderVisibility();

setMonacoInstance(monacoI)
Expand All @@ -572,7 +569,7 @@ export default function EditorComponent({ currentQuery, historyQueries, setCurre
setBlur(false)
})

const isFirstLine = e.createContextKey('isFirstLine', false as boolean);
const isFirstLine = e.createContextKey<boolean>('isFirstLine', true);

// Update the context key value based on the cursor position
e.onDidChangeCursorPosition(() => {
Expand Down

0 comments on commit 368b7d0

Please sign in to comment.