zed
                                
                                 zed copied to clipboard
                                
                                    zed copied to clipboard
                            
                            
                            
                        Request to add feature setting match file type by using regex.
Check for existing issues
- [X] Completed
Describe the feature
Currently, I saw file_types only matches word by word. Can team support to match by regex?
"file_types": {
    "Dockerfile": [
      "Dockerfile",
      "Dockerfile.dev",
      "Dockerfile.prod",
      "Dockerfile.uat"
    ]
  }
------> It worked.
"file_types": {
    "Dockerfile": [
      "Dockerfile",
      "Dockerfile.*",
    ]
  }
-----> it didn't work
If applicable, add mockups / screenshots to help present your vision of the feature
No response
I think a better alternative would be to support matching via globs, not regexes; https://docs.rs/glob/latest/glob/ It's less powerful than a regex, but it should suffice for your use case.
Nice, anyone can help me, will be my first issue, I can try fix it.
Sure! For starters, this function does path filtering: https://github.com/zed-industries/zed/blob/74241d9f935158dc113040c3d2c8b3785fdf0f09/crates/language/src/language_registry.rs#L472
user_file_types is a deserialized content of file_types, e.g. for the example provided in original post:
"file_types": {
    "Dockerfile": [
      "Dockerfile",
      "Dockerfile.dev",
      "Dockerfile.prod",
      "Dockerfile.uat"
    ]
  }
user_file_types is gonna be Some({"Dockerfile": [ "Dockerfile", "Dockerfile.dev", "Dockerfile.prod", "Dockerfile.uat" ]}).
It then follows that all you have to do is change the code within the call to any to use globs instead: https://github.com/zed-industries/zed/blob/74241d9f935158dc113040c3d2c8b3785fdf0f09/crates/language/src/language_registry.rs#L488
I opened this PR #10960. I'm a newcomer, so please if someone can review and give me a feedback.
I believe the issue I am running into with my angular LSP is similar to this one. From what I gather, the Angular LSP should only be applied to HTML files that have a component prefix to the suffix IE app.component.html I made a branch that fixed this issue, but reading here it looks like it's not the desired solution. However, pulling down PR #10960 I am not seeing how I can get the LSP to recognize angular files.
Edit: After looking into this some more, I see that this only effects language overrides in the config, so it's not exactly what I am looking for in regard to my language server issues.
I made PR #12043 to work on this. I picked up the work from where @guibes stopped, taking note of the reviews from @osiewicz.
This is gonna land in next Preview on Wednesday, 22.05. Thanks for getting this across the line @farayolaj :)
This is now available in v0.136.0-pre.
is it possible to show docker image near file that is considered dockerfile?