Giter Site home page Giter Site logo

thebearingedge / vscode-sql-lit Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 5.0 1.7 MB

๐ŸŽจ Syntax highlighting for SQL template literals.

Home Page: https://marketplace.visualstudio.com/items?itemName=thebearingedge.vscode-sql-lit

License: MIT License

vscode-sql-lit's People

Contributors

aust1nz avatar bencehornak avatar benkroeger avatar klausbadelt avatar thebearingedge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vscode-sql-lit's Issues

Breaks on *.sql``

We connect to multiple databases, and so sometimes import multiple database objects under different names:

import db from 'src/db'
import herokuDB from 'src/herokuDB'

await db.sql`SELECT 1`
await herokuDB.sql`SELECT 1`

...

This extension works fine with db.sql, but with any other module name, such as herokuDB.sql, JS syntax highlighting breaks after end of the template literal.

Explain the usage of `sql`

How do I import the sql command is it from another package or what. I'm a bit lost on how to use it and how it can return back the typed value.

Syntax highlighting breaks with nested sql.array

Hey, thanks for this awesome extension!

I've noticed that sql highlighting fails to properly highlight if there's e.g. an sql.array or sql.join within an sql template string

image

failing code example:

export function fooFailing() {
  return sql`SELECT (${sql.array([1, 2, 3], 'int8')})`;
}

False-positive highlight

Sample code:

const sqlFoo = [];
sqlFoo.push(`)`);
anyFunction();

bar.log(`any other string... but looks like code:1`)

if (error) throw error;
const a = 123;
const c = 456

const s = `broken`;

Preview:
image

Doesn't work for multiline generic types

Hey, I've found a small issue when highlighting sql with multiline generic types:

image

as you can see, in testFailing the query is not highlighted (colored as string). This is because the begin span spans multiple lines.

code:

export function testWorking() {
  return sql<{ value: number }>`SELECT 1 AS "value"`;
}

export function testFailing() {
  return sql<{ value: number }
  >`SELECT 1 AS "value"`;
}

No highlighting with slonik sql.type and inline zod schema

Hi! Awesome plugin. I was setting up slonik on a project and noticed that the highlighting doesn't work when I use slonik's sql.type with a custom inline zod schema.

Highlights:

const schema = z.object({ num: z.number() });

sql.type(schema)`
  SELECT 1 as num
`;

Doesn't highlight:

sql.type(z.object({ num: z.number() }))`
  SELECT 1 as num
`;

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.