Skip to content
Discussion options

You must be logged in to vote

I haven't made autocompletion for any languages other than HTML, CSS, and JavaScript. If you want autocomplete for SQL, you'll have to make it yourself. If all you want is autocomplete for SQL keywords, then this is easily doable.

import { getClosestToken } from "prism-code-editor/utils"
import { Completion, CompletionSource, registerCompletions } from "prism-code-editor/autocomplete"

const options: Completion[] = listOfSqlKeywords.map(label => ({ label, icon: "keyword" }))

const sqlSource: CompletionSource = (context, editor) => {
  if (getClosestToken(editor, ".string, .comment", 0, 0, context.pos)) {
    return // Disable autocomplete in comments and strings
  }
  const wordBefore = /\w

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@tanujkucp
Comment options

@jonpyt
Comment options

Answer selected by tanujkucp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants