Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7b54c82

Browse files
committed
Revert "Debug use cargo workspace root as cwd.fixes#13022"
This reverts commit4ca86ed.
1 parentd83b267 commit7b54c82

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

‎src/tools/rust-analyzer/editors/code/src/debug.ts‎

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as vscode from "vscode";
33
import*aspathfrom"path";
44
importtype*asrafrom"./lsp_ext";
55

6-
import{Cargo,typeExecutableInfo,getRustcId,getSysroot}from"./toolchain";
6+
import{Cargo,getRustcId,getSysroot}from"./toolchain";
77
importtype{Ctx}from"./ctx";
88
import{prepareEnv}from"./run";
99
import{unwrapUndefinable}from"./undefinable";
@@ -12,7 +12,6 @@ const debugOutput = vscode.window.createOutputChannel("Debug");
1212
typeDebugConfigProvider=(
1313
config:ra.Runnable,
1414
executable:string,
15-
cargoWorkspace:string,
1615
env:Record<string,string>,
1716
sourceFileMap?:Record<string,string>,
1817
)=>vscode.DebugConfiguration;
@@ -134,7 +133,7 @@ async function getDebugConfiguration(
134133
}
135134

136135
constenv=prepareEnv(runnable,ctx.config.runnablesExtraEnv);
137-
const{executable,workspace:cargoWorkspace}=awaitgetDebugExecutableInfo(runnable,env);
136+
constexecutable=awaitgetDebugExecutable(runnable,env);
138137
letsourceFileMap=debugOptions.sourceFileMap;
139138
if(sourceFileMap==="auto"){
140139
// let's try to use the default toolchain
@@ -148,13 +147,7 @@ async function getDebugConfiguration(
148147
}
149148

150149
constprovider=unwrapUndefinable(knownEngines[debugEngine.id]);
151-
constdebugConfig=provider(
152-
runnable,
153-
simplifyPath(executable),
154-
cargoWorkspace,
155-
env,
156-
sourceFileMap,
157-
);
150+
constdebugConfig=provider(runnable,simplifyPath(executable),env,sourceFileMap);
158151
if(debugConfig.typeindebugOptions.engineSettings){
159152
constsettingsMap=(debugOptions.engineSettingsasany)[debugConfig.type];
160153
for(varkeyinsettingsMap){
@@ -176,21 +169,20 @@ async function getDebugConfiguration(
176169
returndebugConfig;
177170
}
178171

179-
asyncfunctiongetDebugExecutableInfo(
172+
asyncfunctiongetDebugExecutable(
180173
runnable:ra.Runnable,
181174
env:Record<string,string>,
182-
):Promise<ExecutableInfo>{
175+
):Promise<string>{
183176
constcargo=newCargo(runnable.args.workspaceRoot||".",debugOutput,env);
184-
constexecutableInfo=awaitcargo.executableInfoFromArgs(runnable.args.cargoArgs);
177+
constexecutable=awaitcargo.executableFromArgs(runnable.args.cargoArgs);
185178

186179
// if we are here, there were no compilation errors.
187-
returnexecutableInfo;
180+
returnexecutable;
188181
}
189182

190183
functiongetCCppDebugConfig(
191184
runnable:ra.Runnable,
192185
executable:string,
193-
cargoWorkspace:string,
194186
env:Record<string,string>,
195187
sourceFileMap?:Record<string,string>,
196188
):vscode.DebugConfiguration{
@@ -200,7 +192,7 @@ function getCCppDebugConfig(
200192
name:runnable.label,
201193
program:executable,
202194
args:runnable.args.executableArgs,
203-
cwd:cargoWorkspace||runnable.args.workspaceRoot,
195+
cwd:runnable.args.workspaceRoot,
204196
sourceFileMap,
205197
env,
206198
// See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941
@@ -213,7 +205,6 @@ function getCCppDebugConfig(
213205
functiongetCodeLldbDebugConfig(
214206
runnable:ra.Runnable,
215207
executable:string,
216-
cargoWorkspace:string,
217208
env:Record<string,string>,
218209
sourceFileMap?:Record<string,string>,
219210
):vscode.DebugConfiguration{
@@ -223,7 +214,7 @@ function getCodeLldbDebugConfig(
223214
name:runnable.label,
224215
program:executable,
225216
args:runnable.args.executableArgs,
226-
cwd:cargoWorkspace||runnable.args.workspaceRoot,
217+
cwd:runnable.args.workspaceRoot,
227218
sourceMap:sourceFileMap,
228219
sourceLanguages:["rust"],
229220
env,
@@ -233,7 +224,6 @@ function getCodeLldbDebugConfig(
233224
functiongetNativeDebugConfig(
234225
runnable:ra.Runnable,
235226
executable:string,
236-
cargoWorkspace:string,
237227
env:Record<string,string>,
238228
_sourceFileMap?:Record<string,string>,
239229
):vscode.DebugConfiguration{
@@ -244,7 +234,7 @@ function getNativeDebugConfig(
244234
target:executable,
245235
// See https://github.com/WebFreak001/code-debug/issues/359
246236
arguments:quote(runnable.args.executableArgs),
247-
cwd:cargoWorkspace||runnable.args.workspaceRoot,
237+
cwd:runnable.args.workspaceRoot,
248238
env,
249239
valuesFormatting:"prettyPrinters",
250240
};

‎src/tools/rust-analyzer/editors/code/src/toolchain.ts‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,11 @@ import { unwrapUndefinable } from "./undefinable";
99

1010
interfaceCompilationArtifact{
1111
fileName:string;
12-
workspace:string;
1312
name:string;
1413
kind:string;
1514
isTest:boolean;
1615
}
1716

18-
exportinterfaceExecutableInfo{
19-
executable:string;
20-
workspace:string;
21-
}
22-
2317
exportinterfaceArtifactSpec{
2418
cargoArgs:string[];
2519
filter?:(artifacts:CompilationArtifact[])=>CompilationArtifact[];
@@ -74,7 +68,6 @@ export class Cargo {
7468
artifacts.push({
7569
fileName:message.executable,
7670
name:message.target.name,
77-
workspace:path.dirname(message.manifest_path),
7871
kind:message.target.kind[0],
7972
isTest:message.profile.test,
8073
});
@@ -93,7 +86,7 @@ export class Cargo {
9386
returnspec.filter?.(artifacts)??artifacts;
9487
}
9588

96-
asyncexecutableInfoFromArgs(args:readonlystring[]):Promise<ExecutableInfo>{
89+
asyncexecutableFromArgs(args:readonlystring[]):Promise<string>{
9790
constartifacts=awaitthis.getArtifacts(Cargo.artifactSpec(args));
9891

9992
if(artifacts.length===0){
@@ -103,10 +96,7 @@ export class Cargo {
10396
}
10497

10598
constartifact=unwrapUndefinable(artifacts[0]);
106-
return{
107-
executable:artifact.fileName,
108-
workspace:artifact.workspace,
109-
};
99+
returnartifact.fileName;
110100
}
111101

112102
privateasyncrunCargo(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp