updated path handling
This commit is contained in:
parent
01a4022b9d
commit
77329562ec
|
|
@ -145,7 +145,7 @@ require("conform").setup({
|
|||
formatters = {
|
||||
csharpierd = {
|
||||
command = "csharpierd",
|
||||
args = { "$FILENAME" },
|
||||
args = { "$RELATIVE_FILEPATH" },
|
||||
stdin = true,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
5
index.ts
5
index.ts
|
|
@ -199,6 +199,9 @@ async function formatCode(
|
|||
fileContents: string,
|
||||
): Promise<string> {
|
||||
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,
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue