MikhailProfile / SearchEverywhere

Azure data studio extension to search tables, stored procedures, functions by name or code.
MIT License
11 stars 1 forks source link

add viewScriptOperation and tableScriptOperation extension settings #6

Closed derekvance21 closed 1 month ago

derekvance21 commented 7 months ago

5

This commit adds two extension settings to allow users to open a CREATE script for tables and an ALTER script for views. I love this extension and for my use cases it would be helpful to be able to generate table CREATE scripts which also have information about a table's indexes, primary keys, and default values! image

MikhailProfile commented 7 months ago

Hey, Derek,

Thanks for using the extension! Actually I have a new version of extension with the option to choose the action for each type of object. I have used the internal ADS functions, so now it demands that object explorers should be opened when you use the extension.

Could you please try it out and share your opinion if it works well I will push the new version.

https://github.com/MikhailProfile/SearchEverywhere/releases/tag/1.2.1

image
derekvance21 commented 7 months ago

Hey, Derek,

Thanks for using the extension! Actually I have a new version of extension with the option to choose the action for each type of object. I have used the internal ADS functions, so now it demands that object explorers should be opened when you use the extension.

Could you please try it out and share your opinion if it works well I will push the new version.

https://github.com/MikhailProfile/SearchEverywhere/releases/tag/1.2.1

image

This works great! I've been playing around with it and have been liking it.

I was originally writing my own version of this type of feature before finding yours, so I was curious how your implementation works. Just wondering, how did you figure out that commands like "objectExplorer.scriptAsCreate" could be executed with vscode.commands.executeCommand(command, context)? My original implementation called azdata.QueryProvider.runQueryAndReturn with an explicit query that selected from sys.sql_modules. Then I saw that your 1.1.1 implementation used azdata.ScriptingProvider.scriptAsOperation which is pretty nifty. But I'm just wondering, for my own knowledge, how you figured out about the "objectExplorer.*" commands and why you chose to use them?

Thanks!

MikhailProfile commented 7 months ago

Hey, Derek,

Thanks for testing! I'm glad that it works for you. I'm consider to change version soon. For me it's not obvious that OE must be opened because ADS allow you to open query and connect to DB without it.

Regarding "objectExplorer.*" command, I was wonder how to add label of stored procedure to window label, and I wanted to use standard Edit and Design as right click in ADS. Issue Issue2

But there were no answers and one way out - analyse source code of ADS )) I just run it and put some break points to find out what's is going on inside. Pros - I could use standard staff. And now I have a nice label with the name of procedure. Cons - OE must be opened. I'm not sure that developers will not change anything in the future.