Skip to content

codes v0.1.1

Choose a tag to compare

@github-actions github-actions released this 30 Mar 08:57

codes v0.1.1

0.1.1 是一次针对 `references` 命令正确性的修复版本,补齐了 Go 和 TypeScript 中 `--include-def` 对方法定义位置的覆盖缺失。

修复内容

  • Go / TypeScript:`references --include-def` 现在能正确返回方法定义位置
    • 之前,当查询目标是一个方法(Go 的 method_declaration、TypeScript 的 method_definition)时,narrowed 查询(CALLABLE_REFS)只覆盖调用表达式和裸标识符,不覆盖方法名本身所在的声明节点。
    • 这导致对同名方法(如同时存在于 handler 和 store 两个 struct 上的 ListUploads)执行 `references --include-def` 时,定义位置完全缺失,看上去像 0 结果或仅有调用侧。
    • 现在 Go 的 CALLABLE_REFS 新增了 (method_declaration name: (field_identifier) @reference) 规则,TypeScript 新增了 (method_definition name: (property_identifier) @reference),两者的 `--include-def` 行为与函数保持一致。
    • Rust 和 Python 不受影响:Rust 方法名本身是 identifier,已被现有规则覆盖;Python 不使用窄查询。

兼容性说明

  • 这是一次向前兼容的修复;默认不带 `--include-def` 的 `references` 行为不变,仅 `--include-def` 的返回结果更完整。

English

0.1.1 is a correctness fix for the references command, addressing a gap where --include-def failed to include method definition sites in Go and TypeScript.

Fix

  • Go / TypeScript: `references --include-def` now correctly includes method definition sites
    • Previously, when the target symbol was a method (method_declaration in Go, method_definition in TypeScript), the narrowed CALLABLE_REFS query only matched call expressions and bare identifiers, missing the declaration node where the method name itself lives.
    • This caused references --include-def on same-name methods (e.g. ListUploads defined on both a handler and a store struct) to silently drop all definition sites — the result looked like 0 results or only call sites.
    • Go's CALLABLE_REFS now includes (method_declaration name: (field_identifier) @reference) and TypeScript's includes (method_definition name: (property_identifier) @reference), making --include-def consistent with how plain functions already behaved.
    • Rust and Python are unaffected: Rust method names are plain identifier nodes already covered by existing rules; Python does not use the narrowed query path.

Compatibility

  • This is a fully forward-compatible fix. The default references behavior (without --include-def) is unchanged; only --include-def results are now more complete.

Full Changelog: 0.1.0...0.1.1