-
-
Notifications
You must be signed in to change notification settings - Fork 9
feat: add Zed extension and make language server editor-agnostic #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e6b8b2d
c9e210b
41d29a8
8baf11f
e922aaa
a4ef65d
3601a47
bd342c7
5723821
fea3872
2fe4301
e94126d
07e5986
fc8da4e
eaae9c3
a4311c0
91eebca
8e6b4eb
b53f855
c751f50
aaca028
9fe8e0c
5ae5306
4e5451d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Publish Language Server | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
|
|
||
| jobs: | ||
| publish-language-server: | ||
| permissions: | ||
| contents: write | ||
|
|
||
| runs-on: ubuntu-slim | ||
| steps: | ||
| - name: Setup JS | ||
| uses: sxzz/workflows/setup-js@69098296b6f6083ed99f38e2040f2a7238580e27 # v1.4.0 | ||
| with: | ||
| fetch-all: true | ||
|
|
||
| - name: Build | ||
| run: pnpm build | ||
|
|
||
| - name: Verify language server version | ||
| run: | | ||
| expected_version="${GITHUB_REF_NAME#v}" | ||
| actual_version="$(sed -n 's/^ \"version\": \"\(.*\)\",$/\1/p' packages/language-server/package.json | head -n 1)" | ||
| if [ "$actual_version" != "$expected_version" ]; then | ||
| echo "Expected packages/language-server/package.json version $expected_version but found $actual_version" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Pack language server | ||
| working-directory: packages/language-server | ||
| run: pnpm pack | ||
|
|
||
| - name: Rename tarball | ||
| working-directory: packages/language-server | ||
| run: mv npmx-language-server-*.tgz "npmx-language-server-${GITHUB_REF_NAME#v}.tgz" | ||
|
|
||
| - name: Upload language server tarball | ||
| uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.0.8 | ||
| with: | ||
| files: packages/language-server/npmx-language-server-*.tgz |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| name: Publish Zed Extension | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
|
|
||
| jobs: | ||
| publish-zed-extension: | ||
| permissions: | ||
| contents: write | ||
|
|
||
| runs-on: ubuntu-slim | ||
| steps: | ||
| - name: Setup JS | ||
| uses: sxzz/workflows/setup-js@69098296b6f6083ed99f38e2040f2a7238580e27 # v1.4.0 | ||
| with: | ||
| fetch-all: true | ||
|
|
||
| - name: Verify Zed extension version | ||
| run: | | ||
| expected_version="${GITHUB_REF_NAME#v}" | ||
| actual_version="$(sed -n 's/^version = \"\(.*\)\"$/\1/p' extensions/zed/extension.toml | head -n 1)" | ||
| if [ "$actual_version" != "$expected_version" ]; then | ||
| echo "Expected extensions/zed/extension.toml version $expected_version but found $actual_version" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Update Zed extensions registry | ||
| uses: huacnlee/zed-extension-action@v2 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check if the file exists and read the relevant section
if [ -f .github/workflows/publish-zed.yml ]; then
echo "=== File exists, reading lines 20-40 for context ==="
sed -n '20,40p' .github/workflows/publish-zed.yml | cat -n
echo ""
echo "=== Full workflow file ==="
cat -n .github/workflows/publish-zed.yml
else
echo "File not found"
fiRepository: npmx-dev/vscode-npmx Length of output: 2566 🏁 Script executed: # Check other workflow files to understand pinning patterns in the repo
echo "=== Searching for action usage patterns across all workflows ==="
find .github/workflows -name "*.yml" -o -name "*.yaml" | while read f; do
echo "--- File: $f ---"
rg "uses:" "$f" | head -20
doneRepository: npmx-dev/vscode-npmx Length of output: 1127 Pin the Zed publish action to a commit SHA. Line 30 uses a mutable tag ( |
||
| with: | ||
| extension-name: npmx | ||
| # TODO: Update this to the correct fork before enabling automated publishing. | ||
| push-to: withxat/issue-zed-extensions | ||
| env: | ||
| # TODO: Add the COMMITTER_TOKEN secret before enabling automated publishing. | ||
| COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }} | ||
|
Comment on lines
+33
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not keep placeholder publishing config in an active tag-triggered workflow. Line 33–Line 37 still point to a temporary fork and TODO token setup while Line 4–Line 6 already publish on |
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| /target | ||
| /extension.wasm | ||
| /Cargo.lock |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [package] | ||
| name = "zed-npmx" | ||
| version = "0.7.0" | ||
| edition = "2021" | ||
| license = "MIT" | ||
| publish = false | ||
|
|
||
| [lib] | ||
| crate-type = [ "cdylib" ] | ||
|
|
||
| [dependencies] | ||
| serde_json = "1" | ||
| zed_extension_api = "0.7.0" | ||
|
withxat marked this conversation as resolved.
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2026 Xat | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # npmx for Zed | ||
|
|
||
| This is the in-repo Zed extension for `npmx`. It runs the shared `npmx-language-server` | ||
| over stdio, so Zed gets the same core package intelligence used by the VS Code extension. | ||
|
|
||
| ## Status | ||
|
|
||
| - Uses the shared `npmx-language-server` | ||
| - Targets local development from this monorepo first | ||
| - Defaults to `packages/language-server/dist/index.cjs` | ||
| - Launches the language server over `--stdio` | ||
| - Supports overriding the launched command through Zed `lsp.npmx.binary` settings | ||
| - Forwards `lsp.npmx.settings` to the language server as `npmx` workspace configuration | ||
|
|
||
| ## Features | ||
|
|
||
| - Hover links to package pages and docs on [npmx.dev](https://npmx.dev) | ||
| - Emoji hover icons for non-VS Code editors | ||
| - Version completion with provenance and prerelease settings | ||
| - Diagnostics for upgrades, deprecations, replacements, vulnerabilities, dist tags, and engine mismatches | ||
| - Document links for package names | ||
| - Workspace-aware dependency resolution for npm, pnpm, yarn, and bun projects | ||
|
|
||
| ## Local Development | ||
|
|
||
| 1. Build the language server from the repo root with `pnpm build`. | ||
| 2. In Zed, install `extensions/zed` as a dev extension. | ||
| 3. If you want a custom launch command, configure `lsp.npmx.binary` in your Zed settings. | ||
|
|
||
| ## Settings | ||
|
|
||
| Zed settings under `lsp.npmx.settings` are forwarded directly to the language server. | ||
| Use scoped npmx settings without the leading `npmx.` prefix: | ||
|
|
||
| ```json | ||
| { | ||
| "lsp": { | ||
| "npmx": { | ||
| "settings": { | ||
| "hover": { | ||
| "enabled": true | ||
| }, | ||
| "completion": { | ||
| "version": "provenance-only", | ||
| "excludePrerelease": true | ||
| }, | ||
| "diagnostics": { | ||
| "upgrade": true, | ||
| "deprecation": true, | ||
| "replacement": true, | ||
| "vulnerability": true, | ||
| "distTag": true, | ||
| "engineMismatch": true | ||
| }, | ||
| "packageLinks": "declared" | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| To override the launched language server command: | ||
|
|
||
| ```json | ||
| { | ||
| "lsp": { | ||
| "npmx": { | ||
| "binary": { | ||
| "path": "node", | ||
| "arguments": [ | ||
| "/absolute/path/to/vscode-npmx/packages/language-server/dist/index.cjs", | ||
| "--stdio" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| - Zed dev extensions require Rust installed via `rustup`; the Zed docs explicitly call out that Homebrew Rust will not work for dev extension compilation. | ||
| - This dev extension expects the repo-local language server bundle at `packages/language-server/dist/index.cjs`, so build the monorepo before installing it in Zed. | ||
| - If you override `lsp.npmx.binary`, make sure the launched server process still receives an LSP transport argument such as `--stdio`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| id = "npmx" | ||
| name = "npmx" | ||
| description = "npmx language support for Zed" | ||
| version = "0.7.0" | ||
| schema_version = 1 | ||
| authors = [ "Xat <i@xat.sh>" ] | ||
| repository = "https://github.com/npmx-dev/vscode-npmx/tree/main/extensions/zed" | ||
|
|
||
| [language_servers.npmx] | ||
| name = "npmx" | ||
| languages = [ | ||
| "JSON", | ||
| "YAML", | ||
| "JavaScript", | ||
| "JSX", | ||
| "TypeScript", | ||
| "TSX", | ||
| "HTML", | ||
| "Vue", | ||
| "Astro", | ||
| "Svelte" | ||
| ] | ||
|
|
||
| [language_servers.npmx.language_ids] | ||
| JSON = "json" | ||
| YAML = "yaml" | ||
| JavaScript = "javascript" | ||
| JSX = "javascriptreact" | ||
| TypeScript = "typescript" | ||
| TSX = "typescriptreact" | ||
| HTML = "html" | ||
| Vue = "vue" | ||
| Astro = "astro" | ||
| Svelte = "svelte" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not merge with tag publishing disabled unless this is intentionally permanent.
Line 4–Line 8 remove automatic tag-triggered publishing, which can silently halt VS Code release automation on
v*tags. If this is temporary, gate it behind a short-lived branch-only change or restore the trigger before merge.