diff --git a/.changeset/added_support_for_json_and_jsonc_files.md b/.changeset/added_support_for_json_and_jsonc_files.md
new file mode 100644
index 0000000..a8f113f
--- /dev/null
+++ b/.changeset/added_support_for_json_and_jsonc_files.md
@@ -0,0 +1,5 @@
+---
+default: patch
+---
+
+# Added support for JSON and JSONC files
diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml
new file mode 100644
index 0000000..24583d1
--- /dev/null
+++ b/.github/workflows/pull_request.yml
@@ -0,0 +1,43 @@
+# Jobs run on pull request
+name: Pull request
+on:
+ workflow_dispatch:
+ pull_request:
+ branches:
+ - main
+
+env:
+ RUST_LOG: info
+ RUST_BACKTRACE: 1
+
+jobs:
+ format:
+ name: Format
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout PR branch
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
+ - name: Install toolchain
+ uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f # v1
+ with:
+ components: rustfmt
+ bins: taplo-cli
+ cache-base: main
+ - name: Run format
+ run: |
+ cargo fmt --all --check
+ taplo format --check
+
+ lint:
+ name: Lint Rust Files
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout PR Branch
+ uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
+ - name: Install toolchain
+ uses: moonrepo/setup-rust@b8edcc56aab474d90c7cf0bb8beeaf8334c15e9f # v1
+ with:
+ components: clippy
+ cache-base: main
+ - name: Run clippy
+ run: cargo clippy --all-targets -- --deny warnings
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..486aa17
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,2 @@
+# Changelog
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 2a278e7..f73989b 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -3,3 +3,36 @@
## Setup
For development instruction see [Authoring Zed Extensions](https://github.com/zed-industries/extensions/blob/main/AUTHORING_EXTENSIONS.md).
+
+## Development
+
+### Install the required tools
+
+We use [Just](https://just.systems/man/en/) to run scripts and tasks, to make our life easier.
+
+You can install `just` using cargo:
+
+```shell
+cargo install just
+```
+
+But we **highly recommend
+** to [install it using an OS package manager](https://github.com/casey/just#packages), so you won't need to prefix every command with `cargo`.
+
+Once installed, run the following command install the required tools:
+
+```shell
+just install-tools
+```
+
+1. Clone this repository.
+1. Open Zed
+1. Open the command palette Ctrl/⌘+⇧+P
+1. Run the `zed: install dev extensions` command.
+1. Select the directory of this repo.
+
+If you make changes to the Rust code and you require to reload the extension, you can open the "Extensions" tab by running the command `zed: extensions`, choose the `"Installed"`, seek the current extension and click the `"Rebuild"` label.
+
+#### Logs
+
+Zed will print logs in the following directory: `~/Library/Logs/Zed/Zed.log`
diff --git a/Cargo.lock b/Cargo.lock
index 0a15dcb..9f68db1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -14,6 +14,12 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
+[[package]]
+name = "cfg-if"
+version = "1.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
+
[[package]]
name = "equivalent"
version = "1.0.1"
@@ -58,6 +64,12 @@ version = "1.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"
+[[package]]
+name = "lazy_static"
+version = "1.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
+
[[package]]
name = "leb128"
version = "0.2.5"
@@ -70,6 +82,34 @@ version = "0.4.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c"
+[[package]]
+name = "nu-ansi-term"
+version = "0.46.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84"
+dependencies = [
+ "overload",
+ "winapi",
+]
+
+[[package]]
+name = "once_cell"
+version = "1.19.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
+
+[[package]]
+name = "overload"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
+
+[[package]]
+name = "pin-project-lite"
+version = "0.2.14"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02"
+
[[package]]
name = "proc-macro2"
version = "1.0.79"
@@ -131,6 +171,15 @@ dependencies = [
"serde",
]
+[[package]]
+name = "sharded-slab"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
+dependencies = [
+ "lazy_static",
+]
+
[[package]]
name = "smallvec"
version = "1.13.2"
@@ -157,6 +206,73 @@ dependencies = [
"unicode-ident",
]
+[[package]]
+name = "thread_local"
+version = "1.1.8"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
+dependencies = [
+ "cfg-if",
+ "once_cell",
+]
+
+[[package]]
+name = "tracing"
+version = "0.1.40"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef"
+dependencies = [
+ "pin-project-lite",
+ "tracing-attributes",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-attributes"
+version = "0.1.27"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
+dependencies = [
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "tracing-core"
+version = "0.1.32"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54"
+dependencies = [
+ "once_cell",
+ "valuable",
+]
+
+[[package]]
+name = "tracing-log"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
+dependencies = [
+ "log",
+ "once_cell",
+ "tracing-core",
+]
+
+[[package]]
+name = "tracing-subscriber"
+version = "0.3.18"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b"
+dependencies = [
+ "nu-ansi-term",
+ "sharded-slab",
+ "smallvec",
+ "thread_local",
+ "tracing-core",
+ "tracing-log",
+]
+
[[package]]
name = "unicode-ident"
version = "1.0.12"
@@ -175,6 +291,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
+[[package]]
+name = "valuable"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
+
[[package]]
name = "wasm-encoder"
version = "0.201.0"
@@ -211,6 +333,28 @@ dependencies = [
"semver",
]
+[[package]]
+name = "winapi"
+version = "0.3.9"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
+dependencies = [
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
+]
+
+[[package]]
+name = "winapi-i686-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
+
+[[package]]
+name = "winapi-x86_64-pc-windows-gnu"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+
[[package]]
name = "wit-bindgen"
version = "0.22.0"
@@ -305,16 +449,21 @@ dependencies = [
[[package]]
name = "zed_biome"
-version = "0.0.1"
+version = "0.0.3"
dependencies = [
+ "log",
+ "tracing",
+ "tracing-subscriber",
"zed_extension_api",
]
[[package]]
name = "zed_extension_api"
-version = "0.0.5"
+version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a5f4ae4e302a80591635ef9a236b35fde6fcc26cfd060e66fde4ba9f9fd394a1"
+checksum = "77ca8bcaea3feb2d2ce9dbeb061ee48365312a351faa7014c417b0365fe9e459"
dependencies = [
+ "serde",
+ "serde_json",
"wit-bindgen",
]
diff --git a/Cargo.toml b/Cargo.toml
index 1f72fe7..f3b39f0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,13 +1,16 @@
[package]
-name = "zed_biome"
-version = "0.0.1"
edition = "2021"
-publish = false
license = "MIT"
+name = "zed_biome"
+publish = false
+version = "0.0.3"
[lib]
-path = "src/biome.rs"
crate-type = ["cdylib"]
+path = "src/biome.rs"
[dependencies]
-zed_extension_api = "0.0.5"
+log = "0.4.21"
+tracing = "0.1.40"
+tracing-subscriber = "0.3.18"
+zed_extension_api = "0.0.6"
diff --git a/README.md b/README.md
index cbac6e2..678ecdd 100644
--- a/README.md
+++ b/README.md
@@ -10,12 +10,6 @@ Requires Zed >= **v0.131.0**.
This extension is available in the extensions view inside the Zed editor. Open `zed: extensions` and search for _Biome_.
-### Development
-
-1. Clone this repository.
-2. Run the `zed: install dev extensions` command.
-3. Select the directory of this repo.
-
## Configuration
Example configurations in zed `settings.json`.
diff --git a/extension.toml b/extension.toml
index f14a573..7dba51b 100644
--- a/extension.toml
+++ b/extension.toml
@@ -1,29 +1,24 @@
-id = "biome"
-name = "Biome"
-description = "Biome support for Zed"
-version = "0.0.2"
+authors = ["biomejs "]
+description = "Biome support for Zed"
+id = "biome"
+name = "Biome"
+repository = "https://github.com/biomejs/biome-zed"
schema_version = 1
-authors = ["biomejs "]
-repository = "https://github.com/biomejs/biome-zed"
+version = "0.0.3"
[language_servers.biome]
-name = "Biome Language Server"
-language = "JavaScript"
-languages = [
- "JavaScript",
- "JSX",
- "TypeScript",
- "TSX",
- "Vue.js",
- "Astro",
- "Svelte",
-]
+code_actions_kind = ["", "quickfix"]
+language = "JavaScript"
+languages = ["JavaScript", "JSX", "TypeScript", "TSX", "Vue.js", "Astro", "Svelte", "JSON", "JSONC"]
+name = "Biome Language Server"
[language_servers.biome.language_ids]
+"Astro" = "astro"
+"JSON" = "json"
+"JSONC" = "jsonc"
+"JSX" = "javascriptreact"
"JavaScript" = "javascript"
-"JSX" = "javascriptreact"
+"Svelte" = "svelte"
+"TSX" = "typescriptreact"
"TypeScript" = "typescript"
-"TSX" = "typescriptreact"
-"Vue.js" = "vuejs"
-"Astro" = "astro"
-"Svelte" = "svelte"
+"Vue.js" = "vuejs"
diff --git a/justfile b/justfile
new file mode 100644
index 0000000..884e6c3
--- /dev/null
+++ b/justfile
@@ -0,0 +1,21 @@
+
+alias f := fmt
+alias l := lint
+
+# Install interal tools to manage the repository
+install-tools:
+ cargo install cargo-binstall
+ cargo binstall taplo-cli knope
+
+# Format files
+fmt:
+ cargo fmt
+ taplo format
+
+# Lint files
+lint:
+ cargo clippy --all-targets
+
+# Document change
+changeset:
+ knope document-change
\ No newline at end of file
diff --git a/knope.toml b/knope.toml
new file mode 100644
index 0000000..5558ab4
--- /dev/null
+++ b/knope.toml
@@ -0,0 +1,3 @@
+[package]
+changelog = "CHANGELOG.md"
+versioned_files = ["Cargo.toml"]
diff --git a/src/biome.rs b/src/biome.rs
index e42b42c..3e30443 100644
--- a/src/biome.rs
+++ b/src/biome.rs
@@ -1,5 +1,5 @@
use std::{env, fs};
-use zed_extension_api::{self as zed, Result};
+use zed_extension_api::{self as zed, LanguageServerId, Result};
const SERVER_PATH: &str = "node_modules/.bin/biome";
const PACKAGE_NAME: &str = "@biomejs/biome";
@@ -13,14 +13,14 @@ impl BiomeExtension {
fs::metadata(SERVER_PATH).map_or(false, |stat| stat.is_file())
}
- fn server_script_path(&mut self, ls_id: &String) -> Result {
+ fn server_script_path(&mut self, language_server_id: &LanguageServerId) -> Result {
let server_exists = self.server_exists();
if self.did_find_server && server_exists {
return Ok(SERVER_PATH.to_string());
}
zed::set_language_server_installation_status(
- ls_id,
+ language_server_id,
&zed::LanguageServerInstallationStatus::CheckingForUpdate,
);
let version = zed::npm_package_latest_version(PACKAGE_NAME)?;
@@ -29,7 +29,7 @@ impl BiomeExtension {
|| zed::npm_package_installed_version(PACKAGE_NAME)?.as_ref() != Some(&version)
{
zed::set_language_server_installation_status(
- &ls_id,
+ language_server_id,
&zed::LanguageServerInstallationStatus::Downloading,
);
let result = zed::npm_install_package(PACKAGE_NAME, &version);
@@ -63,17 +63,17 @@ impl zed::Extension for BiomeExtension {
fn language_server_command(
&mut self,
- config: zed::LanguageServerConfig,
+ language_server_id: &LanguageServerId,
_worktree: &zed::Worktree,
) -> Result {
- let path = self.server_script_path(&config.name)?;
+ let path = self.server_script_path(language_server_id)?;
Ok(zed::Command {
command: zed::node_binary_path()?,
args: vec![
env::current_dir()
.unwrap()
- .join(&path)
+ .join(path)
.to_string_lossy()
.to_string(),
"lsp-proxy".to_string(),
diff --git a/taplo.toml b/taplo.toml
new file mode 100644
index 0000000..ee184cc
--- /dev/null
+++ b/taplo.toml
@@ -0,0 +1,6 @@
+include = ["Cargo.toml", "extension.toml"]
+
+[formatting]
+align_entries = true
+column_width = 120
+reorder_keys = true