Author Topic: Cannot associate new extension 'sql'  (Read 3486 times)

mp

  • Community Member
  • Posts: 12
  • Hero Points: 0
Cannot associate new extension 'sql'
« on: December 21, 2016, 04:32:58 PM »
I can’t seem to make SE 21.0.1.0 x64 remember a file extension mapping for 'sql'.

What I’d like is to be able open a *.sql file from Windows Explorer, and have it recognized as a Sql Server file.  I have a right click context menu item in Windows "Open in Slickedit" that opens the right clicked file using this command: "C:\Program Files\SlickEdit Pro 21.0.1\win\vs.exe" "file.sql".

When opened this way, a *.sql file is opened as plain text, and not recognized as .sql, there’s no color coding or other language features.

Three settings seem like they should help, but they haven’t worked:

A.   After opening the file,  click the Document | Select Mode menu, and choose SQL Server.  SE asks "Would you like to map all files with the extension of '.sql' to SQL Server?"   Clicking Yes only works until SE is closed, when restarted, .sql files are recognized as plain text again.

B.   In Tools | Options | Languages | Database Languages | SQL Server | General, click the Edit These Extensions button.  Default values are 'sqlserver' and 'sybase', I add 'sql', then click OK.  After closing the Options dialog and reopening, I verify the .sql extension has been added, but *.sql files opened from Windows (as opposed to from within SE) are still recognized as plain text. 

As a bonus, the sql extension I just added goes away after closing and restarting SE.

C.  In Tools | Options | Languages | File Extension Manager, add 'sql' and associate with Sql Server.  Again I can verify it's added after reopening the Options dialog, but it's gone after closing and reopening SE.

My first thought was that somehow SE can’t write to its config folder, but files there are getting updated, e.g., vslick.sta, user.cfg.xml.  Also, I can add other extensions, e.g. I added extension 'fred' and associated it with plain text. I was there after closing and restarting SE.

Any ideas would be appreciated.

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Cannot associate new extension 'sql'
« Reply #1 on: December 22, 2016, 01:57:57 PM »
I can reproduce the disappearing extension for SQL Sever - it seems specific to that mode so far, if I add .sql to another language it keeps it.  I'm taking a look at the cause now.   Thanks for the report.

mp

  • Community Member
  • Posts: 12
  • Hero Points: 0
Re: Cannot associate new extension 'sql'
« Reply #2 on: January 06, 2017, 05:36:26 PM »
Hi Patrick,

Any suggestions on how I can make this work or work around it?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Cannot associate new extension 'sql'
« Reply #3 on: January 12, 2017, 04:21:54 PM »
It looks like our bug causes the configuration to get into an inconsistent state.  You should be able to work around it for now by editing the user.cfg.xml file to fix the file assocations.

The path to the user.cfg.xml file should be Documents\My SlickEdit Config\21.0.1\user.cfg.xml.  Bring that file up, and search for "langid-sql".  You'll probably have two entries:
Code: [Select]
<d n="langid-sql">
and
Code: [Select]
<p n="langid-sql" v="sqlserver">.

 You'll want to delete the line with the "<d" tag.  When you save, you'll be prompted to reload your configuation, choose "Yes".  And that should take care of the association.

mp

  • Community Member
  • Posts: 12
  • Hero Points: 0
Re: Cannot associate new extension 'sql'
« Reply #4 on: January 12, 2017, 06:35:32 PM »
Thanks, removing the "<d" tag seems to have fixed things.

Is this problem likely to come back in normal use of SE over time?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Cannot associate new extension 'sql'
« Reply #5 on: January 12, 2017, 07:45:51 PM »
That bug can be triggered by changing a extension mapping from language to another.  (so in your case, it was changing the mapping of ".sql" from PL/SQL to SQLServer).  So I wouldn't expect it to happen again unless you're changing more file extension mappings.

I also forgot to mention that the fix for this may not be hotfixable, so it may have to go into the v21.0.2 point release.
« Last Edit: January 12, 2017, 07:47:39 PM by patrick »