Skip to content

Commit 481f485

Browse files
committed
style: rewrite comments that addressed the reader or narrated old behavior
- A handful of comments were written as instructions to a reader or as a changelog ("previously returned 500", "kept for API compatibility"); they now state the current rule and its reason only - graph.js pointed at a static/js/include-graph.js that does not exist; the include graph lives in static/addons/c-include/addon.js - ref-map/addon.js had a blank line after every line for a 57-line stretch, an editing accident
1 parent 744b0e2 commit 481f485

9 files changed

Lines changed: 15 additions & 44 deletions

File tree

api/handlers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func (h *Handler) Register(mux *http.ServeMux) {
127127
mux.HandleFunc("/api/structure/build", h.handleStructureBuild)
128128
mux.HandleFunc("/api/structure/children", h.handleStructureChildren)
129129
mux.HandleFunc("/api/structure/edge-symbols", h.handleStructureEdgeSymbols)
130-
// [GNU Global] 以下の4行を削除し、definition/hover/callersの分岐を除去で取り外し可能
130+
// [GNU Global] この5行と definition/hover/callers の分岐を消せば取り外せる
131131
mux.HandleFunc("/api/gtags/status", h.handleGtagsStatus)
132132
mux.HandleFunc("/api/gtags/index", h.handleGtagsIndex)
133133
mux.HandleFunc("/api/gtags/update", h.handleGtagsUpdate)
@@ -137,7 +137,7 @@ func (h *Handler) Register(mux *http.ServeMux) {
137137
mux.HandleFunc("/api/ctags/index", h.handleCtagsIndex)
138138
mux.HandleFunc("/api/ctags/file-symbols", h.handleCtagsFileSymbols)
139139
mux.HandleFunc("/api/ctags/macros", h.handleCtagsMacros)
140-
// [C言語アドオン] 以下の3行を削除するとインクルードグラフAPIが無効になります
140+
// [C言語アドオン] この3行を消すとインクルードグラフ API が無効になる
141141
mux.HandleFunc("/api/include-graph", h.handleIncludeGraph)
142142
mux.HandleFunc("/api/include-file", h.handleIncludeFile)
143143
mux.HandleFunc("/api/include-by", h.handleIncludeBy)

api/insertions.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ func (h *Handler) deleteInsertionByID(w http.ResponseWriter, r *http.Request, id
376376
return
377377
}
378378
// ErrUnsupportedEncoding→415 / ErrMismatch・errRecordedLineModified→409
379-
// など、POST/PUT と同じマッピングを通す(以前は一律500にしていた)。
379+
// など、POST/PUT と同じマッピングを通す。一律 500 だと呼び出し側が
380+
// 「行が変わっていた」と「壊れた」を区別できない
380381
patchErrStatus(w, err)
381382
return
382383
}

lsp/completion.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ import (
1414
// 補完はエディタの未保存バッファを見ないと成立しない("s->" と打った瞬間、
1515
// ディスクにはまだ無い)。textDocumentSync を full で受け、開いている文書の
1616
// 内容を持つ。他のハンドラ(hover / definition)も開いていればこちらを優先する。
17-
// didChange を無視していた「保存済み状態だけを見る」方針からの変更点で、
18-
// 索引(定義位置など)が保存済み基準なのは変わらない。
17+
// 索引(定義位置など)は保存済みのファイルが基準のまま。
1918

2019
func (s *server) handleDidOpen(raw json.RawMessage) {
2120
var p struct {

mcp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ main.go の line 1 を「Claude 経由テスト」のラベルでルートノー
295295
- **callees の self 除外**: `word` を渡しておけば同名は自動で除外される (`excluded_self` カウントが結果に含まれる)。
296296
- **`fetch failed` 単独で出てきたら**: ブリッジは `ECONNREFUSED` / `ENOTFOUND` / `ETIMEDOUT` を検出して原因コードと対処を表示する。それでも出ない場合は `GREPNAVI_URL` の port を疑う (デフォルト 8080)。
297297
- **GUI と AI の memo 同時編集**: `/api/graph/memos`**全置換 PUT** な性質上、AI が memo を書き、ほぼ同時刻に GUI でも別 memo を編集していると一方が消える race window がある。ブリッジは「現状 fetch → merge → PUT」で minimize、加えて server が `memos.updated` SSE を発火 → browser が即時 reload するので**最終状態は通常収束**する。ただし「AI が memo X を書く」と「GUI で memo Y を typing 中」が ms 単位で重なった場合は GUI のローカル変更が prefer される。
298-
- **version mismatch**: grepnavi 本体や bridge を更新したら**両方とも再起動**する必要がある。bridge は古い `/api/callees` 形式 (`[]string`) も互換吸収するが、その場合 `call_line` が 0 で返る。更新時は `go build && 再起動` + `npm run build` + Claude Code 再起動の **3 ステップ**を忘れずに
298+
- **version mismatch**: grepnavi 本体や bridge を更新したら**両方とも再起動**する必要がある。bridge は古い `/api/callees` 形式 (`[]string`) も互換吸収するが、その場合 `call_line` が 0 で返る。更新時は `go build && 再起動` + `npm run build` + Claude Code 再起動の **3 ステップ**が要る
299299

300300
## 既知の制限
301301

search/ctags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ func ctagsParseSymbols(tagsPath string) (SymbolsByKind, error) {
385385
rest := line[tab1:]
386386
// ファイル欄(2列目)で C/C++ 以外と除外パスを落とす。tags が古い設定で
387387
// 作られていると生成物(doxygen の html/js など)の名前が混ざり、補完で
388-
// cryptlib_8c.html のようなゴミが出る
388+
// cryptlib_8c.html のような候補が出る
389389
if tab2 := bytes.IndexByte(rest[1:], '\t'); tab2 >= 0 {
390390
file := string(rest[1 : 1+tab2])
391391
if !ctagsIsCFile(file) || IsExcluded(filepath.Join(tagsDir, strings.TrimPrefix(file, "./"))) {

search/definition.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func findDefinitionsInFiles(ctx context.Context, word string, files []string) ([
312312
//
313313
// 実行戦略:
314314
// - 全パターン(define / struct / enum / typedef / func)を1つの正規表現に統合して
315-
// rg を1回だけ呼ぶ(従来の7プロセス → 1プロセス)。
315+
// rg を1回だけ呼ぶ(パターンごとに起動すると 7 プロセスになる)。
316316
// - 各ヒットの kind はマッチ行のテキストから事後判定する。
317317
func FindDefinitionsN(ctx context.Context, word, dir, glob string, maxPerQuery int) ([]DefHit, error) {
318318
if word == "" || dir == "" {

search/hover.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ func FindHover(ctx context.Context, word, dir, glob, root string, includeChain .
170170
commentLine = findContainingBlockStart(lines, h.Line)
171171
case "func":
172172
body = extractBraceBlock(lines, h.Line, 20)
173-
// { がない場合は宣言(プロトタイプ)
174-
// NOTE: 宣言/定義の判定ロジックは search/classify.go の ClassifyKind と対になっています。
175-
// 片方を変更した場合はもう片方も確認してください。
173+
// { がない場合は宣言(プロトタイプ)。
174+
// 判定は search/classify.go の ClassifyKind と対。片方を変えたらもう片方も直す
176175
if !strings.Contains(body, "{") {
177176
body = h.Text
178177
isDecl = true
@@ -194,9 +193,9 @@ func FindHover(ctx context.Context, word, dir, glob, root string, includeChain .
194193
result = append(result, HoverHit{File: h.File, Line: h.Line, Kind: h.Kind, Body: body, Decl: isDecl, Value: value, Healed: h.Healed})
195194
}
196195

197-
// func 結果を実装(decl:false)優先・上限2件でフィルタ
198-
// 宣言(decl:true)は実装が見つからない場合のみ最大2件補完
199-
// ※ 以前の funcCount >= 2 制限は宣言2件で実装がスキップされるバグがあったため廃止
196+
// func 結果を実装(decl:false)優先・上限2件でフィルタ
197+
// 宣言(decl:true)は実装が見つからない場合のみ最大2件補完。宣言の件数で
198+
// 先に打ち切ると、宣言が2件あるだけで実装が出なくなる
200199
var funcDefs, funcDecls []HoverHit
201200
var nonFunc []HoverHit
202201
for _, h := range result {

static/addons/ref-map/addon.js

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -98,61 +98,33 @@ function closeRefMap() {
9898
}
9999

100100
// ===== 移動の履歴 =====
101-
102101
// パンくずは祖先しか辿れない。`▾` の兄弟移動やファイルツリーからの直行が入って、
103-
104102
// 「さっき見ていた場所」がパンくずの上に無いことが普通になったので、来た道を
105-
106103
// 別に持つ。エディタ側の履歴 (editor.js の navHistory) と同じ規約で、履歴を
107-
108104
// 辿っている間は積まない。
109-
110105
let _rmHist = [];
111-
112106
let _rmHistIdx = -1;
113107

114-
115-
116108
function rmHistPush(focus) {
117-
118109
if (_rmHistIdx >= 0 && _rmHist[_rmHistIdx] === focus) return;
119-
120110
_rmHist = _rmHist.slice(0, _rmHistIdx + 1);
121-
122111
_rmHist.push(focus);
123-
124112
_rmHistIdx = _rmHist.length - 1;
125-
126113
}
127114

128-
129-
130115
function rmHistGo(delta) {
131-
132116
const i = _rmHistIdx + delta;
133-
134117
if (i < 0 || i >= _rmHist.length) return false;
135-
136118
_rmHistIdx = i;
137-
138119
rmLoad(_rmHist[i], { fromHistory: true });
139-
140120
return true;
141-
142121
}
143122

144-
145-
146123
function rmUpdateNavButtons() {
147-
148124
const b = document.getElementById('rm-back');
149-
150125
const f = document.getElementById('rm-fwd');
151-
152126
if (b) b.disabled = _rmHistIdx <= 0;
153-
154127
if (f) f.disabled = _rmHistIdx >= _rmHist.length - 1;
155-
156128
}
157129

158130
async function rmLoad(focus, opts) {

static/js/graph.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,7 +1434,7 @@ const nodeBadgeEditor = createNodeFieldModal({
14341434
successToast: () => 'バッジ保存',
14351435
});
14361436

1437-
// F2 / 右クリック「名前を変更」のエントリポイント。lbl/m は API 互換のため残置
1437+
// F2 / 右クリック「名前を変更」のエントリポイント。lbl/m は呼び出し側の形を揃えるためだけに受ける
14381438
function startNodeLabelEdit(lbl, node, m) {
14391439
nodeLabelEditor.open(node);
14401440
}
@@ -2676,7 +2676,7 @@ function attachIndentDrag(handle, row, nodeId, depth) {
26762676
}
26772677
}
26782678

2679-
// インクルード依存グラフ機能は static/js/include-graph.js に分離されています
2679+
// インクルード依存グラフは static/addons/c-include/addon.js にある
26802680

26812681
// ===== CODE SNAPSHOT =====
26822682
// 実装は editor.js の exportSelectionSnapshot() を参照

0 commit comments

Comments
 (0)