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:
parent
a5fe6d1e61
commit
141ad72d97
4 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue