{"id":16699324,"url":"https://github.com/ousttrue/yazls","last_synced_at":"2026-04-26T17:31:47.663Z","repository":{"id":56754330,"uuid":"524276580","full_name":"ousttrue/yazls","owner":"ousttrue","description":"Yet another zig language server.","archived":false,"fork":false,"pushed_at":"2022-10-20T16:53:30.000Z","size":151,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-31T04:59:20.805Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Zig","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ousttrue.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-13T02:15:45.000Z","updated_at":"2022-12-10T11:25:53.000Z","dependencies_parsed_at":"2022-08-16T01:40:43.993Z","dependency_job_id":null,"html_url":"https://github.com/ousttrue/yazls","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ousttrue/yazls","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2Fyazls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2Fyazls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2Fyazls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2Fyazls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ousttrue","download_url":"https://codeload.github.com/ousttrue/yazls/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ousttrue%2Fyazls/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32307010,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T17:23:19.671Z","status":"ssl_error","status_checked_at":"2026-04-26T17:23:19.195Z","response_time":129,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T18:06:37.132Z","updated_at":"2026-04-26T17:31:47.638Z","avatar_url":"https://github.com/ousttrue.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yazls\n\nYet another zig language server.\n\u003chttps://github.com/zigtools/zls\u003e を fork して改造した \u003chttps://github.com/ousttrue/zls\u003e を整理したものです。\n\nzls の zls.exe のみを置き換えて使います。\n\n## vscode の設定\n\n```json:settings.json\n\"zls.path\": \"PATH_TO_HERE/zig-out/bin/yazls.exe\",\n\n// Linux\n\n\"zls.path\": \"PATH_TO_HERE/zig-out/bin/yazls\",\n```\n\nWindows11 の WSL2 ArchLinux 上で VSCode で開発中・・・\n\n# TODO\n\n* [ ] 0.1: 改造版の zls を移植。 @cImport の初期実装。\n\n|                                  | zls | yazls |                                                 |\n|----------------------------------|-----|-------|-------------------------------------------------|\n| initialized                      |     | ✅     | 何もしてない                                    |\n| $/cancelRequest                  |     | ✅     | 何もしてない                                    |\n| initialize                       | ✅   | ✅     |                                                 |\n| shutdown                         | ✅   | ✅     |                                                 |\n| textDocument/didOpen             | ✅   | ✅     |                                                 |\n| textDocument/didChange           | ✅   | ✅     |                                                 |\n| textDocument/didSave             | ✅   | ✅     | BuildFile 再評価無し                            |\n| textDocument/didClose            | ✅   | ✅     | 何もしてない                                    |\n| textDocument/publishDiagnostics  | ✅   | ✅     | camel_case, snake_case 等のスタイルチェック無し |\n| textDocument/semanticTokens/full | ✅   | ✅     |                                                 |\n| textDocument/formatting          | ✅   | ✅     |                                                 |\n| textDocument/documentSymbol      | ✅   | ✅     |                                                 |\n| textDocument/declaration         | ✅   |       | declaration と definition の区別                |\n| textDocument/definition          | ✅   | ✅     | 不完全                                          |\n| textDocument/completion          | ✅   | ✅     | 不完全                                          |\n| textDocument/signatureHelp       | ✅   | ✅     | 不完全                                          |\n| textDocument/hover               | ✅   | ✅     | Debug情報                                       |\n| textDocument/rename              | ✅   |       | TODO                                            |\n| textDocument/references          | ✅   |       |                                                 |\n| textDocument/codeLens            |     |       | 実験                                            |\n| codeLens/resolve                 |     |       | よくわからん                                    |\n| @import(\"builtin\") サポート      | ✅   |       | 停止中・・・                                    |\n| @cImport                         |     | ✅     | /c.zig 決め打ち                                 |\n| gyro.zzz から pkg マップをロード |     |       | build 時依存を解決                              |\n\n## @cImport サポート\n\n決まった作法で `@cImport` を記述することで扱えるようにする。\n\n* プロジェクトルートに `c.zig` を配置\n\n```zig\npub usingnamespace @cImport({\n    // 任意の cInclude など\n});\n```\n\n* `build.zig` で `c.zig` を Pkg \"c\" に隔離\n\n```zig\n// build.zig\nconst c_pkg = std.build.Pkg{\n    .name = \"c\", // 固定名\n    .source = .{ .path = \"c.zig\" }, // 固定ファイル\n};\n\nfn main(b: Build)\n{\n    exe.addPackage(c_pkg);\n}\n```\n\n以上の作法で c.zig を配置する。\nyazls 起動時に `zig build-lib c.zig -lc --verbose-cimport` を実行して zig-cache 内の translate-c された zig のパスを得る。\n`@import(\"c\")` を zig-cache のファイルで置き換えるという動作をする。\n\n### 決まった作法に固定している理由\n\n* `zig build-lib c.zig -lc --verbose-cimport` を実行するファイルを決定する必要がある\n* c.zig に他の要素があると、依存などで `zig build-lib c.zig -lc --verbose-cimport` が失敗する場合がある\n* `usingnamespace` に対処するのがめんどくさい\n* @cImport が複数あっても zig-cache は1ファイルにまとまるっぽい\n\n## textDocument/declaration textDocument/definition\n\n* [ ] textDocument/declaration =\u003e struct_decl まで飛ぶ\n* [ ] textDocument/definition =\u003e var_decl, container_field まで飛ぶ\n* [x] call =\u003e fn_decl\n* [x] field_access =\u003e container_field\n* [ ] type from fn that return type\n\n## textDocument/completion\n\n* [ ] builtin 関数\n* [x] member field 列挙\n* [x] package, *.zig 列挙\n* [ ] struct_init 時の field 入力\n* [ ] enum\n\n## textDocument/signatureHelp\n\n* [ ] builtin 関数\n\n## textDocument/hover\n\n* [ ] builtin 関数\n\n## builtin 関数\n\n\u003chttps://github.com/ziglang/zig/blob/master/doc/langref.html.in\u003e\n\nから python で加工している。\n正規表現 `{#header_open\\|(@\\S+?)#}(.+?){#header_close#}` で `@` 始まる関数を抽出している。\n\n## simple 化\n\n* Config ない\n* Document の reference カウントしない\n* BuildFile は workspace/build.zig ひとつに決め打ち\n* import の 参照記録していない。ファイル外からの references を実装してない\n* usingnamespace を処理しない\n\n# 実装メモ\n\n`std.zig.parse` から `std.zig.Ast` を得られる。\nこの Ast 内で identifier Token の symbol 名の解決ができる。\nsymbol 名は、 local変数, container変数 の何れかである。\nlocal 変数は関数ボディ内で、関数引数、ブロック、if_payload, while_payload, switch_case_payload である。\ncontainer 変数は struct の static 変数である。\n一番外のスコープは、暗黙的に struct (root container) である。\n`@import` は外部の `zig` ファイルの `root` container を表す。\n\n変数宣言の型を解決したい。\n変数宣言 `const val : TYPE = EXPR`, 関数引数 `param: TYPE`, ifなどの条件式 `if(EXPR)` から解決する。\nTYPE 、無ければ EXPR の型を再帰的に解決する。\n関数呼び出し `call` は返り値の型、ポインタ, `optional` 型, `error_union` 型, `try` 式, array の index 参照などは適当に中身の型に参照を解除する。\n`field_access` は左辺の struct を取得し、struct のメンバー変数、関数、フィールドから右辺の名前を検索する。\nこの過程で `@import` の解決が必要になる。\n最終的に `u32, type` などの primitive か, `array`, `slice` などの複合型、`fn` もしくは `struct_decl` を得る。\n`struct_decl` の場合は `field_acess` が可能で、コンテキストによって、型か値としてふるまうのだが、lsp 用途では区別しなくてもよさそう(手抜き)。\n\n## 課題\n\n* 型解決が多段で起こるので、途中で止まったり間違ったりするのをデバッグ可能にしたい\n* completion を解決するときの AST が入力途中で不完全な状態になるので、コンテキストを決定する方法(dicChange の追跡？)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fousttrue%2Fyazls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fousttrue%2Fyazls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fousttrue%2Fyazls/lists"}