updated path handling
This commit is contained in:
parent
01a4022b9d
commit
77329562ec
|
|
@ -145,7 +145,7 @@ require("conform").setup({
|
||||||
formatters = {
|
formatters = {
|
||||||
csharpierd = {
|
csharpierd = {
|
||||||
command = "csharpierd",
|
command = "csharpierd",
|
||||||
args = { "$FILENAME" },
|
args = { "$RELATIVE_FILEPATH" },
|
||||||
stdin = true,
|
stdin = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
5
index.ts
5
index.ts
|
|
@ -199,6 +199,9 @@ async function formatCode(
|
||||||
fileContents: string,
|
fileContents: string,
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const state = await ensureServer();
|
const state = await ensureServer();
|
||||||
|
const filePath = path.isAbsolute(fileName)
|
||||||
|
? fileName
|
||||||
|
: path.join(process.cwd(), fileName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`http://localhost:${state.port}/format`, {
|
const response = await fetch(`http://localhost:${state.port}/format`, {
|
||||||
|
|
@ -207,7 +210,7 @@ async function formatCode(
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
fileName: path.join(process.cwd(), fileName),
|
fileName: filePath,
|
||||||
fileContents,
|
fileContents,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "csharpierd",
|
"name": "csharpierd",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout",
|
"description": "A persistent CSharpier formatting daemon with automatic server management and idle timeout",
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue