From 77329562ec2b7cebfe7009f6985af7122e696008 Mon Sep 17 00:00:00 2001 From: MasterGordon Date: Thu, 23 Oct 2025 18:16:10 +0200 Subject: [PATCH] updated path handling --- README.md | 2 +- index.ts | 5 ++++- package.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 01233f2..e53a183 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ require("conform").setup({ formatters = { csharpierd = { command = "csharpierd", - args = { "$FILENAME" }, + args = { "$RELATIVE_FILEPATH" }, stdin = true, }, }, diff --git a/index.ts b/index.ts index 93e68ef..d6b8f08 100755 --- a/index.ts +++ b/index.ts @@ -199,6 +199,9 @@ async function formatCode( fileContents: string, ): Promise { const state = await ensureServer(); + const filePath = path.isAbsolute(fileName) + ? fileName + : path.join(process.cwd(), fileName); try { const response = await fetch(`http://localhost:${state.port}/format`, { @@ -207,7 +210,7 @@ async function formatCode( "Content-Type": "application/json", }, body: JSON.stringify({ - fileName: path.join(process.cwd(), fileName), + fileName: filePath, fileContents, }), }); diff --git a/package.json b/package.json index d635ed9..6b40887 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "csharpierd", - "version": "1.0.1", + "version": "1.0.2", "description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout", "module": "index.ts", "type": "module",