extension: Use heck instead of convert_case for snake_case check (#28608)

This PR updates the snake_case check for grammar names to use `heck`
instead of `convert_case`.

`heck` correctly handles values like `d2`.

Fixes https://github.com/zed-industries/zed/issues/28583.

Release Notes:

- Updated snake_case check for grammar names in extensions.
This commit is contained in:
Marshall Bowers 2025-04-11 16:01:25 -06:00 committed by GitHub
parent a5fe6d1e61
commit 141ad72d97
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 4 deletions

View file

@ -17,10 +17,10 @@ async-compression.workspace = true
async-tar.workspace = true
async-trait.workspace = true
collections.workspace = true
convert_case.workspace = true
fs.workspace = true
futures.workspace = true
gpui.workspace = true
heck.workspace = true
http_client.workspace = true
language.workspace = true
log.workspace = true

View file

@ -4,9 +4,9 @@ use crate::{
use anyhow::{Context as _, Result, anyhow, bail};
use async_compression::futures::bufread::GzipDecoder;
use async_tar::Archive;
use convert_case::{Case, Casing as _};
use futures::AsyncReadExt;
use futures::io::BufReader;
use heck::ToSnakeCase;
use http_client::{self, AsyncBody, HttpClient};
use serde::Deserialize;
use std::{
@ -106,7 +106,7 @@ impl ExtensionBuilder {
}
for (grammar_name, grammar_metadata) in &extension_manifest.grammars {
let snake_cased_grammar_name = grammar_name.to_case(Case::Snake);
let snake_cased_grammar_name = grammar_name.to_snake_case();
if grammar_name.as_ref() != snake_cased_grammar_name.as_str() {
bail!(
"grammar name '{grammar_name}' must be written in snake_case: {snake_cased_grammar_name}"