Skip to content

fix: upgrade to zed_extension_api 0.7.0 and improve Linux compatibility - #4

Open
igoforth wants to merge 1 commit into
dawsh2:mainfrom
igoforth:fix/linux-compatibility-and-api-upgrade
Open

fix: upgrade to zed_extension_api 0.7.0 and improve Linux compatibility#4
igoforth wants to merge 1 commit into
dawsh2:mainfrom
igoforth:fix/linux-compatibility-and-api-upgrade

Conversation

@igoforth

Copy link
Copy Markdown

Changes

API Compatibility (zed_extension_api 0.1.0 → 0.7.0)

  • Upgraded zed_extension_api dependency from 0.1.0 to 0.7.0
  • Fixed LanguageServerId construction (private constructor in new API)
  • Updated Worktree API: path() → root_path()
  • Removed references to GithubReleaseAsset.size (field removed in API)
  • Fixed string lifetime issues with String::from_utf8_lossy().trim()

Extension Manifest

  • Added required [lib] section to extension.toml
  • Specified Rust kind and version 0.7.0
  • Added all required metadata fields

Language Configuration

  • Fixed grammar reference: "markdown" → "mermaid" in config.toml
  • Maintained code_fence_block_name for markdown code block support
  • Added highlights.scm for syntax highlighting

Dependency Management

  • Integrated Zed's npm API for package installation
  • Use npm_package_latest_version() and npm_install_package()
  • Dynamic MMDC_PATH derivation from LSP location (no hardcoded paths)
  • Pass MMDC_PATH as environment variable to LSP server

Build & Testing

  • Verified compilation for wasm32-wasip1 target
  • Tested local installation in Zed remote server environment
  • Confirmed extension loading and LSP initialization

Known Issues

Linux: Puppeteer Chrome Sandbox Error

On Linux systems, mmdc fails with Chrome sandbox error:

FATAL:zygote_host_impl_linux.cc(128)] No usable sandbox!

This is a known issue with headless Chrome on Linux. The extension works on macOS (original author's platform) but requires additional setup on Linux:

Workaround options:

  1. Use --no-sandbox flag (security tradeoff for dev environments)
  2. Set up Chrome sandbox properly per Puppeteer documentation
  3. Run sudo commands to configure chrome_sandbox permissions

Since this is a Zed extension that should "just work" for users, we're currently using puppeteer-config.json with --no-sandbox for Linux compatibility. The security risk is minimal since users render their own trusted Mermaid diagrams from their own files.

Testing Environment

  • Platform: Linux (Ubuntu/Debian-based)
  • Zed: Remote server setup
  • Target: wasm32-wasip1

## Changes

### API Compatibility (zed_extension_api 0.1.0 → 0.7.0)
- Upgraded zed_extension_api dependency from 0.1.0 to 0.7.0
- Fixed LanguageServerId construction (private constructor in new API)
- Updated Worktree API: path() → root_path()
- Removed references to GithubReleaseAsset.size (field removed in API)
- Fixed string lifetime issues with String::from_utf8_lossy().trim()

### Extension Manifest
- Added required [lib] section to extension.toml
- Specified Rust kind and version 0.7.0
- Added all required metadata fields

### Language Configuration
- Fixed grammar reference: "markdown" → "mermaid" in config.toml
- Maintained code_fence_block_name for markdown code block support
- Added highlights.scm for syntax highlighting

### Dependency Management
- Integrated Zed's npm API for package installation
- Use npm_package_latest_version() and npm_install_package()
- Dynamic MMDC_PATH derivation from LSP location (no hardcoded paths)
- Pass MMDC_PATH as environment variable to LSP server

### Build & Testing
- Verified compilation for wasm32-wasip1 target
- Tested local installation in Zed remote server environment
- Confirmed extension loading and LSP initialization

## Known Issues

### Linux: Puppeteer Chrome Sandbox Error
On Linux systems, mmdc fails with Chrome sandbox error:
```
FATAL:zygote_host_impl_linux.cc(128)] No usable sandbox!
```

This is a known issue with headless Chrome on Linux. The extension works
on macOS (original author's platform) but requires additional setup on Linux:

**Workaround options:**
1. Use `--no-sandbox` flag (security tradeoff for dev environments)
2. Set up Chrome sandbox properly per Puppeteer documentation
3. Run `sudo` commands to configure chrome_sandbox permissions

Since this is a Zed extension that should "just work" for users, we're
currently using puppeteer-config.json with --no-sandbox for Linux
compatibility. The security risk is minimal since users render their own
trusted Mermaid diagrams from their own files.

## Testing Environment
- Platform: Linux (Ubuntu/Debian-based)
- Zed: Remote server setup
- Target: wasm32-wasip1

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant