Modify tsconfig & error fix (#914)
This commit is contained in:
parent
41ba28ad4c
commit
029b22f5c7
|
@ -30,12 +30,28 @@
|
||||||
"integrity": "sha512-mQjDxyOM1Cpocd+vm1kZBP7smwKZ4TNokFeds9LV7OZibmPJFEzY3+xZMrKfUdNT71lv8GoCPD6upKwHxubClw==",
|
"integrity": "sha512-mQjDxyOM1Cpocd+vm1kZBP7smwKZ4TNokFeds9LV7OZibmPJFEzY3+xZMrKfUdNT71lv8GoCPD6upKwHxubClw==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/glob": {
|
||||||
|
"version": "7.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
|
||||||
|
"integrity": "sha512-SEYeGAIQIQX8NN6LDKprLjbrd5dARM5EXsd8GI/A5l0apYI1fGMWgPHSe4ZKL4eozlAyI+doUE9XbYS4xCkQ1w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/minimatch": "*",
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@types/lodash": {
|
"@types/lodash": {
|
||||||
"version": "4.14.137",
|
"version": "4.14.137",
|
||||||
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.137.tgz",
|
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.137.tgz",
|
||||||
"integrity": "sha512-g4rNK5SRKloO+sUGbuO7aPtwbwzMgjK+bm9BBhLD7jGUiGR7zhwYEhSln/ihgYQBeIJ5j7xjyaYzrWTcu3UotQ==",
|
"integrity": "sha512-g4rNK5SRKloO+sUGbuO7aPtwbwzMgjK+bm9BBhLD7jGUiGR7zhwYEhSln/ihgYQBeIJ5j7xjyaYzrWTcu3UotQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
|
"@types/minimatch": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@types/mocha": {
|
"@types/mocha": {
|
||||||
"version": "5.2.7",
|
"version": "5.2.7",
|
||||||
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.7.tgz",
|
||||||
|
|
|
@ -753,6 +753,7 @@
|
||||||
"test": "npm run compile && node ./out/test/index.js"
|
"test": "npm run compile && node ./out/test/index.js"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/glob": "^7.1.3",
|
||||||
"@types/lodash": "^4.14.137",
|
"@types/lodash": "^4.14.137",
|
||||||
"@types/mocha": "^5.2.7",
|
"@types/mocha": "^5.2.7",
|
||||||
"@types/node": "^8.10.51",
|
"@types/node": "^8.10.51",
|
||||||
|
|
|
@ -86,7 +86,7 @@ function checkErrorsReportedByJavaExtension(): boolean {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showFixSuggestions(operationId: string) {
|
async function showFixSuggestions(operationId: string) {
|
||||||
let buildFiles = [];
|
let buildFiles: string[] = [];
|
||||||
try {
|
try {
|
||||||
buildFiles = await lsPlugin.resolveBuildFiles();
|
buildFiles = await lsPlugin.resolveBuildFiles();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -44,11 +44,11 @@ export const JAVA_RESOLVE_CLASSFILTERS = "vscode.java.resolveClassFilters";
|
||||||
|
|
||||||
export const JAVA_RESOLVE_SOURCE_URI = "vscode.java.resolveSourceUri";
|
export const JAVA_RESOLVE_SOURCE_URI = "vscode.java.resolveSourceUri";
|
||||||
|
|
||||||
export function executeJavaLanguageServerCommand(...rest) {
|
export function executeJavaLanguageServerCommand(...rest: any[]) {
|
||||||
return executeJavaExtensionCommand(JAVA_EXECUTE_WORKSPACE_COMMAND, ...rest);
|
return executeJavaExtensionCommand(JAVA_EXECUTE_WORKSPACE_COMMAND, ...rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function executeJavaExtensionCommand(commandName: string, ...rest) {
|
export async function executeJavaExtensionCommand(commandName: string, ...rest: any[]) {
|
||||||
// TODO: need to handle error and trace telemetry
|
// TODO: need to handle error and trace telemetry
|
||||||
const javaExtension = utility.getJavaExtension();
|
const javaExtension = utility.getJavaExtension();
|
||||||
if (!javaExtension) {
|
if (!javaExtension) {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import * as fs from "fs";
|
||||||
import * as _ from "lodash";
|
import * as _ from "lodash";
|
||||||
import * as os from "os";
|
import * as os from "os";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import { debug } from "util";
|
|
||||||
import * as vscode from "vscode";
|
import * as vscode from "vscode";
|
||||||
|
|
||||||
import { instrumentOperation, sendInfo } from "vscode-extension-telemetry-wrapper";
|
import { instrumentOperation, sendInfo } from "vscode-extension-telemetry-wrapper";
|
||||||
|
@ -19,7 +18,7 @@ import { mainClassPicker } from "./mainClassPicker";
|
||||||
import { resolveJavaProcess } from "./processPicker";
|
import { resolveJavaProcess } from "./processPicker";
|
||||||
import * as utility from "./utility";
|
import * as utility from "./utility";
|
||||||
|
|
||||||
const platformNameMappings = {
|
const platformNameMappings: {[key: string]: string} = {
|
||||||
win32: "windows",
|
win32: "windows",
|
||||||
linux: "linux",
|
linux: "linux",
|
||||||
darwin: "osx",
|
darwin: "osx",
|
||||||
|
@ -38,20 +37,22 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
this.isUserSettingsDirty = true;
|
this.isUserSettingsDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an initial debug configurations based on contextual information.
|
// Returns an initial debug configurations based on contextual information.
|
||||||
public provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken):
|
public provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, _token?: vscode.CancellationToken):
|
||||||
vscode.ProviderResult<vscode.DebugConfiguration[]> {
|
vscode.ProviderResult<vscode.DebugConfiguration[]> {
|
||||||
const provideDebugConfigurationsHandler = instrumentOperation("provideDebugConfigurations", (operationId: string) => {
|
const provideDebugConfigurationsHandler = instrumentOperation("provideDebugConfigurations", (_operationId: string) => {
|
||||||
return <Thenable<vscode.DebugConfiguration[]>>this.provideDebugConfigurationsAsync(folder);
|
return <Thenable<vscode.DebugConfiguration[]>>this.provideDebugConfigurationsAsync(folder);
|
||||||
});
|
});
|
||||||
return provideDebugConfigurationsHandler();
|
return provideDebugConfigurationsHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to add all missing attributes to the debug configuration being launched.
|
// Try to add all missing attributes to the debug configuration being launched.
|
||||||
public resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken):
|
public resolveDebugConfiguration(_folder: vscode.WorkspaceFolder | undefined,
|
||||||
|
config: vscode.DebugConfiguration, _token?: vscode.CancellationToken):
|
||||||
vscode.ProviderResult<vscode.DebugConfiguration> {
|
vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||||
// If no debug configuration is provided, then generate one in memory.
|
// If no debug configuration is provided, then generate one in memory.
|
||||||
if (this.isEmptyConfig(config)) {
|
if (this.isEmptyConfig(config)) {
|
||||||
|
@ -67,8 +68,8 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
public resolveDebugConfigurationWithSubstitutedVariables(
|
public resolveDebugConfigurationWithSubstitutedVariables(
|
||||||
folder: vscode.WorkspaceFolder | undefined,
|
folder: vscode.WorkspaceFolder | undefined,
|
||||||
config: vscode.DebugConfiguration,
|
config: vscode.DebugConfiguration,
|
||||||
token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
_token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration> {
|
||||||
const resolveDebugConfigurationHandler = instrumentOperation("resolveDebugConfiguration", (operationId: string) => {
|
const resolveDebugConfigurationHandler = instrumentOperation("resolveDebugConfiguration", (_operationId: string) => {
|
||||||
try {
|
try {
|
||||||
// See https://github.com/microsoft/vscode-java-debug/issues/778
|
// See https://github.com/microsoft/vscode-java-debug/issues/778
|
||||||
// Merge the platform specific properties to the global config to simplify the subsequent resolving logic.
|
// Merge the platform specific properties to the global config to simplify the subsequent resolving logic.
|
||||||
|
@ -85,9 +86,9 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
return resolveDebugConfigurationHandler();
|
return resolveDebugConfigurationHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
private provideDebugConfigurationsAsync(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken) {
|
private provideDebugConfigurationsAsync(folder: vscode.WorkspaceFolder | undefined, _token?: vscode.CancellationToken) {
|
||||||
return vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, (p) => {
|
return vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, (p) => {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, _reject) => {
|
||||||
p.report({ message: "Auto generating configuration..." });
|
p.report({ message: "Auto generating configuration..." });
|
||||||
const defaultLaunchConfig = {
|
const defaultLaunchConfig = {
|
||||||
type: "java",
|
type: "java",
|
||||||
|
@ -104,7 +105,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
}
|
}
|
||||||
|
|
||||||
const mainClasses = await lsPlugin.resolveMainClass(folder ? folder.uri : undefined);
|
const mainClasses = await lsPlugin.resolveMainClass(folder ? folder.uri : undefined);
|
||||||
let cache;
|
let cache: {[key: string]: any};
|
||||||
cache = {};
|
cache = {};
|
||||||
const launchConfigs = mainClasses.map((item) => {
|
const launchConfigs = mainClasses.map((item) => {
|
||||||
return {
|
return {
|
||||||
|
@ -126,7 +127,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private mergePlatformProperties(folder: vscode.WorkspaceFolder, config: vscode.DebugConfiguration) {
|
private mergePlatformProperties(_folder: vscode.WorkspaceFolder, config: vscode.DebugConfiguration) {
|
||||||
if (config && platformName && config[platformName]) {
|
if (config && platformName && config[platformName]) {
|
||||||
try {
|
try {
|
||||||
for (const key of Object.keys(config[platformName])) {
|
for (const key of Object.keys(config[platformName])) {
|
||||||
|
@ -139,7 +140,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private constructLaunchConfigName(mainClass: string, projectName: string, cache: {}) {
|
private constructLaunchConfigName(mainClass: string, projectName: string, cache: {[key: string]: any}) {
|
||||||
const prefix = "Debug (Launch)-";
|
const prefix = "Debug (Launch)-";
|
||||||
let name = prefix + mainClass.substr(mainClass.lastIndexOf(".") + 1);
|
let name = prefix + mainClass.substr(mainClass.lastIndexOf(".") + 1);
|
||||||
if (projectName !== undefined) {
|
if (projectName !== undefined) {
|
||||||
|
@ -199,7 +200,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
const mainClassOption = await this.resolveLaunchConfig(folder ? folder.uri : undefined, config);
|
const mainClassOption = await this.resolveLaunchConfig(folder ? folder.uri : undefined, config);
|
||||||
if (!mainClassOption || !mainClassOption.mainClass) { // Exit silently if the user cancels the prompt fix by ESC.
|
if (!mainClassOption || !mainClassOption.mainClass) { // Exit silently if the user cancels the prompt fix by ESC.
|
||||||
// Exit the debug session.
|
// Exit the debug session.
|
||||||
return;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
config.mainClass = mainClassOption.mainClass;
|
config.mainClass = mainClassOption.mainClass;
|
||||||
|
@ -406,7 +407,7 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration
|
||||||
return selectedFix;
|
return selectedFix;
|
||||||
}
|
}
|
||||||
// return undefined if the user clicks "Learn More".
|
// return undefined if the user clicks "Learn More".
|
||||||
return;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new utility.UserError({
|
throw new utility.UserError({
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { initializeCodeLensProvider, startDebugging } from "./debugCodeLensProvi
|
||||||
import { handleHotCodeReplaceCustomEvent, initializeHotCodeReplace, NO_BUTTON, YES_BUTTON } from "./hotCodeReplace";
|
import { handleHotCodeReplaceCustomEvent, initializeHotCodeReplace, NO_BUTTON, YES_BUTTON } from "./hotCodeReplace";
|
||||||
import { JavaDebugAdapterDescriptorFactory } from "./javaDebugAdapterDescriptorFactory";
|
import { JavaDebugAdapterDescriptorFactory } from "./javaDebugAdapterDescriptorFactory";
|
||||||
import { logJavaException, logJavaInfo } from "./javaLogger";
|
import { logJavaException, logJavaInfo } from "./javaLogger";
|
||||||
import { IMainClassOption, IMainMethod, resolveMainClass, resolveMainMethod } from "./languageServerPlugin";
|
import { IMainClassOption, IMainMethod, resolveMainMethod } from "./languageServerPlugin";
|
||||||
import { logger, Type } from "./logger";
|
import { logger, Type } from "./logger";
|
||||||
import { mainClassPicker } from "./mainClassPicker";
|
import { mainClassPicker } from "./mainClassPicker";
|
||||||
import { pickJavaProcess } from "./processPicker";
|
import { pickJavaProcess } from "./processPicker";
|
||||||
|
@ -29,7 +29,7 @@ export async function activate(context: vscode.ExtensionContext) {
|
||||||
await instrumentOperation("activation", initializeExtension)(context);
|
await instrumentOperation("activation", initializeExtension)(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
function initializeExtension(operationId: string, context: vscode.ExtensionContext) {
|
function initializeExtension(_operationId: string, context: vscode.ExtensionContext) {
|
||||||
// Deprecated
|
// Deprecated
|
||||||
logger.initialize(context, true);
|
logger.initialize(context, true);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ function registerDebugEventListener(context: vscode.ExtensionContext) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleUserNotification(customEvent) {
|
function handleUserNotification(customEvent: vscode.DebugSessionCustomEvent) {
|
||||||
if (customEvent.body.notificationType === "ERROR") {
|
if (customEvent.body.notificationType === "ERROR") {
|
||||||
utility.showErrorMessageWithTroubleshooting({
|
utility.showErrorMessageWithTroubleshooting({
|
||||||
message: customEvent.body.message,
|
message: customEvent.body.message,
|
||||||
|
|
|
@ -38,7 +38,7 @@ export function initializeHotCodeReplace(context: vscode.ExtensionContext) {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function handleHotCodeReplaceCustomEvent(hcrEvent) {
|
export function handleHotCodeReplaceCustomEvent(hcrEvent: vscode.DebugSessionCustomEvent) {
|
||||||
if (hcrEvent.body.changeType === HcrChangeType.BUILD_COMPLETE) {
|
if (hcrEvent.body.changeType === HcrChangeType.BUILD_COMPLETE) {
|
||||||
if (getHotReloadFlag() === "auto") {
|
if (getHotReloadFlag() === "auto") {
|
||||||
return vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, (progress) => {
|
return vscode.window.withProgress({ location: vscode.ProgressLocation.Window }, (progress) => {
|
||||||
|
@ -62,6 +62,7 @@ export function handleHotCodeReplaceCustomEvent(hcrEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHotReloadFlag(): string {
|
function getHotReloadFlag(): string {
|
||||||
|
|
|
@ -43,10 +43,10 @@ class DebugHoverProvider implements Disposable {
|
||||||
}
|
}
|
||||||
|
|
||||||
class InternalDebugHoverProvider implements HoverProvider {
|
class InternalDebugHoverProvider implements HoverProvider {
|
||||||
public provideHover(document: TextDocument, position: Position, token: CancellationToken): ProviderResult<Hover> {
|
public provideHover(document: TextDocument, position: Position, _token: CancellationToken): ProviderResult<Hover> {
|
||||||
const range = document.getWordRangeAtPosition(position, /\w+/);
|
const range = document.getWordRangeAtPosition(position, /\w+/);
|
||||||
if (!range || document.getText(range) !== "main") {
|
if (!range || document.getText(range) !== "main") {
|
||||||
return;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const line = document.lineAt(position);
|
const line = document.lineAt(position);
|
||||||
|
@ -69,6 +69,8 @@ class InternalDebugHoverProvider implements HoverProvider {
|
||||||
contributed.isTrusted = true;
|
contributed.isTrusted = true;
|
||||||
return new Hover(contributed);
|
return new Hover(contributed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private isMainMethod(line: string): boolean {
|
private isMainMethod(line: string): boolean {
|
||||||
|
|
|
@ -8,8 +8,8 @@ import { Type } from "./logger";
|
||||||
import { convertErrorToMessage, showErrorMessageWithTroubleshooting } from "./utility";
|
import { convertErrorToMessage, showErrorMessageWithTroubleshooting } from "./utility";
|
||||||
|
|
||||||
export class JavaDebugAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
|
export class JavaDebugAdapterDescriptorFactory implements DebugAdapterDescriptorFactory {
|
||||||
public async createDebugAdapterDescriptor(session: DebugSession, executable: DebugAdapterExecutable): Promise<DebugAdapterDescriptor> {
|
public async createDebugAdapterDescriptor(_session: DebugSession, _executable: DebugAdapterExecutable): Promise<DebugAdapterDescriptor> {
|
||||||
let error;
|
let error: Error;
|
||||||
try {
|
try {
|
||||||
const debugServerPort = <number> (await startDebugSession());
|
const debugServerPort = <number> (await startDebugSession());
|
||||||
if (debugServerPort) {
|
if (debugServerPort) {
|
||||||
|
@ -28,5 +28,6 @@ export class JavaDebugAdapterDescriptorFactory implements DebugAdapterDescriptor
|
||||||
message: "Failed to start debug server.",
|
message: "Failed to start debug server.",
|
||||||
};
|
};
|
||||||
showErrorMessageWithTroubleshooting(message);
|
showErrorMessageWithTroubleshooting(message);
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
import { sendError, sendInfo, sendOperationError } from "vscode-extension-telemetry-wrapper";
|
import { sendInfo, sendOperationError } from "vscode-extension-telemetry-wrapper";
|
||||||
|
|
||||||
export function logJavaException(errorProperties: any): void {
|
export function logJavaException(errorProperties: any): void {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ export function startDebugSession() {
|
||||||
return commands.executeJavaLanguageServerCommand(commands.JAVA_START_DEBUGSESSION);
|
return commands.executeJavaLanguageServerCommand(commands.JAVA_START_DEBUGSESSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveClasspath(mainClass, projectName) {
|
export function resolveClasspath(mainClass: string, projectName: string) {
|
||||||
return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_CLASSPATH, mainClass, projectName);
|
return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_CLASSPATH, mainClass, projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ export async function isOnClasspath(uri: string): Promise<boolean> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveJavaExecutable(mainClass, projectName) {
|
export function resolveJavaExecutable(mainClass: string, projectName: string) {
|
||||||
return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_JAVAEXECUTABLE, mainClass, projectName);
|
return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_JAVAEXECUTABLE, mainClass, projectName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,8 +60,8 @@ export async function addMoreHelpfulVMArgs(config: vscode.DebugConfiguration) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkJavaVersion(javaExec: string): Promise<number> {
|
function checkJavaVersion(javaExec: string): Promise<number> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, _reject) => {
|
||||||
cp.execFile(javaExec, ["-version"], {}, (error, stdout, stderr) => {
|
cp.execFile(javaExec, ["-version"], {}, (_error, _stdout, stderr) => {
|
||||||
const javaVersion = parseMajorVersion(stderr);
|
const javaVersion = parseMajorVersion(stderr);
|
||||||
resolve(javaVersion);
|
resolve(javaVersion);
|
||||||
});
|
});
|
||||||
|
|
|
@ -35,7 +35,7 @@ class MainClassPicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options || !options.length) {
|
if (!options || !options.length) {
|
||||||
return;
|
return undefined;
|
||||||
} else if (autoPick && options.length === 1) {
|
} else if (autoPick && options.length === 1) {
|
||||||
return options[0];
|
return options[0];
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ class MainClassPicker {
|
||||||
if (selected) {
|
if (selected) {
|
||||||
return selected.data;
|
return selected.data;
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
|
@ -77,7 +78,7 @@ class MainClassPicker {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!options || !options.length) {
|
if (!options || !options.length) {
|
||||||
return;
|
return undefined;
|
||||||
} else if (autoPick && options.length === 1) {
|
} else if (autoPick && options.length === 1) {
|
||||||
return options[0];
|
return options[0];
|
||||||
}
|
}
|
||||||
|
@ -146,6 +147,7 @@ class MainClassPicker {
|
||||||
this.updateMRUTimestamp(selected.data);
|
this.updateMRUTimestamp(selected.data);
|
||||||
return selected.data;
|
return selected.data;
|
||||||
}
|
}
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getMRUTimestamp(mainClassOption: IMainClassOption): number {
|
private getMRUTimestamp(mainClassOption: IMainClassOption): number {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// Licensed under the MIT license.
|
// Licensed under the MIT license.
|
||||||
|
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
import { DebugConfiguration, window } from "vscode";
|
import { window } from "vscode";
|
||||||
import { getProcesses, getProcessTree } from "./processTree";
|
import { getProcesses, getProcessTree } from "./processTree";
|
||||||
|
|
||||||
const JAVA_PATTERN = /(?:java|javaw|j9|j9w)$/i;
|
const JAVA_PATTERN = /(?:java|javaw|j9|j9w)$/i;
|
||||||
|
@ -42,12 +42,14 @@ function convertToJavaProcess(pid: number, command: string, args: string): IJava
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pickJavaProcess(): Promise<IJavaProcess> {
|
export async function pickJavaProcess(): Promise<IJavaProcess> {
|
||||||
const javaProcesses: IJavaProcess[] = [];
|
const javaProcesses: IJavaProcess[] = [];
|
||||||
try {
|
try {
|
||||||
await getProcesses((pid: number, ppid: number, command: string, args: string, date: number) => {
|
await getProcesses((pid: number, _ppid: number, command: string, args: string, _date: number) => {
|
||||||
const javaProcess = convertToJavaProcess(pid, command, args);
|
const javaProcess = convertToJavaProcess(pid, command, args);
|
||||||
if (javaProcess) {
|
if (javaProcess) {
|
||||||
javaProcesses.push(javaProcess);
|
javaProcesses.push(javaProcess);
|
||||||
|
@ -79,6 +81,8 @@ export async function pickJavaProcess(): Promise<IJavaProcess> {
|
||||||
if (pick) {
|
if (pick) {
|
||||||
return pick.process;
|
return pick.process;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function resolveJavaProcess(pid: number): Promise<IJavaProcess | undefined> {
|
export async function resolveJavaProcess(pid: number): Promise<IJavaProcess | undefined> {
|
||||||
|
|
|
@ -14,7 +14,7 @@ export class JavaTerminalLinkProvder implements TerminalLinkProvider<IJavaTermin
|
||||||
* @param token A cancellation token.
|
* @param token A cancellation token.
|
||||||
* @return A list of terminal links for the given line.
|
* @return A list of terminal links for the given line.
|
||||||
*/
|
*/
|
||||||
public provideTerminalLinks(context: TerminalLinkContext, token: CancellationToken): ProviderResult<IJavaTerminalLink[]> {
|
public provideTerminalLinks(context: TerminalLinkContext, _token: CancellationToken): ProviderResult<IJavaTerminalLink[]> {
|
||||||
if (context.terminal.name !== "Java Debug Console" && context.terminal.name !== "Java Process Console") {
|
if (context.terminal.name !== "Java Debug Console" && context.terminal.name !== "Java Process Console") {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ export class JavaTerminalLinkProvder implements TerminalLinkProvider<IJavaTermin
|
||||||
lineNumber: sourceLineNumber,
|
lineNumber: sourceLineNumber,
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class UserError extends Error {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class JavaExtensionNotEnabledError extends Error {
|
export class JavaExtensionNotEnabledError extends Error {
|
||||||
constructor(message) {
|
constructor(message: string) {
|
||||||
super(message);
|
super(message);
|
||||||
setUserError(this);
|
setUserError(this);
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ export async function showErrorMessageWithTroubleshooting(message: ITroubleshoot
|
||||||
function handleTroubleshooting(choice: string, message: string, anchor: string): string | undefined {
|
function handleTroubleshooting(choice: string, message: string, anchor: string): string | undefined {
|
||||||
if (choice === LEARN_MORE) {
|
if (choice === LEARN_MORE) {
|
||||||
openTroubleshootingPage(message, anchor);
|
openTroubleshootingPage(message, anchor);
|
||||||
return;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
return choice;
|
return choice;
|
||||||
|
|
|
@ -12,7 +12,7 @@ suite("Extension Tests", () => {
|
||||||
|
|
||||||
test("should activate", function() {
|
test("should activate", function() {
|
||||||
this.timeout(1 * 60 * 1000);
|
this.timeout(1 * 60 * 1000);
|
||||||
return vscode.extensions.getExtension("vscjava.vscode-java-debug").activate().then((api) => {
|
return vscode.extensions.getExtension("vscjava.vscode-java-debug").activate().then((_api) => {
|
||||||
assert.ok(true);
|
assert.ok(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,12 +3,17 @@
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"target": "es6",
|
"target": "es6",
|
||||||
"outDir": "out",
|
"outDir": "out",
|
||||||
"alwaysStrict": true,
|
|
||||||
"lib": [
|
"lib": [
|
||||||
"es6"
|
"es6"
|
||||||
],
|
],
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"rootDir": "."
|
"rootDir": ".",
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noImplicitThis": true,
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"alwaysStrict": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|
Loading…
Reference in New Issue