From 6aa2de7e8a2a20d08fe78c93f295b1296c050208 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 2 Jun 2016 12:31:41 +0200 Subject: [PATCH] Operating System Specific Properties in launch.json fixes #1873 --- src/vs/workbench/parts/debug/common/debug.ts | 10 ++++++++-- .../workbench/parts/debug/node/debugAdapter.ts | 12 ++++++++++++ .../debug/node/debugConfigurationManager.ts | 18 ++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debug.ts b/src/vs/workbench/parts/debug/common/debug.ts index 713550ad18d..f4fcfae1ad0 100644 --- a/src/vs/workbench/parts/debug/common/debug.ts +++ b/src/vs/workbench/parts/debug/common/debug.ts @@ -12,7 +12,7 @@ import { IViewletView } from 'vs/workbench/browser/viewlet'; import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation'; import editor = require('vs/editor/common/editorCommon'); import { Source } from 'vs/workbench/parts/debug/common/debugSource'; -import {Range} from 'vs/editor/common/core/range'; +import { Range } from 'vs/editor/common/core/range'; export const VIEWLET_ID = 'workbench.view.debug'; export const REPL_ID = 'workbench.panel.repl'; @@ -194,7 +194,7 @@ export interface IGlobalConfig { configurations: IConfig[]; } -export interface IConfig { +export interface IEnvConfig { name?: string; type: string; request: string; @@ -217,6 +217,12 @@ export interface IConfig { silentlyAbort?: boolean; } +export interface IConfig extends IEnvConfig { + windows?: IEnvConfig; + osx?: IEnvConfig; + linux?: IEnvConfig; +} + export interface IRawEnvAdapter { type?: string; label?: string; diff --git a/src/vs/workbench/parts/debug/node/debugAdapter.ts b/src/vs/workbench/parts/debug/node/debugAdapter.ts index 3cd24f2909c..8ee23198df4 100644 --- a/src/vs/workbench/parts/debug/node/debugAdapter.ts +++ b/src/vs/workbench/parts/debug/node/debugAdapter.ts @@ -114,6 +114,18 @@ export class Adapter { default: 'openOnFirstSessionStart', description: nls.localize('internalConsoleOptions', "Controls behavior of the internal debug console.") }; + properties.windows = { + type: 'object', + description: nls.localize('debugWindowsConfiguration', "Windows specific launch configuration attributes.") + }; + properties.osx = { + type: 'object', + description: nls.localize('debugOSXConfiguration', "OS X specific launch configuration attributes.") + }; + properties.linux = { + type: 'object', + description: nls.localize('debugLinuxConfiguration', "Linux specific launch configuration attributes.") + }; this.warnRelativePaths(properties.outDir); this.warnRelativePaths(properties.program); this.warnRelativePaths(properties.cwd); diff --git a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts index db3e53144e7..45159bd58bb 100644 --- a/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts +++ b/src/vs/workbench/parts/debug/node/debugConfigurationManager.ts @@ -8,6 +8,7 @@ import nls = require('vs/nls'); import { sequence } from 'vs/base/common/async'; import { TPromise } from 'vs/base/common/winjs.base'; import strings = require('vs/base/common/strings'); +import {isLinux, isMacintosh, isWindows} from 'vs/base/common/platform'; import Event, { Emitter } from 'vs/base/common/event'; import objects = require('vs/base/common/objects'); import uri from 'vs/base/common/uri'; @@ -288,6 +289,23 @@ export class ConfigurationManager implements debug.IConfigurationManager { this.configuration = objects.deepClone(nameOrConfig); } + // Set operating system specific properties #1873 + if (isWindows && this.configuration.windows) { + Object.keys(this.configuration.windows).forEach(key => { + this.configuration[key] = this.configuration.windows[key]; + }); + } + if (isMacintosh && this.configuration.osx) { + Object.keys(this.configuration.osx).forEach(key => { + this.configuration[key] = this.configuration.osx[key]; + }); + } + if (isLinux && this.configuration.linux) { + Object.keys(this.configuration.linux).forEach(key => { + this.configuration[key] = this.configuration.linux[key]; + }); + } + // massage configuration attributes - append workspace path to relatvie paths, substitute variables in paths. if (this.configuration && this.systemVariables) { Object.keys(this.configuration).forEach(key => { -- GitLab