codemirror-sql: a CodeMirror extension for SQL linting, hover, completions, and more

Hey all, I wanted to share @marimo-team/codemirror-sql: a CodeMirror extension for SQL linting, hover, completions and many more features. This also contains additional dialect support for other databases like DuckDB and BigQuery.

We would love feedback or open to collaborating.

3 Likes

Very cool. I’ve linked the package from the community page.

1 Like

thank you @marijn, and thank you for sharing CodeMirror, it is such an amazing library/ecosystem!

@mscolnick We’d love to use this in pgAdmin. Very nice.

Hi @mscolnick ,

I noticed pl/pgsql is not supported. Any future plans for adding support for constructs like BEGIN END?

The main codemirror sql package has the dialect for Postgres - lang-sql/src/sql.ts at main · codemirror/lang-sql · GitHub. You can grab it there.

@mscolnick I tried to use this package, and it is failing to compile. When I debugged, it is failing in instance of check for FacetProvider. Likely, mismatch in codemirror version.

I also checked the demo code, and it is using the source code directly. Not the built version.

Any suggestions would help. I use “codemirror” as dependency in package.json.

react-dom.development.js:22874 Uncaught Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.
    at inner (index.cjs:1997:23)
    at inner (index.cjs:1972:17)
    at inner (index.cjs:1972:17)
    at inner (index.cjs:1972:17)
    at flatten (index.cjs:2001:5)
    at Configuration.resolve (index.cjs:1909:25)
    at EditorState.create (index.cjs:2741:43)

Hi @marijn @mscolnick ,

Can you suggest please?