diff --git a/src/commands.ts b/src/commands.ts index 7d8e4eb..de8086a 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +import * as vscode from "vscode"; + export const VSCODE_STARTDEBUG = "vscode.startDebug"; export const VSCODE_ADD_DEBUGCONFIGURATION = "debug.addConfiguration"; @@ -16,3 +18,8 @@ export const JAVA_EXECUTE_WORKSPACE_COMMAND = "java.execute.workspaceCommand"; export const JAVA_FETCH_USAGE_DATA = "vscode.java.fetchUsageData"; export const JAVA_CONFIG_LOG_LEVEL = "vscode.java.configLogLevel"; + +export function executeJavaLanguageServerCommand(...rest) { + // TODO: need to handle error and trace telemetry + return vscode.commands.executeCommand(JAVA_EXECUTE_WORKSPACE_COMMAND, ...rest); +} diff --git a/src/configurationProvider.ts b/src/configurationProvider.ts index 23cedd0..ffb613a 100644 --- a/src/configurationProvider.ts +++ b/src/configurationProvider.ts @@ -114,33 +114,28 @@ export class JavaDebugConfigurationProvider implements vscode.DebugConfiguration } } -export function executeJavaLanguageServerCommand(...rest) { - // TODO: need to handle error and trace telemetry - return vscode.commands.executeCommand(commands.JAVA_EXECUTE_WORKSPACE_COMMAND, ...rest); -} - function startDebugSession() { - return executeJavaLanguageServerCommand(commands.JAVA_START_DEBUGSESSION); + return commands.executeJavaLanguageServerCommand(commands.JAVA_START_DEBUGSESSION); } function resolveClasspath(mainClass, projectName) { - return executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_CLASSPATH, mainClass, projectName); + return commands.executeJavaLanguageServerCommand(commands.JAVA_RESOLVE_CLASSPATH, mainClass, projectName); } function configLogLevel(level) { - return executeJavaLanguageServerCommand(commands.JAVA_CONFIG_LOG_LEVEL, convertLogLevel(level)); + return commands.executeJavaLanguageServerCommand(commands.JAVA_CONFIG_LOG_LEVEL, convertLogLevel(level)); } function convertLogLevel(commonLogLevel: string) { // convert common log level to java log level - switch (commonLogLevel.toLowerCase()) { - case "verbose" : + switch (commonLogLevel.toLowerCase()) { + case "verbose": return "FINE"; - case "warn" : + case "warn": return "WARNING"; - case "error" : + case "error": return "SEVERE"; - case "info" : + case "info": return "INFO"; default: return "FINE"; diff --git a/src/extension.ts b/src/extension.ts index fcc63f6..6dc2bf2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -5,7 +5,7 @@ import * as path from "path"; import * as vscode from "vscode"; import TelemetryReporter from "vscode-extension-telemetry"; import * as commands from "./commands"; -import { executeJavaLanguageServerCommand, JavaDebugConfigurationProvider } from "./configurationProvider"; +import { JavaDebugConfigurationProvider } from "./configurationProvider"; export function activate(context: vscode.ExtensionContext) { // The reporter will be initialized by the later telemetry handler. @@ -52,5 +52,5 @@ export function deactivate() { } function fetchUsageData() { - return executeJavaLanguageServerCommand(commands.JAVA_FETCH_USAGE_DATA); + return commands.executeJavaLanguageServerCommand(commands.JAVA_FETCH_USAGE_DATA); }