Skip to content

Commit cf5d033

Browse files
committed
LS support zed
but zed node version low
1 parent ea17250 commit cf5d033

File tree

13 files changed

+4376
-4495
lines changed

13 files changed

+4376
-4495
lines changed

.zed/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// For a full list of overridable settings, and general information on folder-specific settings,
44
// see the documentation: https://zed.dev/docs/configuring-zed#settings-files
55
{
6-
"auto_install_extension": {
6+
"auto_install_extensions": {
77
"biome": true,
88
"emmet": true,
99
"toml": true,

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

biome.jsonc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://raw.githubusercontent.com/biomejs/biome/refs/tags/%40biomejs/biome%402.0.0-beta.1/packages/%40biomejs/biome/configuration_schema.json",
2+
"$schema": "https://raw.githubusercontent.com/biomejs/biome/refs/tags/%40biomejs/biome%402.2.6/packages/%40biomejs/biome/configuration_schema.json",
33
"vcs": {
44
"enabled": true,
55
"clientKind": "git",
@@ -12,8 +12,7 @@
1212
"level": "on",
1313
"options": {
1414
"groups": [
15-
":NODE:",
16-
":BUN:",
15+
[":BUN:", ":NODE:"],
1716
":BLANK_LINE:",
1817
":PACKAGE:",
1918
":PACKAGE_WITH_PROTOCOL:",

crates/swc-plugin-gem/src/visitors/memo.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ impl TransformVisitor {
6060

6161
let first_arg = *call_expr.args.drain(0..1).next().unwrap().expr;
6262
if let Expr::Arrow(arrow_expr) = first_arg {
63-
let prop = format!("_dep_fn_{}", idx);
63+
let prop = format!("_dep_fn_{idx}");
6464
// 忽略了箭头函数的 `this` 绑定,模块中类成员装饰器参数中的 `this`
6565
// 会指向模块 正常情况下都不会使用
6666
// `this`,所以忽略也无所谓
@@ -114,7 +114,7 @@ impl VisitMut for TransformVisitor {
114114
kind: MethodKind::Method,
115115
key: PrivateName {
116116
span: DUMMY_SP,
117-
name: format!("_{}", getter_name).into(),
117+
name: format!("_{getter_name}").into(),
118118
},
119119
function: Box::new(Function {
120120
span: DUMMY_SP,
@@ -166,7 +166,7 @@ impl VisitMut for TransformVisitor {
166166
fn visit_mut_private_method(&mut self, node: &mut PrivateMethod) {
167167
if self.is_memo_getter(node) {
168168
let name = node.key.name.clone();
169-
let getter_name = format!("_{}", name);
169+
let getter_name = format!("_{name}");
170170

171171
node.key = PrivateName {
172172
span: DUMMY_SP,

crates/swc-plugin-gem/src/visitors/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl TransformVisitor {
3333
if let Some(relative_path) = relative_path.to_str() {
3434
let relative_path = relative_path.replace(".ts", ".js");
3535
if !relative_path.starts_with('.') {
36-
return format!("./{}", relative_path).into();
36+
return format!("./{relative_path}").into();
3737
} else {
3838
return relative_path.into();
3939
}

crates/zed-plugin-gem/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gem"
3-
version = "0.0.4"
3+
version = "0.0.5"
44
edition = { workspace = true }
55
rust-version = { workspace = true }
66
publish = false

crates/zed-plugin-gem/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn set_languages() -> anyhow::Result<()> {
5757
let append_content = fs::read_to_string("src/injections.scm")?;
5858

5959
writeln!(file)?;
60-
writeln!(file, "{}", append_content)?;
60+
writeln!(file, "{append_content}")?;
6161
}
6262

6363
Ok(())

crates/zed-plugin-gem/extension.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
id = "gem"
22
name = "Gem"
3-
description = "Gem plugin for Zed"
3+
description = "Language Support for Gem"
44
version = "0.0.4"
55
schema_version = 1
66
authors = ["mantou132 <709922234@qq.com>"]

crates/zed-plugin-gem/src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use serde::Deserialize;
44
use zed_extension_api::{self as zed, serde_json, Result};
55

66
const LS_PKG_NAME: &str = "vscode-gem-languageservice";
7-
const LS_BIN_PATH: &str = "node_modules/.bin/vscode-gem-languageservice";
7+
const LS_BIN_PATH: &str = "node_modules/vscode-gem-languageservice/dist/index.js";
88

99
const TS_PLUGIN_PACKAGE_NAME: &str = "ts-gem-plugin";
1010

@@ -145,6 +145,8 @@ impl zed::Extension for GemExtension {
145145
Ok(zed::Command {
146146
command: zed::node_binary_path()?,
147147
args: vec![
148+
// https://nodejs.org/docs/latest/api/modules.html#loading-ecmascript-modules-using-require
149+
"--experimental-require-module".to_string(),
148150
env::current_dir()
149151
.unwrap()
150152
.join(server_path)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"prepare": "husky install && pnpm prepare:build && pnpm prepare:link"
1212
},
1313
"devDependencies": {
14-
"@biomejs/biome": "^2.0.5",
14+
"@biomejs/biome": "^2.2.6",
1515
"@typescript/native-preview": "^7.0.0-dev.20250610.1",
1616
"@types/node": "^22.13.10",
1717
"concurrently": "^8.2.2",

0 commit comments

Comments
 (0)