Skip to content

Commit 166a424

Browse files
committed
style: Apply deno fmt formatting
1 parent ca5f0cb commit 166a424

File tree

6 files changed

+235
-59
lines changed

6 files changed

+235
-59
lines changed

CLAUDE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
**All code comments MUST be written in English.**
66

77
This applies to:
8+
89
- Function/class documentation comments
910
- Inline comments explaining logic
1011
- TODO/FIXME/NOTE comments
@@ -19,18 +20,21 @@ This applies to:
1920
### Examples
2021

2122
Good example:
23+
2224
```
2325
// Disable visual features that affect line number display
2426
await disableVisualLineModifications(denops, bufnr);
2527
```
2628

2729
Bad example (using non-English comments):
30+
2831
```
2932
// Disable visual line modifications
3033
await disableVisualLineModifications(denops, bufnr);
3134
```
3235

3336
Good example (JSDoc):
37+
3438
```
3539
/**
3640
* Parse git blame porcelain output
@@ -40,6 +44,7 @@ Good example (JSDoc):
4044
```
4145

4246
Bad example (vague comments):
47+
4348
```
4449
/**
4550
* Parse blame output

denops/gin/command/blame/buffer_utils.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type { Denops } from "jsr:@denops/std@^7.0.0";
22
import * as fn from "jsr:@denops/std@^7.0.0/function";
33
import * as vars from "jsr:@denops/std@^7.0.0/variable";
44
import {
5-
parse as parseBufname,
65
type BufnameParams,
6+
parse as parseBufname,
77
} from "jsr:@denops/std@^7.0.0/bufname";
8-
import type { GitBlameResult, GitBlameLine } from "./parser.ts";
8+
import type { GitBlameLine, GitBlameResult } from "./parser.ts";
99

1010
/**
1111
* Information about the current blame buffer context
@@ -24,7 +24,9 @@ export type BlameBufferContext = {
2424
/**
2525
* Get blame buffer context from current buffer
2626
*/
27-
export async function getBlameContext(denops: Denops): Promise<BlameBufferContext> {
27+
export async function getBlameContext(
28+
denops: Denops,
29+
): Promise<BlameBufferContext> {
2830
const bufnrCurrent = await fn.bufnr(denops);
2931
const bufnameCurrent = await fn.bufname(denops, bufnrCurrent);
3032
const { scheme, expr, params } = parseBufname(bufnameCurrent);
@@ -35,28 +37,38 @@ export async function getBlameContext(denops: Denops): Promise<BlameBufferContex
3537

3638
if (scheme === "ginblamenav") {
3739
bufnrNav = bufnrCurrent;
38-
const bufnameBlame = await vars.b.get(denops, "gin_blame_file_bufname") as string | undefined;
40+
const bufnameBlame = await vars.b.get(denops, "gin_blame_file_bufname") as
41+
| string
42+
| undefined;
3943
if (!bufnameBlame) {
4044
throw new Error("Cannot find associated ginblame buffer");
4145
}
4246
bufnrBlame = await fn.bufnr(denops, bufnameBlame);
4347
} else if (scheme === "ginblame") {
4448
bufnrBlame = bufnrCurrent;
45-
const bufnameNav = await vars.b.get(denops, "gin_blame_nav_bufname") as string | undefined;
49+
const bufnameNav = await vars.b.get(denops, "gin_blame_nav_bufname") as
50+
| string
51+
| undefined;
4652
if (!bufnameNav) {
4753
throw new Error("Cannot find associated ginblamenav buffer");
4854
}
4955
bufnrNav = await fn.bufnr(denops, bufnameNav);
5056
} else {
51-
throw new Error("This command can only be called from ginblame or ginblamenav buffer");
57+
throw new Error(
58+
"This command can only be called from ginblame or ginblamenav buffer",
59+
);
5260
}
5361

54-
const fileFragment = await vars.b.get(denops, "gin_blame_file_fragment") as string | undefined;
62+
const fileFragment = await vars.b.get(denops, "gin_blame_file_fragment") as
63+
| string
64+
| undefined;
5565
if (!fileFragment) {
5666
throw new Error("File fragment not found");
5767
}
5868

59-
const blameResult = await vars.b.get(denops, "gin_blame_result") as GitBlameResult | undefined;
69+
const blameResult = await vars.b.get(denops, "gin_blame_result") as
70+
| GitBlameResult
71+
| undefined;
6072
if (!blameResult) {
6173
throw new Error("Blame result not found");
6274
}
@@ -88,7 +100,9 @@ export async function getBlameLine(
88100
_blameResult: GitBlameResult,
89101
): Promise<{ blameLine: GitBlameLine; relativeOffset: number } | null> {
90102
// Get the line map (physical line -> GitBlameLine)
91-
const lineMap = await vars.b.get(denops, "gin_blame_line_map") as Record<number, GitBlameLine> | undefined;
103+
const lineMap = await vars.b.get(denops, "gin_blame_line_map") as
104+
| Record<number, GitBlameLine>
105+
| undefined;
92106
if (!lineMap) {
93107
return null;
94108
}

denops/gin/command/blame/detail.ts

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ export async function updateDetail(denops: Denops): Promise<void> {
1818
const bufnameCurrent = await fn.bufname(denops, bufnrCurrent);
1919
const { scheme, expr, params } = parseBufname(bufnameCurrent);
2020

21-
const blameResult = await vars.b.get(denops, "gin_blame_result") as GitBlameResult | undefined;
21+
const blameResult = await vars.b.get(denops, "gin_blame_result") as
22+
| GitBlameResult
23+
| undefined;
2224
if (!blameResult) {
2325
return;
2426
}
2527

26-
const bufnameDetail = await vars.b.get(denops, "gin_blame_detail_bufname") as string | undefined;
28+
const bufnameDetail = await vars.b.get(denops, "gin_blame_detail_bufname") as
29+
| string
30+
| undefined;
2731
if (!bufnameDetail) {
2832
return;
2933
}
@@ -35,7 +39,10 @@ export async function updateDetail(denops: Denops): Promise<void> {
3539
let commitSha: string;
3640

3741
// Check if on first divider line (line 1, empty)
38-
if (lnum === 1 && (!currentLine || typeof currentLine === "string" && !currentLine.trim())) {
42+
if (
43+
lnum === 1 &&
44+
(!currentLine || typeof currentLine === "string" && !currentLine.trim())
45+
) {
3946
// Show the blame target commit
4047
const currentCommitish = Array.isArray(params?.commitish)
4148
? params.commitish[0]
@@ -53,13 +60,21 @@ export async function updateDetail(denops: Denops): Promise<void> {
5360
}
5461

5562
// Check if already displaying this commit
56-
const lastCommitSha = await vars.b.get(denops, "gin_blame_detail_last_commit") as string | undefined;
63+
const lastCommitSha = await vars.b.get(
64+
denops,
65+
"gin_blame_detail_last_commit",
66+
) as string | undefined;
5767
if (lastCommitSha === commitSha) {
5868
return;
5969
}
6070

6171
// Execute git show to get full commit details
62-
const { stdout } = await execute(denops, ["show", "--no-patch", "--format=fuller", commitSha], {
72+
const { stdout } = await execute(denops, [
73+
"show",
74+
"--no-patch",
75+
"--format=fuller",
76+
commitSha,
77+
], {
6378
worktree: expr,
6479
throwOnError: false,
6580
stdoutIndicator: "null",
@@ -81,7 +96,10 @@ export async function updateDetail(denops: Denops): Promise<void> {
8196
* Reformat git show output: Metadata -> Summary -> Body
8297
* Apply emojify only to summary line
8398
*/
84-
function reformatCommitDetail(gitShowOutput: string[], shouldEmojify: boolean): string[] {
99+
function reformatCommitDetail(
100+
gitShowOutput: string[],
101+
shouldEmojify: boolean,
102+
): string[] {
85103
const result: string[] = [];
86104
let i = 0;
87105

0 commit comments

Comments
 (0)