Comments (9)
+1
from inline_sql_syntax.
Generic type arguments can be implemented (
- SQL tagged template literals by @frigus02 (repo: https://github.com/frigus02/vscode-sql-tagged-template-literals)
- Inline SQL by @notyetspecified (repo: https://github.com/notyetspecified/vscode-sql-template-literal)
In the following PR by @KristjanTammekivi, the generic type parameter feature was added to Inline SQL:
from inline_sql_syntax.
The problem with the original example in this current issue by @ariesclark above is that the generic type argument spans multiple lines.
The root cause for this is a bit more of a problem, since TextMate grammars have limitations, as @sheetalkamat is familiar with:
- microsoft/TypeScript-TmLanguage#761 (comment)
- microsoft/TypeScript-TmLanguage#949 (comment)
- microsoft/vscode-textmate#41
VS Code itself somehow gets around the limitations and can do correct syntax highlighting over multiple lines, maybe with Semantic Highlighting by @aeschli and @alexdima.
I also see some changes with regular expressions, which @sheetalkamat has also been maintaining:
So maybe there is a way for a VS Code extension to also achieve this, by also using this Semantic Highlighting / these regular expressions.
The TextMate grammar limitations have also been explored in the following SQL tagged template literals VS Code extension, but no solution has yet appeared:
from inline_sql_syntax.
Workaround (/* sql */
comment)
Add a /* sql */
comment after the multi-line generic
sql<{
value: number
-}[]>`
+}[]>/* sql */ `
SELECT 1 value;
`
Credit: @net in thebearingedge/vscode-sql-lit#13 (comment)
from inline_sql_syntax.
This actually breaks coloring for the rest of the documents with generics.
from inline_sql_syntax.
This actually breaks coloring for the rest of the documents with generics.
Can you give a full example? Here's mine:
const sql = <T>(q): any => {
return {
execute: (db) => {}
}
}
interface F {
now: string;
}
const db = {};
await sql<F>`SELECT NOW(6) AS 'now'`.execute(db);
const boo = true;
await sql<{ now: string }>`SELECT NOW(6) AS 'now'`.execute(db);
const foo = true;
await sql`SELECT NOW(6) AS 'now'`.execute(db);
const moo = true;
export { };
from inline_sql_syntax.
@KristjanTammekivi testing with your snippet below:
With the extension enabled
With the extension disabled
from inline_sql_syntax.
Ah my bad, I thought this was the same extension as I made a contribution to because I was mentioned here. I'm using this extension:
from inline_sql_syntax.
@KristjanTammekivi nice ad (and i'm sold) =D
from inline_sql_syntax.
Related Issues (20)
- SQL errors are not cleared out upon save HOT 1
- MySQL dbDriver: is it possible to automatically select a database in settings.json?
- Extension Hasn't Been Updated on OpenVSX
- Add support for single quotes `'` (for javascript/typescript)
- Erroneous detection of -- as comment (breaks golang code completion)
- Code folding feature support for inline SQLs
- .
- Semicolumn in string in SQL can end the query and raise "Unmatched parentheses" error
- Python single-quote multiline strings not recognized
- Feature request: Ignore leading whitespace for SQL detection HOT 2
- Option to disable sql-lint? HOT 4
- Support for nimlang
- Add support for escape string
- Node Postgres parameter syntax not supported in javascript files
- support strings start with more SQL keywords HOT 5
- SQL Strings with "ALTER TABLE" are not highlighted HOT 1
- Auto-keyword based highlighting doesn't seem to work in golang
- Connecting to a SQLite database
- bash shell script heredoc inline SQL support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inline_sql_syntax.