Skip to content

fernandolguevara/c3-zed

 
 

Repository files navigation

C3 Zed Extension

Forked form AineeJames/c3-zed

What's new?

  • Update the tree-siiter of c3
  • Update the zed-api
  • Automatically download c3lsp from perrymason/c3-lsp
  • Optional custom c3lsp path via c3lsp.json or Zed LSP settings
  • Inline runnables for C3 tests (@test)

Running @test from inline runnables

The extension now marks test runnables in two cases:

  1. Function-level attribute: fn void my_test() @test { ... }
  2. Module-level attribute: module foo @test; (every function in that file is runnable)

To make the runnable button execute your C3 tests, bind the c3-test tag in .zed/tasks.json or global tasks.json.

[
  {
    "label": "c3: test current function",
    "command": "c3c",
    "args": ["test", "--test-filter", "$ZED_CUSTOM_TEST_NAME"],
    "tags": ["c3-test"]
  }
]

If your setup does not expose $ZED_CUSTOM_TEST_NAME, use $ZED_SYMBOL or remove the filter to run all tests.

c3lsp path priority

The extension resolves the c3lsp binary path in this order:

  1. c3lsp.json (or cs3lsp.json) in your project root
  2. Zed LSP settings (lsp.c3.binary.path)
  3. Bundled auto-downloaded default (c3lsp/server/bin/release/c3lsp)

When c3lsp.json or Zed settings provide a path, the extension uses that path directly. Relative paths are resolved from the project root. Custom paths are not chmod'ed by the extension; ensure your binary is executable.

c3lsp.json example

{
  "lsp": {
    "path": "/absolute/or/relative/path/to/c3lsp"
  }
}

Zed settings example

{
  "lsp": {
    "c3": {
      "binary": {
        "path": "/absolute/or/relative/path/to/c3lsp"
      }
    }
  }
}

Installation:

  1. Open Zed's command palette Ctrl+Shift+P and select extensions
  2. Search for C3 and click on Install

Manual Installation:

  1. git clone https://github.com/AineeJames/c3-zed
  2. Open Zed's command palette Ctrl+Shift+P and select extensions
  3. Click on Install Dev Extension and select the cloned directory

Credits:

Warning

This plugin is a WIP and may not work as expected. This plugin hasn't been fully tested on Mac and Linux

About

A Zed extension for the C3 programming language with LSP and TS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Tree-sitter Query 51.5%
  • Rust 32.7%
  • C3 12.1%
  • Shell 3.7%