BartPermentier / al-toolbox

Adds Features to the AL Language Extension
MIT License
13 stars 9 forks source link

Disable some ALTB snippets? #79

Closed fvet closed 11 months ago

fvet commented 2 years ago

I'd like to disable some snippets from ALTB using the 'Insert Snippet' command and then click the 'Hide' button.

image

However, none of the ALTB snippets are listed.

image

Can you verify if snippets could be listed here too?

BartPermentier commented 2 years ago

@dsaveyn I think this is because our snippets are dynamic (atleast the ones with regions around them). I don't know if we can add some snippets the normal way?

dsaveyn commented 1 year ago

@dsaveyn I think this is because our snippets are dynamic (atleast the ones with regions around them). I don't know if we can add some snippets the normal way?

@BartPermentier You're right. We are inserting the snippets using a SnippetCompletionItemProvider at runtime. Other extensions, for example CRS, specify the snippets in the package.json file like this:

image

We could adjust the ALTB snippets so they work in a similar way, but then we need to adjust the files at runtime to support our variable settings.

BartPermentier commented 1 year ago

If it's possible then do it ;)

dsaveyn commented 11 months ago

We reviewed this internally and we see some problems here: our snippets are dynamically generated and adjusted. For this we use a custom completion provider. One of the side effects of using this is that the snippets do not show up in the Snippets: Insert Snippet functionality. Only snippets files that are pre-defined are displayed there. Currently there's no way to easily solve this. We were thinking of generating the snippet files and writing them when loading the extension, but this requires some major rework and is not the cleanest solution. For now we will not tackle this.