Skip to content

Commit

Permalink
docs: 関数の説明を追加 📚
Browse files Browse the repository at this point in the history
  • Loading branch information
nekowasabi committed Oct 12, 2024
1 parent 30d287e commit 5f4de96
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions denops/aider/bufferOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,11 +364,24 @@ async function checkBufferOpen(denops: Denops, bufnrToCheck: number): Promise<bo
return false;
}

/**
* Gitリポジトリのルートディレクトリを取得します。
*
* @param {Denops} denops - Denopsインスタンス
* @returns {Promise<string>} Gitリポジトリのルートディレクトリのパス
*/
async function getGitRoot(denops: Denops): Promise<string> {
const gitRoot = ensure(await denops.call("system", "git rev-parse --show-toplevel"), is.String).trim();
return gitRoot;
}

/**
* フルパスをGitリポジトリのルートからの相対パスに変換します。
*
* @param {Denops} denops - Denopsインスタンス
* @param {string} fullPath - 変換するフルパス
* @returns {Promise<string>} Gitリポジトリのルートからの相対パス
*/
async function convertToGitRelativePath(denops: Denops, fullPath: string): Promise<string> {
const gitRoot = await getGitRoot(denops);
return fullPath.replace(gitRoot, "").slice(1);
Expand Down

0 comments on commit 5f4de96

Please sign in to comment.