Skip to content

Commit e871540

Browse files
committed
Auto merge of rust-lang#14482 - Veykril:vscode-linking-popup, r=Veykril
fix: Fix relative path creation using the wrong path accessor This should hopefully fix the other errors with paths people seem to be getting
2 parents f070093 + 7989a94 commit e871540

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

editors/code/src/client.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,23 +142,27 @@ export async function createClient(
142142
);
143143
void vscode.workspace.fs.stat(path).then(async () => {
144144
const choice = await vscode.window.showInformationMessage(
145-
`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?`,
145+
`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?`,
146146
"Yes",
147147
"No",
148148
"Don't show this again"
149149
);
150150
switch (choice) {
151+
case undefined:
152+
break;
151153
case "No":
152154
break;
153155
case "Yes":
156+
const pathToInsert =
157+
"." +
158+
parent.substring(folder.length) +
159+
pathSeparator +
160+
"Cargo.toml";
154161
await config.update(
155162
"linkedProjects",
156163
config
157164
.get<any[]>("linkedProjects")
158-
?.concat(
159-
"." +
160-
path.fsPath.substring(folder.length)
161-
),
165+
?.concat(pathToInsert),
162166
false
163167
);
164168
break;

0 commit comments

Comments
 (0)