zed
zed copied to clipboard
When implementing a Zed extension, path_suffixes doesn't support dots (ex: filename.cf.sub)
Check for existing issues
- [X] Completed
I found this other issue which seems almost the same, except it talks about wildcards:
https://github.com/zed-industries/zed/issues/8466
Describe the bug / provide steps to reproduce it
My extension:
https://github.com/olehermanse/zed-cfengine
Is not highlighting some of our test files which use the .cf.sub
extension:
https://github.com/cfengine/core/blob/d7227da3cb47cbe8b6079559acac3cb6374f1a10/tests/acceptance/run_with_server.cf.sub
Even though I added it to the path_suffixes
:
https://github.com/olehermanse/zed-cfengine/commit/f854236be02efc5cace5a731171081730da8fffc
As a programmer, I can understand why Zed would consider the extension / suffix anything after the last .
, however as a user / extension author, I'd expect what I tried to do to "just work". Essentially, I'd expect the logic for path_suffixes
to match any files which end with one of those strings (even if one of those strings include a .
).
Workaround: I guess I could add just sub
to path_suffixes
to make it work for myself, but that doesn't "feel right" as it would conflict with any other language files which might end in .sub
.
Environment
Zed: v0.131.7 (Zed) OS: macOS 14.4.1 Memory: 32 GiB Architecture: x86_64
I believe this PR #10960 can promote this matter
I have a similar issue working on a lang extension for Laravel Blade files, which use the suffix .blade.php
. Using path_suffixes = ["blade.php"]
doesn't work as Zed still opens these files as just PHP. There was limited discussion on the original extensions tracking issue, and it was suggested that using the longest matching suffix could be 1 way to disambiguate which extension/language to use for a given file.