Highlight SQL queries in PHPStorm
Answered
Hello.
Connected to a database in PHPStorm. The connection was successful.
The structure of my tables is now displayed in the Database tab (View -> Tool Windows -> Database).
However, all my SQL queries are highlighted in yellow and the tables and columns are highlighted in red. The IDE refers to the fact that there are no such tables and columns and suggests creating. But in the Database tab, these same tables and columns are.
Tell me how to remove this highlighting in yellow and what to do so that the IDE determines tables and columns inside SQL queries?
Please sign in to leave a comment.
Please open File | Settings | Languages & Frameworks | SQL Resolution Scopes and check that the project is mapped to a required scheme, not "All sources":
Then open File | Settings | Languages & Frameworks | SQL Dialects and set correct SQL dialect. If you're using MariaDB - please select it, not just MySQL.
Long SQL turns yellow after reaching a certain SQL length - is that the expected behavior? And how to overcome that? Dmitry Tronin
No, that's not expected. Could you please share an example that illustrates the problem?
Dmitry Tronin
and when I delete 2 rows I get back to normal syntax:
Thanks! That looks like https://youtrack.jetbrains.com/issue/WI-61884 or https://youtrack.jetbrains.com/issue/WI-58028: looks like there's indeed some internal limit on an injected language fragment size. Would it help if you add a /** @lang MySQL */ annotation right before the string? Change MySQL to a dialect you're using if needed.
E.g.:
Dmitry Tronin
Thanks, that solved it!
(spammed the lines intentionally here to test the fix)
Awesome!