Skip to content

Commit 423655b

Browse files
committed
feat: expand Zed language support
1 parent 1a71163 commit 423655b

8 files changed

Lines changed: 45 additions & 33 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
tag:
77
description: Exact release tag to preflight
88
required: true
9-
default: v0.1.0
9+
default: v0.2.0
1010
type: string
1111
push:
1212
tags:

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ members = [
77
resolver = "2"
88

99
[workspace.package]
10-
version = "0.1.0"
10+
version = "0.2.0"
1111
edition = "2024"
1212
license = "MIT"
1313
authors = ["nazzeDe"]

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ Native Rust LSP (`code-translate-lsp`) + Zed extension. No online translation; n
66

77
## Support
88

9-
Languages: Rust, Python, Go, JavaScript, TypeScript, Markdown.
9+
Identifier translation is language-agnostic and works with all languages. In Zed, it is enabled for common built-in and extension-provided languages.
1010

1111
Hover resolves the identifier under the cursor (camelCase / snake_case / etc.). Only dictionary hits are shown. Works alongside native language servers.
1212

13-
Not included: selection translation, settings UI, custom dictionaries, JSX/TSX, non-Zed editors, 32-bit hosts.
13+
Not included: selection translation, settings UI, custom dictionaries, non-Zed editors, 32-bit hosts.
1414

1515
## Develop
1616

crates/code-translate-lsp/tests/process.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use support::{ProcessResult, TestServer};
1313

1414
const SOURCE_TEXT_SENTINEL: &str = "SOURCE_TEXT_SENTINEL_7c91";
1515
const PARAMETER_SENTINEL: &str = "PARAMETER_SENTINEL_48ad";
16+
const SERVER_VERSION: &str = env!("CARGO_PKG_VERSION");
1617
const HELLO_MARKDOWN: &str = "[**hello**](https://translate.google.com/?sl=en&tl=zh-CN&text=hello&op=translate) hә\\'lәu \ninterj\\. 喂\\, 嘿";
1718
const ABANDON_MARKDOWN: &str = "[**abandon**](https://translate.google.com/?sl=en&tl=zh-CN&text=abandon&op=translate) ә\\'bændәn \nvt\\. 放弃\\, 抛弃\\, 遗弃\\, 使屈从\\, 沉溺\\, 放纵 \nn\\. 放任\\, 无拘束\\, 狂热";
1819
const WORLD_MARKDOWN: &str = "[**world**](https://translate.google.com/?sl=en&tl=zh-CN&text=world&op=translate) wә\\:ld \nn\\. 世界\\, 地球\\, 宇宙\\, 万物\\, 世人\\, 人间\\, 领域\\, 世事\\, 世故\\, 社会生活\\, 大量 \n\\[法\\] 世界\\, 地球\\, 世人";
@@ -171,7 +172,7 @@ fn verified_baseline_transcript_returns_exact_hover_and_tracks_incremental_chang
171172
"textDocumentSync": 2,
172173
"hoverProvider": true
173174
},
174-
"serverInfo": {"name": "code-translate-lsp", "version": "0.1.0"}
175+
"serverInfo": {"name": "code-translate-lsp", "version": SERVER_VERSION}
175176
}
176177
})
177178
);
@@ -642,7 +643,7 @@ fn version_prints_the_release_version() {
642643
.expect("failed to run code-translate-lsp");
643644

644645
assert!(output.status.success());
645-
assert_eq!(output.stdout, b"0.1.0\n");
646+
assert_eq!(output.stdout, format!("{SERVER_VERSION}\n").into_bytes());
646647
assert!(output.stderr.is_empty());
647648
}
648649

extensions/code-translate/extension.toml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id = "code-translate-lsp"
22
name = "Code Translate"
33
description = "Offline identifier translation for Zed"
4-
version = "0.1.0"
4+
version = "0.2.0"
55
schema_version = 1
66
authors = ["nazzeDe"]
77
repository = "https://github.com/nazzeDe/code-translate"
@@ -12,7 +12,37 @@ version = "0.7.0"
1212

1313
[language_servers.code-translate-lsp]
1414
name = "Code Translate"
15-
languages = ["Rust", "Python", "Go", "JavaScript", "TypeScript", "Markdown"]
15+
languages = [
16+
"Rust",
17+
"Python",
18+
"Go",
19+
"JavaScript",
20+
"TypeScript",
21+
"Markdown",
22+
"C",
23+
"C++",
24+
"CSharp",
25+
"Java",
26+
"Kotlin",
27+
"Swift",
28+
"Ruby",
29+
"PHP",
30+
"Lua",
31+
"Zig",
32+
"Dart",
33+
"Scala",
34+
"Haskell",
35+
"Elixir",
36+
"Shell Script",
37+
"SQL",
38+
"HTML",
39+
"CSS",
40+
"JSON",
41+
"JSONC",
42+
"YAML",
43+
"TOML",
44+
"TSX",
45+
]
1646

1747
[[capabilities]]
1848
kind = "download_file"

extensions/code-translate/src/lib.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -200,29 +200,9 @@ mod tests {
200200
use super::*;
201201

202202
#[test]
203-
fn manifest_registers_only_the_approved_languages_and_capability() {
203+
fn manifest_restricts_download_capability_to_release_assets() {
204204
let manifest = extension_manifest();
205205

206-
let languages = manifest["language_servers"][LANGUAGE_SERVER_ID]["languages"]
207-
.as_array()
208-
.expect("language server languages must be an array")
209-
.iter()
210-
.map(|language| language.as_str().expect("language must be a string"))
211-
.collect::<Vec<_>>();
212-
assert_eq!(
213-
languages,
214-
[
215-
"Rust",
216-
"Python",
217-
"Go",
218-
"JavaScript",
219-
"TypeScript",
220-
"Markdown"
221-
]
222-
);
223-
assert!(!languages.contains(&"JSX"));
224-
assert!(!languages.contains(&"TSX"));
225-
226206
let capabilities = manifest["capabilities"]
227207
.as_array()
228208
.expect("capabilities must be an array");

tests/test_release.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ def test_malformed_archive_is_rejected(self):
108108

109109
def test_version_mismatched_asset_is_rejected(self):
110110
archive = next(self.assets.glob("*.zip"))
111-
archive.rename(archive.with_name(archive.name.replace(TAG, "v0.2.0")))
111+
mismatched_tag = "v0.0.0" if TAG != "v0.0.0" else "v0.0.1"
112+
archive.rename(archive.with_name(archive.name.replace(TAG, mismatched_tag)))
112113
result = self.preflight(expect_ok=False)
113114
self.assertIn("version", result.stderr)
114115

0 commit comments

Comments
 (0)