-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not highlighted with TypeScript Generics #114
Comments
+1 |
Generic type arguments can be implemented (
In the following PR by @KristjanTammekivi, the generic type parameter feature was added to Inline SQL: |
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:
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: |
Workaround (
|
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 { };
|
@KristjanTammekivi testing with your snippet below: With the extension enabledWith the extension disabled |
|
The following code should be properly highlighted, but is not. Removing the generic type will cause the string to be highlighted again.
The text was updated successfully, but these errors were encountered: