mtxr / SublimeText-SQLTools

SQLTools for Sublime Text 3
https://code.mteixeira.dev/SublimeText-SQLTools/
GNU General Public License v3.0
177 stars 40 forks source link

Formatting does not format whole file anymore but only the current line. #182

Closed matthiasmast closed 6 years ago

matthiasmast commented 6 years ago

Bug/Error

Description

Formatting does not format whole file anymore but only the current line.

Version

Steps to Reproduce (For bugfixes)

  1. executing Ctrl+e Ctrl+b in a multi line sql file without text selection

Expected behavior: formatting the whole fole

Actual behavior: formatting only the cursor line

matthiasmast commented 6 years ago

same also applies for things like explain plan (Ctrl+e Ctrl+x). Seems like they are using the expand_to option. I've configured it to line for executing query as there is the handy shortcut with Ctrl+e Ctrl+a. But for these other tasks I'd like to have it expand to the whole file

tkopets commented 6 years ago

Matthias, I do understand your frustration. Indeed, the recent releases introduced this kind of change which makes all commands to act either on selected text or the piece of text controlled by setting expand_to (current line, current paragraph or file).

On one hand, this change brings consistency among different commands in regards to what piece of text is acted upon by SQLTools, which makes it more predictable. On the other hand, I do understand, that this change breaks some of the habits and workflows for existing users of SQLTools who are already used to the old behavior.

I'm a heavy SQLTools user myself and I think that this consistent behavior is important, especially for new coming users, as well as I do understand your concerns.

I think it would make sense to create a separate SQLTools command to format the whole file to cover your needs (something like ST: Format All File which is similar to existing ST: Execute All File).

matthiasmast commented 6 years ago

Thanks for your answer. I can think of 2 meaningful solutions. One would be, as you suggested, to introduce a shortcut for each of the actions for the whole file. The other would be to configure the expand_to option individually for each action.