Use a bat launcher to set page code (#625)

This commit is contained in:
Yan Zhang 2019-08-12 10:09:56 +08:00 committed by GitHub
parent 6c8fed7a99
commit 07ce6f7a3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

7
scripts/launcher.bat Normal file
View File

@ -0,0 +1,7 @@
@echo off
REM Change code page to UTF-8 for better compatibility.
@chcp.com 65001 > NUL
REM Execute real command passed by args
%*

View File

@ -237,6 +237,10 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
config.shortenCommandLine = await detectLaunchCommandStyle(config);
}
if (process.platform === "win32" && config.request === "launch" && config.console !== "internalConsole") {
config.launcherScript = utility.getLauncherScriptPath();
}
const debugServerPort = await lsPlugin.startDebugSession();
if (debugServerPort) {
config.debugServer = debugServerPort;

View File

@ -1,6 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
import * as path from "path";
import * as vscode from "vscode";
import { setUserError } from "vscode-extension-telemetry-wrapper";
import { logger, Type } from "./logger";
@ -8,6 +9,7 @@ import { logger, Type } from "./logger";
const TROUBLESHOOTING_LINK = "https://github.com/Microsoft/vscode-java-debug/blob/master/Troubleshooting.md";
const LEARN_MORE = "Learn More";
const JAVA_EXTENSION_ID = "redhat.java";
const DEBUGGER_EXTENSION_ID = "vscjava.vscode-java-debug";
export class UserError extends Error {
public context: ITroubleshootingMessage;
@ -158,3 +160,8 @@ export function isJavaExtEnabled(): boolean {
const javaExt = vscode.extensions.getExtension(JAVA_EXTENSION_ID);
return !!javaExt;
}
export function getLauncherScriptPath() {
const ext = vscode.extensions.getExtension(DEBUGGER_EXTENSION_ID);
return path.join(ext.extensionPath, "scripts", "launcher.bat");
}