fix typos (#812)
* fix typos Signed-off-by: Jinbo Wang <jinbwan@microsoft.com> * tune error message Signed-off-by: Jinbo Wang <jinbwan@microsoft.com> * tune message Signed-off-by: Jinbo Wang <jinbwan@microsoft.com> * tune message Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
This commit is contained in:
parent
4ce7a949ef
commit
370f66e75a
|
@ -79,7 +79,7 @@ Please also check the documentation of [Language Support for Java by Red Hat](ht
|
|||
- `hostName` (required, unless using `processId`) - The host name or IP address of remote debuggee.
|
||||
- `port` (required, unless using `processId`) - The debug port of remote debuggee.
|
||||
- `processId` - Use process picker to select a process to attach, or Process ID as integer.
|
||||
- `${command:pickJavaProcess}` - Use process picker to select a process to attach.
|
||||
- `${command:PickJavaProcess}` - Use process picker to select a process to attach.
|
||||
- an integer pid - Attach to the specified local process.
|
||||
- `timeout` - Timeout value before reconnecting, in milliseconds (default to 30000ms).
|
||||
- `sourcePaths` - The extra source directories of the program. The debugger looks for source code from project settings by default. This option allows the debugger to look for source code in extra directories.
|
||||
|
|
|
@ -350,7 +350,7 @@
|
|||
"${command:PickJavaProcess}"
|
||||
],
|
||||
"description": "%java.debugger.attach.processPicker.description%",
|
||||
"default": "${command:pickJavaProcess}"
|
||||
"default": "${command:PickJavaProcess}"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
|
|
|
@ -236,7 +236,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
|||
return undefined;
|
||||
}
|
||||
} catch (error) {
|
||||
vscode.window.showErrorMessage(String(error));
|
||||
vscode.window.showErrorMessage(error.message ? error.message : String(error));
|
||||
return undefined;
|
||||
}
|
||||
} else if (!config.hostName || !config.port) {
|
||||
|
|
|
@ -18,14 +18,15 @@ interface IJavaProcess {
|
|||
|
||||
export async function resolveProcessId(config: DebugConfiguration): Promise<boolean> {
|
||||
let javaProcess;
|
||||
const pid: number = Number(config.processId);
|
||||
// tslint:disable-next-line
|
||||
if (!config.processId || config.processId === "${command:PickJavaProcess}") {
|
||||
if (!config.processId || Number.isNaN(pid)) {
|
||||
javaProcess = await pickJavaProcess();
|
||||
} else {
|
||||
javaProcess = await resolveJavaProcess(parseInt(String(config.processId), 10));
|
||||
javaProcess = await resolveJavaProcess(pid);
|
||||
if (!javaProcess) {
|
||||
throw new Error(`Attach to process: pid '${config.processId}' doesn't look like a debuggable Java process. `
|
||||
+ `Please ensure the process has enabled debug mode with vmArgs like `
|
||||
throw new Error(`Attach to process: pid '${config.processId}' is not a debuggable Java process. `
|
||||
+ `Please make sure the process has turned on debug mode using vmArgs like `
|
||||
+ `'-agentlib:jdwp=transport=dt_socket,server=y,address=5005.'`);
|
||||
}
|
||||
}
|
||||
|
@ -68,39 +69,40 @@ function convertToJavaProcess(pid: number, command: string, args: string): IJava
|
|||
}
|
||||
|
||||
async function pickJavaProcess(): Promise<IJavaProcess> {
|
||||
const javaProcesses: IJavaProcess[] = [];
|
||||
try {
|
||||
const javaProcesses: IJavaProcess[] = [];
|
||||
await getProcesses((pid: number, ppid: number, command: string, args: string, date: number) => {
|
||||
const javaProcess = convertToJavaProcess(pid, command, args);
|
||||
if (javaProcess) {
|
||||
javaProcesses.push(javaProcess);
|
||||
}
|
||||
});
|
||||
|
||||
if (!javaProcesses.length) {
|
||||
throw new Error("Process picker: No debuggable Java process found. Please ensure enable debugging for "
|
||||
+ "your application with vmArgs like '-agentlib:jdwp=transport=dt_socket,server=y,address=5005'.");
|
||||
}
|
||||
|
||||
const items = javaProcesses.map((process) => {
|
||||
return {
|
||||
label: process.command,
|
||||
description: process.args,
|
||||
detail: `process id: ${process.pid}, debug port: ${process.debugPort}`,
|
||||
process,
|
||||
};
|
||||
});
|
||||
|
||||
const pick = await window.showQuickPick(items, {
|
||||
placeHolder: "Pick Java process to attach to",
|
||||
});
|
||||
|
||||
if (pick) {
|
||||
return pick.process;
|
||||
}
|
||||
} catch (error) {
|
||||
throw new Error("Process picker failed: " + error);
|
||||
}
|
||||
|
||||
if (!javaProcesses.length) {
|
||||
throw new Error("Process picker: No debuggable Java process was found. Please make sure to use vmArgs like "
|
||||
+ "'-agentlib:jdwp=transport=dt_socket,server=y,address=5005' to turn on debug mode when you start your "
|
||||
+ "program.");
|
||||
}
|
||||
|
||||
const items = javaProcesses.map((process) => {
|
||||
return {
|
||||
label: process.command,
|
||||
description: process.args,
|
||||
detail: `process id: ${process.pid}, debug port: ${process.debugPort}`,
|
||||
process,
|
||||
};
|
||||
});
|
||||
|
||||
const pick = await window.showQuickPick(items, {
|
||||
placeHolder: "Pick Java process to attach to",
|
||||
});
|
||||
|
||||
if (pick) {
|
||||
return pick.process;
|
||||
}
|
||||
}
|
||||
|
||||
async function resolveJavaProcess(pid: number): Promise<IJavaProcess | undefined> {
|
||||
|
|
Loading…
Reference in New Issue