What are the challenges you face when working across database platforms? Take the survey
Options

Format list items with indent for subsequent items

Prompt is no longer indenting subsequent list items when using tab only. For example, setting Whitespace tab behavior to Only Tabs and formatting the following code using any combination of 'Align Subsequent, Indent List Items):

create table dbo.tmp_dtru02_vehicle
( id bigint identity(1, 1)
, rundatetime_utc datetime null
, audit_createdatetimeutc datetime null
, audit_createdateutc date null
, audit_moddatetimeutc datetime null
, audit_isactive bit null);

results in the following formatted code with subsequent list items not indented with tabs:

create table dbo.tmp_test
(
id bigint identity(1, 1)
, rundatetime_utc datetime null
, audit_createdatetimeutc datetime null
, audit_createdateutc date null
, audit_moddatetimeutc datetime null
, audit_isactive bit null
);


Tagged:

Answers

  • Options
    Hi @naumad

    Thanks for posting and sorry to hear you are having this issue.

    I couldn't reproduce the issue in SQLPrompt_9.0.3.3299. Can you please upgrade and test again?

    Thanks.
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    I am experiencing different behavior after upgrade, but it is also not the expected behavior. I am expecting that selecting the "Indent List Items" checkbox should indent not only the first list item, but all subsequent list items; see attached picture
    btosn19j5bqa.jpg
  • Options
    Hi @naumad

    Would you be able to share the sample script and style file with us?
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    select
    TerritoryID
    , Name
    , [Group] -- nvarchar(50)
    , SalesYTD as YearToDate -- money
    , SalesLastYear as LastYear -- money
    from Sales.SalesTerritory
  • Options
    naumadnaumad Posts: 19 Bronze 1
    edited January 4, 2018 5:52PM
    Attached is the style file (zipped). For the above query, I am expecting SQLPrompt to format using all tabs for the list items, starting with the first list item and all subsequent column names indented.
  • Options
    If you change the 'Tab behavior' under 'Whitespace', I assume that's the result you expect.
    I am expecting SQLPrompt to format using all tabs for the list items .....

    - Did you mean you want to use ' Only tabs' ?

    e1r1bsn7kw68.png


    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    Yes, I meant to use "Only Tabs".
  • Options
    Hi @naumad

    You'd have to change the number of spaces in tabs:

    vwm9y9btxgcq.png
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    Number of spaces in tabs = 4; I still have the same trouble
  • Options
    Hi @naumad

    It appears there is a tab in front of the first item and to align it with the subsequent list, I'm afraid you'll have to change the number of space in tabs to 2. Alternatively, you can use ' Tabs where possible'.
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    I'm sorry about this - it's becoming a bigger problem than necessary. I simply would like this SQL:
    select
    x
    , date1
    , date2
    , username
    from tablename
    where x = 1 and date1 between '2017-01-01' and '2017-01-31';
    

    to be formatted like this:
    select
    	x
    	, date1
    	, date2
    	, username
    from tablename
    where
    	x = 1
    	and date1 between '2017-01-01' and '2017-01-31';
    

    The indent is one tab created only with standard tabs (not spaces) so that our documentation system will copy the code correctly. This used to work prior to the December 2017 release when the behavior for 'subsequent items' changed. Earlier in this thread, I attached the style file. If this is possible, please let me know which SQL Prompt style settings will accomplish this. If this is not possible and there will be no patch for this, please let me know and I will request a refund from my recent renewal.
  • Options
    Hi @naumad ,

    After further investigation, the option 'Align subsequent items with first item' doesn't seem to work. We've logged this issue as SP-6811 in our internal bug tracking system and will keep you updated.

    Thanks for your patience.
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    Hi @naumad

    Thanks for your patience with this issue.

    Unfortunately the development team hasn't been able to prioritise this work. Given the size of the backlog of higher-priority items, it doesn't look like it's something we will fix in the foreseeable future.

    However we still have it logged as 
    SP-6811 in our internal bug tracking system and we'll reassess it again in the future. Please keep an eye on the release note!

    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    So the dev team broke something and doesn't have time to fix it in the "foreseeable future".  Is this correct?
  • Options
    Hi @naumad

    The development team had another look and it appears changing the highlighted setting resolves the issue.

    Can you please give it a try?


    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Options
    naumadnaumad Posts: 19 Bronze 1
    This appears to work.  Thank you for your help and patience.
Sign In or Register to comment.