Skip to content

Add LikeC4 extension#4983

Open
Lenivvenil wants to merge 1 commit intozed-industries:mainfrom
Lenivvenil:add-likec4
Open

Add LikeC4 extension#4983
Lenivvenil wants to merge 1 commit intozed-industries:mainfrom
Lenivvenil:add-likec4

Conversation

@Lenivvenil
Copy link

Summary

Adds LikeC4 architecture-as-code language support for Zed:

  • Tree-sitter grammar — syntax highlighting, bracket matching, auto-indentation, code outline
  • LSP integration — official @likec4/language-server providing completions, diagnostics, hover, go-to-definition, find references, and rename
  • File detection.likec4 and .c4 extensions

Extension repo: https://github.com/Lenivvenil/zed-likec4
Grammar repo: https://github.com/Lenivvenil/tree-sitter-likec4

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @Lenivvenil on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@Lenivvenil
Copy link
Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @Lenivvenil on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

@Lenivvenil
Copy link
Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @Lenivvenil on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

@Lenivvenil
Copy link
Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

We require contributors to sign our Contributor License Agreement, and we don't have @Lenivvenil on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

@Lenivvenil
Copy link
Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed label Feb 25, 2026
@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

@Lenivvenil
Copy link
Author

@cla-bot check

@cla-bot
Copy link

cla-bot bot commented Feb 25, 2026

The cla-bot has been summoned, and re-checked this pull request!

Copy link
Member

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this!

I very much would like for you to remove https://github.com/Lenivvenil/zed-likec4/blob/c094b7d8d0c213799df843ec1ad58a8c59483385/src/lib.rs#L19-L72 - this should not be needed, as this should be handled by the NPM package install. Can you elaborate on this perhaps?

@Lenivvenil
Copy link
Author

Thanks for the review!

The ESM resolve hook is unfortunately necessary because Zed ships Node.js v24, which enforces strict ESM resolution. Without the hook, the server crashes immediately on startup:

Error [ERR_MODULE_NOT_FOUND]: Cannot find module
  '.../node_modules/vscode-languageserver/node'
  imported from '.../node_modules/@likec4/language-server/dist/bundled.mjs'
Did you mean to import "vscode-languageserver/node.js"?

Root cause: @likec4/language-server is an ESM package ("type": "module") that imports vscode-languageserver/node (without .js extension). vscode-languageserver@9.0.1 is a CJS package with no exports field in its package.json. Node v24 requires explicit .js extensions for subpath imports of such packages — this is an upstream issue in vscode-languageserver.

The hook does two things:

  1. Retries failed imports with .js suffix — fixes the ERR_MODULE_NOT_FOUND for vscode-languageserver/nodevscode-languageserver/node.js
  2. Stubs optional peer deps (bundle-require, esbuild) — these are statically imported by @likec4/language-server but only used for loading likec4.config.ts files, not for LSP operations. zed::npm_install_package does not install peer dependencies.

I verified this on macOS with the exact Node binary Zed bundles (node-v24.11.0-darwin-arm64). The server cannot start without the hook.

Once vscode-languageserver ships an exports field (or @likec4/language-server switches to explicit .js imports), the hook can be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants