Skip to content
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

Add other possible starting keywords for highlighting SQL within PHP strings #22

Open
kczx3 opened this issue Nov 27, 2024 · 0 comments

Comments

@kczx3
Copy link

kczx3 commented Nov 27, 2024

Description

Currently, PHP strings are highlighted as nested SQL when the string begins with one of the following: SELECT|INSERT|UPDATE|DELETE|CREATE|REPLACE|ALTER|AND|WITH

That list seems somewhat restrictive. My suggestion would be to add in at least WHERE and keyword variations related to JOINs with optional prefixing keywords that specify the type of join. Something like: (FULL|LEFT|RIGHT)?\s+(INNER|OUTER|CROSS)?\s+JOIN (not even going to pretend this is correct or covers all cases).

Steps to Reproduce

$sql = 'SELECT * FROM my_table a ';
$sql .= 'JOIN my_table b ON b.id = a.parent_id ';
$sql .= 'WHERE a.key = \'MY_KEY\'';

Expected behavior: [What you expect to happen]
I'd expect it to work just like how it does if the string starts with AND or how the initial setting of the $sql variable appears.

$sql = 'SELECT * FROM my_table a WHERE a.key = \'MY_KEY\' ';
$sql .= 'AND a.parent_id = 3';

image

Actual behavior: [What actually happens]
image

Reproduces how often: [What percentage of the time does it reproduce?]
100%

Versions

VSCode
Version: 1.95.3 (user setup)
Commit: f1a4fb101478ce6ec82fe9627c43efbf9e98c813
Date: 2024-11-13T14:50:04.152Z
Electron: 32.2.1
ElectronBuildId: 10427718
Chromium: 128.0.6613.186
Node.js: 20.18.0
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.22631

Additional Information

N/A

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant