From 1e0086f16827a4b47b179fdf9222175845bdcd13 Mon Sep 17 00:00:00 2001 From: alexander gilin Date: Thu, 11 Feb 2021 09:59:20 +0200 Subject: [PATCH] [vscode] support for 'pathSeparator' variable substitution, where ${pathSeparator} - / on macOS or linux, \\ on Windows Signed-off-by: Alex Gilin --- .../src/browser/common-variable-contribution.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/variable-resolver/src/browser/common-variable-contribution.ts b/packages/variable-resolver/src/browser/common-variable-contribution.ts index 318f87d3c32a3..a23ee1c2bfdc8 100644 --- a/packages/variable-resolver/src/browser/common-variable-contribution.ts +++ b/packages/variable-resolver/src/browser/common-variable-contribution.ts @@ -18,6 +18,7 @@ import { injectable, inject } from 'inversify'; import { VariableContribution, VariableRegistry } from './variable'; import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; import { CommandService } from '@theia/core/lib/common/command'; +import { isWindows } from '@theia/core/lib/common/os'; import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service'; import { ResourceContextKey } from '@theia/core/lib/browser/resource-context-key'; import { VariableInput } from './variable-input'; @@ -129,6 +130,10 @@ export class CommonVariableContribution implements VariableContribution { return undefined; } }); + variables.registerVariable({ + name: 'pathSeparator', + resolve: () => isWindows ? '\\' : '/' + }); } }