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

sql queries in .sql files get some strange blue hightlight... #592

Closed
klukiyan opened this issue May 30, 2020 · 16 comments
Closed

sql queries in .sql files get some strange blue hightlight... #592

klukiyan opened this issue May 30, 2020 · 16 comments

Comments

@klukiyan
Copy link

Describe the bug
When clicking anywhere in *.sql files, the query gets some strange blue hightlight behind it.

To Reproduce
Steps to reproduce the behavior:

  1. Open any *.sql file and click anywhere. (not select, simply put cursor), query gets highlighted with some blue background as on screenshot.
    Expected behavior
    I expect not to see this highlight.

Screenshots
image

Desktop (please complete the following information):

  • SQLTools Version 0.22.2
  • VSCode Version: 1.45.1
  • Driver Used/Version: MySQL, MS SQL
  • OS: Widnows

Additional context
Maybe I accidentally clicked some shortcut that enabled this strange behaviour. Or it came with update. Please help me to get rid of it.

@sempasha
Copy link

sempasha commented Jun 3, 2020

This appears since version 0.22.0. Installing 0.21.9 makes sql files syntax highlight looks like before.

@mtxr mtxr closed this as completed in 134e387 Jun 3, 2020
@mtxr
Copy link
Owner

mtxr commented Jun 3, 2020

That was intentional, it highlights the current query under cursor so you can you Run current query command with visible feedback of what query extension will execute. But some users didn't like it at all, so I've added a setting to enable/disable that behavior called sqltools.highlightQuery so you should be able to remove that if you want now. Starting on v0.22.4

@adamrybak
Copy link

Thank you for the option, made seeing queries very difficult.

@mtxr
Copy link
Owner

mtxr commented Jun 4, 2020

if you want, you can use this VSCode option to set the colors and still use that:

"workbench.colorCustomizations": {
    ...
    "sqltools.currentQueryBg": "#ff0000",
    "sqltools.currentQueryOutline": "#ff0000"
    ...
},

@klukiyan
Copy link
Author

klukiyan commented Jun 5, 2020

That was intentional, it highlights the current query under cursor so you can you Run current query command with visible feedback of what query extension will execute. But some users didn't like it at all, so I've added a setting to enable/disable that behavior called sqltools.highlightQuery so you should be able to remove that if you want now. Starting on v0.22.4

@mtxr
I did as you suggested and the highlight nicely disappeared. But now there is appearing this clickable helper on the top Run on active Connection | Select block
How can I disable them too?

@StefanBrand
Copy link

StefanBrand commented Mar 1, 2021

Is it possible to turn background colour off, while keeping outline colour? E.g. setting "sqltools.currentQueryBg": false does not work.

Edit: This works: "sqltools.currentQueryBg": "#ff000000",

@kc-salazar
Copy link

This is closed so I assume the devs consider it a feature rather than an issue. Why is this a default? It is disruptive, not a value-add. Shading all the SQL, making it appear to be actively selected, is nonsensical.

@gjsjohnmurray
Copy link
Collaborator

@kc-bonilla I guess it is intended to be useful when your document contains multiple statements separated by semicolons.

As detailed above, if you don't want it please change your sqltools.highlightQuery setting. Changing the default value of a setting is potentially disruptive for a lot of people.

@gjsjohnmurray
Copy link
Collaborator

gjsjohnmurray commented Aug 10, 2022

I did as you suggested and the highlight nicely disappeared. But now there is appearing this clickable helper on the top Run on active Connection | Select block
How can I disable them too?

@klukiyan these are instances of a feature VS Code calls code lenses. If you want to prevent them from appearing in files for which the language has been set to sql, edit the sqltools.codelensLanguages setting and remove the sql entry from its array.

Update: after changing this setting, run the Developer: Reload Window command to refresh the appearance of open documents.

@klukiyan
Copy link
Author

@gjsjohnmurray . this thread is dead since long time ago.
I abandoned this extension because after some research I discovered that it's the "guilty" extension that freezes the sql user snippets.
Without it they pop-up immediately, with this extension enabled it thinks for 1-3 seconds even on a very powerful PC.
I couldn't find a solution to it, so I switched to using another extension.

@gjsjohnmurray
Copy link
Collaborator

@klukiyan thanks for the update.

@kc-salazar
Copy link

@kc-bonilla I guess it is intended to be useful when your document contains multiple statements separated by semicolons.

As detailed above, if you don't want it please change your sqltools.highlightQuery setting. Changing the default value of a setting is potentially disruptive for a lot of people.

@gjsjohnmurray doubtful. A default formatting that's nearly indiscernible from text selection? And not just the line or the block, but the entire file. It's not a default in the other 200+ common extensions affecting the editor, which tells me people don't want it.

@gjsjohnmurray
Copy link
Collaborator

@kc-bonilla I don't understand what you mean by "the entire file". Here's what I get when I click on the word CREATE on line 8:

image

@alan-hma
Copy link

alan-hma commented Aug 17, 2022

image

When I double-click to select some text, it changes to:

image

I am uncertain why any user would want their code to constantly look (incorrectly) like selected text as a default.

SSMS does not do this.
Sublime does not do this.
VS2019/2022 does not do this.

Additionally, the proposed fix will break if the user decides to change themes, since you have to hard code the background colors into your settings.

@gjsjohnmurray
Copy link
Collaborator

@alan-hma did you try the suggestion about turning the feature off?

image

I think your code is getting so much highlighted because you don't have semicolons at the end of your statements.

@alan-hma
Copy link

Sorry @gjsjohnmurray, had to move on and uninstalled the extension.

I'm dealing with a lot of legacy code support, so minimal changes are the goal on my end.

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

No branches or pull requests

8 participants