Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exceptions for filenames in contributes.languages #105590

Closed
bwateratmsft opened this issue Aug 28, 2020 · 5 comments
Closed

Exceptions for filenames in contributes.languages #105590

bwateratmsft opened this issue Aug 28, 2020 · 5 comments
Assignees
Labels
api feature-request Request for new features or functionality

Comments

@bwateratmsft
Copy link
Contributor

Today the contributes.languages feature allows for matching on filenames, extensions, MIME types, and first lines. In the Docker extension we recently decided to treat Dockerfile.* as a Dockerfile. We saw a very long tail of users with different extensions--e.g. Dockerfile.develop, Dockerfile.amd64, Dockerfile.myapp, etc.--too many to practically list out individually in our package manifest. So we changed it to Dockerfile.* so we could cover all of those users.

This approach made it so our extension had the right file association in about 80% of cases, whereas before we covered more like 20%. However, there are some relatively common examples--e.g. Dockerfile.go--that are not Dockerfiles. In these situations we're incorrect. Since the number of common filenames that aren't Dockerfiles seems to be relatively small, we thought it would be nice to be able to add exceptions to the Dockerfile.* rule.

@simpleapples
Copy link

Hi, guys. I'm not so sure about this feature request.

First, the file extension is the top priority when detecting a file type. It's a rule which we shouldn't break. If vscode treats a Dockerfile.go or Dockerfile.js as a Dockerfile, it will cause confusions for some developers (like me, as shown on microsoft/vscode-docker#2128) . it looks like a bug not a feature.

Second, the Dockerfile has a relatively simple format which most developers can write a Dockerfile correctly without a formatter. Docker extension of vscode is doing well now, there is no need to cover all possibility, especially with the cases of mistaken identity.

I know @bwateratmsft was devoted to find a better solution for this, but I have to vote no before a better solution.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants
@bpasero @deepak1556 @simpleapples @alexdima @bwateratmsft and others