zed
zed copied to clipboard
A settings to allow mapping file types to known languages in Zed
Check for existing issues
- [X] Completed
Is your feature request related to a problem?
I want to see Cargo.lock content with highlights syntax’s.
Describe the solution you'd like
Add a setting to settings.json
If applicable, add mockups / screenshots to help present your vision of the feature
settings.json
{
"files": {
"associations": {
"*.avsc": "json",
"Cargo.lock": "toml"
}
}
}
I'm not sure if this qualifies as the same issue; however, I work on a project which for historic reasons is C++ code with .c
file extensions. It would be nice if I could say "hey in this project (or even globally) treat .c
as .cc/cpp
"
I'm wondering if the suggested structure should be flipped so that a list could be used. The structure would be saying "apply this language's syntax highlighting to the following languages":
{
"files": {
"associations": {
"json": ["*.avsc"],
"toml": ["Cargo.lock"],
}
}
}
I'm not sure. This would reduce duplication, but maybe it feels a bit backwards?
This would be a great stop-gap for Svelte support, as Svelte users could associate their .svelte files with HTML
A million times, yes.
since there are already many many requests for language support it would make sense to allow custom languages and also to easily install language defs from others. really you would only need file extensions and lsps
I'm wondering if the suggested structure should be flipped so that a list could be used. The structure would be saying "apply this language's syntax highlighting to the following languages":
{ "files": { "associations": { "json": ["*.avsc"], "toml": ["Cargo.lock"], } } }
I'm not sure. This would reduce duplication, but maybe it feels a bit backwards?
+1 This seems easier and more practical. Simply list all associated filetypes per language.
In addition to adding this type of configuration, we should also populate some defaults, such as those suggested in:
- https://github.com/zed-industries/zed/issues/6236
This would be a huge step forward for Zed already. Currently, Zed becomes not useable for most of my projects, just because it lacks some languages (e.g. SCSS). But if I am able to map SCSS to the CSS engine (syntax highlighting, basic formatting/completion) it would be a huge step forward.
Has anyone started working on this?
Has anyone started working on this?
Not that I'm aware of. Feel free to open a PR if it's something you're interested in. :)
Has anyone started working on this?
Not that I'm aware of. Feel free to open a PR if it's something you're interested in. :)
I'm trying to implement this, but I found that the current architecture assumes LanguageConfig
is static and will not be updated by any Settings
, the path_suffixes
in LanguageConfig
for each language is loaded by languages::init(languages.clone(), node_runtime.clone(), cx)
before user's local settings and project settings are loaded. Are there any APIs or callbacks, like onLocalSettingsLoaded
, that we can use to update the language configs after local settings are loaded?
Has anyone started working on this?
Not that I'm aware of. Feel free to open a PR if it's something you're interested in. :)
I'm trying to implement this, but I found that the current architecture assumes
LanguageConfig
is static and will not be updated by anySettings
, thepath_suffixes
inLanguageConfig
for each language is loaded bylanguages::init(languages.clone(), node_runtime.clone(), cx)
before user's local settings and project settings are loaded. Are there any APIs or callbacks, likeonLocalSettingsLoaded
, that we can use to update the language configs after local settings are loaded?
Another solution may be to pass AppContext
as an argument to language_for_file
, language_for_name_or_extension
in order to load the user's custom path suffixes settings, however, it requires a lot of changes.