UIKit-VSCode icon indicating copy to clipboard operation
UIKit-VSCode copied to clipboard

Restrict snippet suggestions to appropriate languages

Open simsrw73 opened this issue 4 years ago • 3 comments

With this extension enabled, I get uikit suggestions when editing every other file type, eg C++. Please update your package.json to restrict suggestions to the appropriate languages, ie html.

simsrw73 avatar Sep 11 '21 09:09 simsrw73

Please see https://github.com/dons20/UIKit-VSCode/issues/17#issuecomment-467863037

There are many possible language files which would have to be maintained manually, so it's better for each user to decide this on their own using custom workspace settings.

dons20 avatar Sep 11 '21 11:09 dons20

Sorry, I may be missing it, but it looks like the suggestions there completely disable all snippet suggestions on other languages. I don't want to disable my other snippets because one extension has decided to pollute the entire global namespace. I'm very grateful for the work you've put into your extension; it has many useful snippets. But it feels very rude to have it pollute all language namespaces. None of the other snippet extensions that I have installed do that and neither do many others that I've just spot-checked. Your previous version (package.json) feels like the more correct (if not perfect) approach.

simsrw73 avatar Sep 11 '21 15:09 simsrw73

The issue is that, manually maintaining a list of supported languages becomes very difficult to maintain after a while. There may be some subtle use cases in which a user wants to have these snippets in some obscure language that wasn't already covered. The snippets don't show up at all unless the user changes the preferred language of that file to match one of the supported ones.

I've had a couple users in the past suggest some extra supported languages which made maintenance of it a lot more tedious.

One of the suggestions I made in that other thread was to disable the extension by default, and then enable it in specific workspaces in which you know that you will need it. In a practical scenario, this means that if you're working with a typical web project, it would make sense to have those snippets enabled, while in another project (C++, Java, etc) it wouldn't make sense to show those at all.

If there's a way that users can specify supported languages on their own in addition to the provided defaults, then I'd be totally fine with reverting to the older format, but if I set it to that right now, it means that the snippets will not show up in certain files at all.

dons20 avatar Sep 11 '21 22:09 dons20