Snippets not importing

V0.2.1
I cannot seem to get Prompt to import my snippets from SSMS, I have tried changing the defaults but still no luck
Tagged:

Best Answers

  • AdrianBAdrianB Cambridge, UKPosts: 46 Silver 1
    Answer ✓
    @hlattanzio What you have done sounds correct.

    The AdsSnippets file should be the path to the file that ADS stores its user-specific SQL snippets in (usually C:\Users\hlattanzio\AppData\Roaming\azuredatastudio\User\snippets\sql.json). You can check this path by running Command palette -> Configure user snippets -> sql.json and then look at the path of the file that opens.

    The SSMSSnippetsFolder is the path to the folder that contains your snippets for SQL Prompt in SSMS (usually %localappdata%\Red Gate\SQL Prompt 10\Snippets).

    For both of these, you should be able to leave them as Default and the extension should still find them. If that isn't working, check what both paths are and set them explicitly in the ADS settings.

    If that still isn't working, can you drop us an email to [email protected]?
    Software Engineer
    Redgate Software
  • AdrianBAdrianB Cambridge, UKPosts: 46 Silver 1
    Answer ✓
    @SzymonOs

    We have just released a new version (v0.2.2) of the extension. Could you install that and see if it works?

    If not, there should be a log file in the following directory:

    C:\Users\[username]\.azuredatastudio\extensions\redgate.sql-prompt-0.2.2\logs\

    Could you send that log file (or all of them is there are more than one) to [email protected] and we'll investigate it further?
    Software Engineer
    Redgate Software

Answers

  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    Hi Simon,

    Can you confirm the path to your Ads snippets file (Command palette -> Configure user snippets -> sql and then look at the path of the file that opens)?

    Adrian

    Software Engineer
    Redgate Software
  • SimonRSimonR Posts: 6 New member
    Hi; Thanks for the reply It just says Default
  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    Hi Simon,

    That's probably the SQL Prompt setting. There is a snippets file already within ADS for sql snippets. Could you check the path to that file using the the command palette: 

    Command palette -> Configure user snippets -> sql



    Adrian


    Software Engineer
    Redgate Software
  • SimonRSimonR Posts: 6 New member
    Hi; it is C:\Users\srichardson\AppData\Roaming\azuredatastudio\User\snippets should I replace default with that value?
  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    edited May 20, 2020 7:59PM
    Yes, give that a try (make sure to put the path to the sql.json file in, not the directory).

    If that doesn't work, can you drop us an email to [email protected]?
    Software Engineer
    Redgate Software
  • hlattanziohlattanzio Posts: 1 New member
    Hello - Is there any update on this?

    I'm not getting my SSMS SQL Prompt snippets to import either.  I updated the SSMS Snippets folder setting, restarted ADS, and it still doesn't work

    AdsSnippetsFile = Default   -> but that is working. My ADS snippets show

    Ssms Snippets Folder = C:\Users\hlattanzio\AppData\Local\Red Gate\SQL Prompt 10\Snippets
     
    . I even tried taking the Snippets folder off of the path and just using  C:\Users\hlattanzio\AppData\Local\Red Gate\SQL Prompt 10   but it still doesnt' seem to import any of my snippets from SSMS
  • SzymonOsSzymonOs Posts: 8 New member
    edited June 1, 2020 7:32AM
    Same issue for me. I've put manually path to my snippets folder but I do only have generic SQL Prompt snippets, none of the created or changed by me (I'm using lowercase in SQL so I have ssf, scf, ... snippets modified) are available.
  • SzymonOsSzymonOs Posts: 8 New member
    Snippets imported correctly after update :). Thank you.
  • SimonRSimonR Posts: 6 New member
    Perfect, thank-you mine is working now as well
  • sdkssdks Posts: 44 Bronze 2
    edited July 7, 2020 1:20PM
    I wasn't able to post the log here, so I uploaded it. v0.2.2

    Attached SSMS snippets as well as ADS sql.json file
  • sdkssdks Posts: 44 Bronze 2
    @AdrianB , please confirm that you saw my post above. There was a small issue with it as it was removed/banned, so it might was missed from your attention.
  • JustinLezonJustinLezon Posts: 4 New member
    Snippets are not importing from SSMS with v0.2.6. My SSMS and ADS snippet files are currently residing in the default locations listed in this thread. However, the ADS snippet file - sql.json - only contains {}. I tried to explicitly enter the file paths in the Ads Snippets file and Ssms Snippets folder. When I do, I receive an access denied error in ADS when trying to open the ADS snippet sql.json file. How do I resolve this?
  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    @JustinLezon The error suggests that it is a file permission problem:

    System.UnauthorizedAccessException: Access to the path 'C:\Users\lezonj\AppData\Roaming\azuredatastudio\User\snippets' is denied.

    Can you confirm that you have access to that path?
    Software Engineer
    Redgate Software
  • JustinLezonJustinLezon Posts: 4 New member
    edited April 15, 2021 5:13PM
    @AdrianB, I am able to navigate to this location without issue. As a test, I created another location and explicitly mapped ADS SQL prompt to that location. Still had an access denied error. See attached.

    It also triggers a system log warning event ID 10016.

    The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID 
    {2593F8B9-4EAF-457C-B68A-50F6B8EA6B54}
     and APPID 
    {15C20B67-12E7-4BB6-92BB-7AFF07997402}
     to the user xxxxxxxx from address LocalHost (Using LRPC) running in the application container Unavailable SID (Unavailable). This security permission can be modified using the Component Services administrative tool.
  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    @JustinLezon When the SQL Prompt ADS extension starts, it runs a command line to do the import of snippets. Could you try to run the importer manually?

    To do so, find the directory in which the extension is installed (usually C:\Users\<username>\.azuredatastudio\extensions\redgate.sql-prompt-0.2.6\out\SnippetConverter) and run:

    SqlPrompt.SnippetConverter.exe --ssmsSnippetsFolder <path to SSMS snippets directory> --adsSnippetsFile <path to ADS snippets file>

    Do you get the same error?
    Software Engineer
    Redgate Software
  • JustinLezonJustinLezon Posts: 4 New member
    @AdrianB I ran the command line statement as administrator and received the same error.
  • AdrianBAdrianB Cambridge, UK Posts: 46 Silver 1
    @JustinLezon The snippet converter isn't doing anything special (as in needing special permissions). It reads the snippets from the SSMS directory, converts them to a different format, and then saves them into the ADS json file.

    Given the error you are getting, it seems to be more of an environment issue relating to users/permissions. I'd suggest checking that the user you are running the converter as has access to both paths you are giving it. It might also be worth checking that the SSMS path is to a directory containing snippet files, and the ADS path is a file path of the sql.json file of ADS.

    Software Engineer
    Redgate Software
  • JustinLezonJustinLezon Posts: 4 New member
    @AdrianB As mentioned in previous posts, the user running the converter has access to both folder locations, the SSMS path is to a directory containing snippet files, and the ADS path is a file path of the sql.json of ADS.

    I understand this product is in preview and I will receive limited support through this forum, but I hope this can be resolved in a future release. I would migrate from SSMS to ADS permanently if SQL Prompt works properly, but your product is not quite there yet.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file