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

Scopes for SQL highlighted within PHP strings differs between string types #23

Open
kczx3 opened this issue Nov 27, 2024 · 1 comment
Open

Comments

@kczx3
Copy link

kczx3 commented Nov 27, 2024

Description

SQL strings are highlighted within PHP strings when that string begins with certain keywords. SQL highlighting can also be "forced" by using a heredoc whose identifier matches [DS]QL. The issue however is that different scopes are evaluated to for the same identifiers between double quoted strings and heredocs.

Steps to Reproduce

$maxId = 10;

$sql = "SELECT d.id FROM my_table d WHERE d.id BETWEEN 1 AND $maxId AND my_custom_func(d.name) > 10";

$sql = <<<SQL
    SELECT d.id FROM my_table d WHERE d.id BETWEEN 1 AND $maxId AND my_custom_func(d.name) > 10
SQL;

Expected behavior: [What you expect to happen]
All symbols within the string should be highlighted the same and with the same scopes.

Actual behavior: [What actually happens]
Instead, several things are highlighted differently between the two types of PHP strings.

image

Scope inspector for the first my_table:
image

Scope inspector for the second my_table:
image

This creates a somewhat jarring experience for the developer when looking at SQL across a codebase. The colors should be the same at the very least.

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

@1127
Copy link

1127 commented Dec 3, 2024

Similar to this bug as well. #18

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

2 participants