microsoft / VSExtensibility

A repo for upcoming changes to extensibility in Visual Studio, the new extensibility model, and language server protocol.
MIT License
370 stars 48 forks source link

Save Extension data on Editor level #263

Open pasdut opened 1 year ago

pasdut commented 1 year ago

Hi,

My use case is : I want to add a margin to a SQL editor that shows all the tables of the current database in a Datagrid. However I'm looking for a way to show/hide that data grid on per document base. So by default the datagrid is visible on all SQL documents. However, the user should be able to hide the datagrid whenever it gets in the way. So it could be that the grid is visible in Query1.sql, but for instance not in Query2.sql. So I probably need a flag on Document level that keeps the Datagrid visibility. Or do you know of better ways ?

Thanks in advance

BertanAygun commented 1 year ago

You would have to maintain your own mapping from document path to users choice. If you are using VSSDK, you can look in to https://learn.microsoft.com/en-us/visualstudio/extensibility/internals/solution-user-options-dot-suo-file?view=vs-2022 for storing these in the "suo" files that will persist across sessions and will also get cleaned-up if solution is removed from the disk.