Re: Line break with leading commas and tab
Hello, we recently purchased the Site License, and I am having trouble getting the format related to commas exactly how I need it. Basically, I want all of my lists like this:
[*] each list item one tab in from parent keyword [*] leading commas For options, I disabled the "Flexible Space Calculation" option in the Indention section. I chose to indent by 4 spaces, and also checked the "Use Tab" checkbox. Each item in the comma lists is being indented with two spaces instead of a tab, but each item in a non-comma list, instance a WHERE clause, is indenting by one tab as desired. Below is a very simple example. Notice that ",col2" is indented only two spaces rather than one tab in the SQLinForm formatted string. I would like ",col2" to be aligned just as "col1", a single tab in from the "select" keyword. Original query: select col1,col2 from table_name where 1=1 and col1<>col2 SQLinForm output: select col1 ,col2 from table_name where 1 = 1 and col1 <> col2 Desired output: select col1 ,col2 from table_name where 1 = 1 and col1 <> col2 Edited 3 time(s). Last edit at 12/27/2010 12:51PM by guidomarcel.
Hi,
thanks for your feedback. To get closer to the desired output, you can switch on the option "one space after comma". If there is no space between "," and "col2" then SQLinForm will not insert without your permission spaces. The column names are aligned to make the SQL more beautiful and the comma is shifted to the left. Therefore the comma will not be aligned to "col1". Hope this helps Guido
The columns still are not aligned in the solution proposed. col1 is aligned one tab in, whereas col2 is aligned three spaces in, plus the comma which occurs. This is due solely to the attempt to reconcile spaces with tabs, which is problematic. Mixing leading tabs and spaces makes indentation formatting a moot point. Some developers on my team may use a tab stop of three spaces, others may use a tab stop of eight spaces. The code parser here illustrates the issue of mixing tabs with spaces, and users with varying tab stops having problems. Notice how, even with the recommended option selected, how output is still not aligned. The misalignment due to mixing of tabs / spaces is accentuated here because the code parser uses eight spaces for its tab stops.
select col1 -- one tab (presented as eight spaces here) , col2 -- three spaces plus a comma from table_name where 1 = 1 and col1 <> col2 Everything else aligns beautifully, and I maintain that the selected options are not reflecting the expected output. My reason is, I have checked the box on Breaks(1) -> For Lists -> Before Comma. I have also checked the Overall -> Indention -> Use Tab checkbox. I do not see anywhere an exception that indicates to not honor that indention and line break setting when a comma is encountered. This unfortunately doesn't really get us where we need to be. Our team standards are for each column, leading comma included, to be aligned one tab in on their own line. There is literally one option that, when changed, breaks or fixes things. Everything is tabbed correctly when I check Breaks(1) -> For Lists -> After Comma. I also uncheck Breaks(1) -> For Lists -> Before Comma. Here is the output: select col1, col2 from table_name where 1 = 1 and col1 <> col2 The issue here, again, is that commas are at the end of the line rather than the beginning of the next. Literally, the only change I need is for the comma to be "moved" to be a tab in on the line containing col2. Edited 2 time(s). Last edit at 10/19/2010 10:12PM by haylo75.
Guido - I am using the exact text labeled "Original query" from my first post, combined with the settings file that I sent you last month. I copied and pasted that text into an app named Notepad++, which lets me easily view non-printable characters. I have verified there are none in the text.
I am able to reproduce the issue explained with consistency. Do you need me to re-send the settings configuration file?
|