New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tidbcloud/codemirror-extension-sql-autocomplete

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tidbcloud/codemirror-extension-sql-autocomplete

codemiror extension for SQL keyword and database schema autocompletion with customized style

  • 0.0.7
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
59
increased by180.95%
Maintainers
0
Weekly downloads
 
Created
Source

@tidbcloud/codemirror-extension-sql-autocomplete

A codemirror extension implements the SQL keyword and database schema autocompletion based @codemirror/autocomplete, with a customized style.

Try it

  • Full Featured Playground
  • Simple Example

Installation

npm install @tidbcloud/codemirror-extension-sql-autocomplete

You need to install its peer dependencies as well:

npm install @codemirror/view @codemirror/state @codemirror/autocomplete @codemirror/commands @codemirror/lang-sql

Usage

import { EditorView } from '@codemirror/view'
import { EditorState } from '@codemirror/state'
import { sql, MySQL } from '@codemirror/lang-sql'
import { sqlAutoCompletion } from '@tidbcloud/codemirror-extension-sql-autocomplete'

const editorView = new EditorView({
  state: EditorState.create({
    doc,
    extensions: [
      sql({ dialect: MySQL }),

      sqlAutoCompletion({
        acceptKey: 'Tab',
        autocompleteItemClassName: 'autocomplete-item-test'
        // ...
      })
    ]
  })
})

API

/* DefaultCompletionConfig configs please refer to: https://codemirror.net/docs/ref/#autocomplete.autocompletion */
interface AutoCompletionConfig extends DefaultCompletionConfig {
  /**
  accept the completion by pressing the key, defult is Tab
  */
  acceptKey?: string
  /**
  the classname added to the auto completion item
  */
  autocompleteItemClassName?: string
  /**
  The maximum number of options to render to the DOM, default is 50
  */
  maxRenderedOptions?: number
  /**
  The icon map for the auto completion item, the key is the type of the completion, the value is the img src
  */
  renderIconMap?: Record<string, string>
}

function sqlAutoCompletion(config?: AutoCompletionConfig): Extension

Keywords

FAQs

Package last updated on 10 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc