Author Topic: Unexpected Capitalization  (Read 365 times)

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Unexpected Capitalization
« on: March 27, 2021, 06:07:57 pm »
I've been poking around in my configuration and can't seem to find what is causing this to happen...

In a SQL source file, the view or table name following CREATE TABLE or CREATE VIEW is being capitalized automatically.  I have keywords set to capitalize but these identifiers are clearly not keywords.

I have asked for a feature update that would allow users to designate various types of syntax, other than just keywords, to be automatically capitalized (languages like SQL, COBOL, and even BASIC are traditionally written in uppercase) but these identifiers are not something I want capitalized.

The really interesting thing is that, if I can find out what is causing it, not only can I disable it for these identifiers but I might be able to use it to capitalize the other syntax elements that I do want capitalized such as function names and data type names.

Anyone know where this automatic case change is coming from?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5768
  • Hero Points: 460
Re: Unexpected Capitalization
« Reply #1 on: March 28, 2021, 08:59:08 pm »
Can you post a small sample file where the view or table name is getting capitalized. I can't seem to make this happen for non-keywords.

The Slick-C macro which does the case changing is "plsql_maybe_case_word". Source code is there (Macro>Go to Slick-C Definition...)

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #2 on: March 29, 2021, 03:35:17 pm »
Hi Clark,

Here is a small view creation script.  If I make any change to the name vw_pdi_itemtransactions - such as add another character at the end of the name - it instantly capitalizes the entire name.

Code: [Select]
CREATE VIEW vw_pdi_itemtransactions
AS
SELECT
   org.Location_ID AS store,
   CAST(cal.Day_Date AS DATE) AS rptdate,
   CAST(tod.timeofday_desc AS TIME) AS rpttime,
   header.Transaction_Number AS ticket,
   prod.UPC,
   prod.Item_Desc AS itemdesc,
   item.Quantity_Sold AS quantity,
   CAST(item.Unit_Price AS DECIMAL(8,2)) AS price,
   CAST(item.Taxable_Amount AS DECIMAL(8,2)) AS taxable,
   header.Total_No_Of_Items AS itemcount,
   CAST(header.Total_Amount AS DECIMAL(8,2)) AS tickettotal,
   CAST(header.Total_Tax_Amount AS DECIMAL(8,2)) AS tickettotaltax
FROM PDIPROD.PDI_Warehouse_1606_01.dbo.MarketBasket_Line_Items item
   INNER JOIN PDIPROD.PDI_Warehouse_1606_01.dbo.MarketBasket_Header header
      ON item.MarketBasket_Header_Key = header.MarketBasket_Header_Key
   INNER JOIN PDIPROD.PDI_Warehouse_1606_01.dbo.timeofday tod
      ON item.TimeOfDay_Key = tod.timeofday_key
   INNER JOIN PDIPROD.PDI_Warehouse_1606_01.dbo.calendar cal
      ON item.Calendar_Key = cal.calendar_key
   INNER JOIN PDIPROD.PDI_Warehouse_1606_01.dbo.Organization org
      ON item.Organization_Key = org.organization_key
   INNER JOIN PDIPROD.PDI_Warehouse_1606_01.dbo.Product prod
      ON item.Product_Key = prod.Product_Key
WHERE item.Item_Type = 1
  AND ISNUMERIC(prod.UPC) = 1

I will look at the plsql_maybe_case_word macro but I suspect it may be something I may have done done years ago in a macro or configuration that I can't remember doing.  The problem is that there is so much flexibility in setting up this editor that I'm kind of at a loss as to where to start looking. 

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #3 on: March 29, 2021, 04:03:11 pm »
I did a little additional checking and found that the capitalization does not happen when I edit the same SQL code in my previous SE version 17.  I think that eliminates changes I may have made to macros since I haven't made any changes in the current version - mostly all I've been doing is syntax coloring configuration and a few keyboard shortcut updates (the other configuration options got imported when I installed the new version).

I wanted table and view names colored in dark red so I set them up as preprocessor (since there is no preprocessor capability in T-SQL).  The coloring works the way I want and I wouldn't think there would be anything special trying to capitalize preprocessor statements (quite the contrary in a language like C/C++). 

I'm just throwing out as much detail as I can think of hoping to help find what's doing it.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5768
  • Hero Points: 460
Re: Unexpected Capitalization
« Reply #4 on: March 29, 2021, 04:25:11 pm »
Still no luck. Please post your user.cfg.xml. Maybe I need that.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3245
  • Hero Points: 461
Re: Unexpected Capitalization
« Reply #5 on: March 29, 2021, 08:11:07 pm »
What is 'vw_pdi_itemtransactions' color coded as (Identifier or Keyword).  Had you added symbols to your color coding?

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #6 on: March 29, 2021, 10:01:38 pm »
What is 'vw_pdi_itemtransactions' color coded as (Identifier or Keyword).  Had you added symbols to your color coding?
I coded it as preprocessor using a few regex expressions. For example, the word following CREATE VIEW or ALTER VIEW will always be the name of a view. I selected preprocessor because it was already the color I wanted and there are no actual preprocessor statements in Microsoft's T-SQL. I did not use identifier or symbols.

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #7 on: March 29, 2021, 10:02:38 pm »
Still no luck. Please post your user.cfg.xml. Maybe I need that.
I will post that file in the morning when I'm back at my computer.

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #8 on: March 30, 2021, 01:17:25 pm »
Here is my user.cfg.xml file.  I appreciate you taking the time to look at it - I took a quick look myself but I'm sure I don't know enough about it to find anything significant.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 5768
  • Hero Points: 460
Re: Unexpected Capitalization
« Reply #9 on: March 30, 2021, 03:13:07 pm »
I've added a hot fix for this. The "Auto case keywords" feature has always auto cased keywords and preprocessing keywords. However, I don't think this makes sense and it's definitely not obvious. There is a possibility that this will negatively effect other users. Worst case, this default change will have to be pulled and an option added. We won't know for a long time.

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #10 on: March 30, 2021, 03:20:49 pm »
Thanks Clark.  I guess that means I can't use that facility to capitalize other syntax elements. <chuckle>

SlickEdit Support

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 337
  • Hero Points: 26
Re: Unexpected Capitalization
« Reply #11 on: March 30, 2021, 07:18:52 pm »
Hi there,

Rev6 of the cumulative hotfix for v25.0.1 has this change in it:

https://customer.slickedit.com/index.php?option=com_content&view=article&id=260&Itemid=41

Best,
SlickEdit Support

cthomson

  • Community Member
  • Posts: 38
  • Hero Points: 1
Re: Unexpected Capitalization
« Reply #12 on: March 30, 2021, 07:30:28 pm »
As expected, it works as advertised... Thanks!