fix: Fix relative path creation using the wrong path accessor

This commit is contained in:
Lukas Wirth 2023-04-04 08:20:35 +02:00
parent 4243eeeb2b
commit 7989a94391

View File

@ -142,23 +142,27 @@ export async function createClient(
); );
void vscode.workspace.fs.stat(path).then(async () => { void vscode.workspace.fs.stat(path).then(async () => {
const choice = await vscode.window.showInformationMessage( const choice = await vscode.window.showInformationMessage(
`This rust file does not belong to a loaded cargo project. It looks like it might belong to the workspace at ${path}, do you want to add it to the linked Projects?`, `This rust file does not belong to a loaded cargo project. It looks like it might belong to the workspace at ${path.path}, do you want to add it to the linked Projects?`,
"Yes", "Yes",
"No", "No",
"Don't show this again" "Don't show this again"
); );
switch (choice) { switch (choice) {
case undefined:
break;
case "No": case "No":
break; break;
case "Yes": case "Yes":
const pathToInsert =
"." +
parent.substring(folder.length) +
pathSeparator +
"Cargo.toml";
await config.update( await config.update(
"linkedProjects", "linkedProjects",
config config
.get<any[]>("linkedProjects") .get<any[]>("linkedProjects")
?.concat( ?.concat(pathToInsert),
"." +
path.fsPath.substring(folder.length)
),
false false
); );
break; break;