Skip to content

Commit

Permalink
Merge pull request #167944 from microsoft/tyriar/164941
Browse files Browse the repository at this point in the history
Remove unneeded exports in areas I own
  • Loading branch information
Tyriar authored Dec 2, 2022
2 parents 35a9edb + 276a661 commit ec70dcd
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 65 deletions.
25 changes: 1 addition & 24 deletions src/vs/base/node/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { release, userInfo } from 'os';
import { userInfo } from 'os';
import * as platform from 'vs/base/common/platform';
import { getFirstAvailablePowerShellInstallation } from 'vs/base/node/powershell';
import * as processes from 'vs/base/node/processes';
Expand All @@ -25,18 +25,6 @@ export async function getSystemShell(os: platform.OperatingSystem, env: platform
return getSystemShellUnixLike(os, env);
}

export function getSystemShellSync(os: platform.OperatingSystem, env: platform.IProcessEnvironment): string {
if (os === platform.OperatingSystem.Windows) {
if (platform.isWindows) {
return getSystemShellWindowsSync(env);
}
// Don't detect Windows shell when not on Windows
return processes.getWindowsShell(env);
}

return getSystemShellUnixLike(os, env);
}

let _TERMINAL_DEFAULT_SHELL_UNIX_LIKE: string | null = null;
function getSystemShellUnixLike(os: platform.OperatingSystem, env: platform.IProcessEnvironment): string {
// Only use $SHELL for the current OS
Expand Down Expand Up @@ -80,14 +68,3 @@ async function getSystemShellWindows(): Promise<string> {
}
return _TERMINAL_DEFAULT_SHELL_WINDOWS;
}

function getSystemShellWindowsSync(env: platform.IProcessEnvironment): string {
if (_TERMINAL_DEFAULT_SHELL_WINDOWS) {
return _TERMINAL_DEFAULT_SHELL_WINDOWS;
}

const isAtLeastWindows10 = platform.isWindows && parseFloat(release()) >= 10;
const is32ProcessOn64Windows = env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
const powerShellPath = `${env['windir']}\\${is32ProcessOn64Windows ? 'Sysnative' : 'System32'}\\WindowsPowerShell\\v1.0\\powershell.exe`;
return isAtLeastWindows10 ? powerShellPath : processes.getWindowsShell(env);
}
2 changes: 1 addition & 1 deletion src/vs/base/parts/quickinput/browser/quickInputList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ export class QuickInputList {
}
}

export function matchesContiguousIconAware(query: string, target: IParsedLabelWithIcons): IMatch[] | null {
function matchesContiguousIconAware(query: string, target: IParsedLabelWithIcons): IMatch[] | null {

const { text, iconOffsets } = target;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ function getOutputForCommand(executedMarker: IMarker | undefined, endMarker: IMa
return output === '' ? undefined : output;
}

export function getOutputMatchForCommand(executedMarker: IMarker | undefined, endMarker: IMarker | undefined, buffer: IBuffer, cols: number, outputMatcher: ITerminalOutputMatcher): ITerminalOutputMatch | undefined {
function getOutputMatchForCommand(executedMarker: IMarker | undefined, endMarker: IMarker | undefined, buffer: IBuffer, cols: number, outputMatcher: ITerminalOutputMatcher): ITerminalOutputMatch | undefined {
if (!executedMarker || !endMarker) {
return undefined;
}
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/terminal/node/ptyService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ const enum InteractionState {
Session = 'Session'
}

export class PersistentTerminalProcess extends Disposable {
class PersistentTerminalProcess extends Disposable {

private readonly _bufferer: TerminalDataBufferer;
private readonly _autoReplies: Map<string, TerminalAutoResponder> = new Map();
Expand Down Expand Up @@ -951,7 +951,7 @@ function printTime(ms: number): string {
return `${_h}${_m}${_s}${_ms}`;
}

export interface ITerminalSerializer {
interface ITerminalSerializer {
handleData(data: string): void;
freeRawReviveBuffer(): void;
handleResize(cols: number, rows: number): void;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/platform/terminal/node/terminalEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ export function getShellIntegrationInjection(
return undefined;
}

export enum ShellIntegrationExecutable {
enum ShellIntegrationExecutable {
WindowsPwsh = 'windows-pwsh',
WindowsPwshLogin = 'windows-pwsh-login',
Pwsh = 'pwsh',
Expand All @@ -226,7 +226,7 @@ export enum ShellIntegrationExecutable {
Bash = 'bash'
}

export const shellIntegrationArgs: Map<ShellIntegrationExecutable, string[]> = new Map();
const shellIntegrationArgs: Map<ShellIntegrationExecutable, string[]> = new Map();
// The try catch swallows execution policy errors in the case of the archive distributable
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwsh, ['-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
shellIntegrationArgs.set(ShellIntegrationExecutable.WindowsPwshLogin, ['-l', '-noexit', '-command', 'try { . \"{0}\\out\\vs\\workbench\\contrib\\terminal\\browser\\media\\shellIntegration.ps1\" } catch {}{1}']);
Expand Down
4 changes: 0 additions & 4 deletions src/vs/platform/terminal/node/terminalProfiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,10 +365,6 @@ export interface IFsProvider {
readFile(path: string): Promise<Buffer>;
}

export interface IProfileVariableResolver {
resolve(text: string[]): Promise<string[]>;
}

interface IPotentialTerminalProfile {
profileName: string;
paths: string[];
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/common/extHostTerminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ export class ExtHostTerminal {
}
}

export class ExtHostPseudoterminal implements ITerminalChildProcess {
class ExtHostPseudoterminal implements ITerminalChildProcess {
readonly id = 0;
readonly shouldPersist = false;

Expand Down Expand Up @@ -861,7 +861,7 @@ export abstract class BaseExtHostTerminalService extends Disposable implements I
}
}

export class EnvironmentVariableCollection implements vscode.EnvironmentVariableCollection {
class EnvironmentVariableCollection implements vscode.EnvironmentVariableCollection {
readonly map: Map<string, vscode.EnvironmentVariableMutator> = new Map();
private _persistent: boolean = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ import * as dom from 'vs/base/browser/dom';
import { RunOnceScheduler } from 'vs/base/common/async';
import { convertBufferRangeToViewport } from 'vs/workbench/contrib/terminal/browser/links/terminalLinkHelpers';
import { isMacintosh } from 'vs/base/common/platform';
import { localize } from 'vs/nls';
import { Emitter, Event } from 'vs/base/common/event';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TerminalLinkType } from 'vs/workbench/contrib/terminal/browser/links/links';
import { IHoverAction } from 'vs/workbench/services/hover/browser/hover';

export const OPEN_FILE_LABEL = localize('openFile', 'Open file in editor');
export const FOLDER_IN_WORKSPACE_LABEL = localize('focusFolder', 'Focus folder in explorer');
export const FOLDER_NOT_IN_WORKSPACE_LABEL = localize('openFolder', 'Open folder in new window');

export class TerminalLink extends DisposableStore implements ILink {
decorations: ILinkDecorations;
asyncActivate: Promise<void> | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import type { IViewportRange, IBufferRange, IBufferLine, IBufferCellPosition, IBuffer } from 'xterm';
import type { IViewportRange, IBufferRange, IBufferLine, IBuffer } from 'xterm';
import { IRange } from 'vs/editor/common/core/range';
import { OperatingSystem } from 'vs/base/common/platform';
import { IPath, posix, win32 } from 'vs/base/common/path';
Expand Down Expand Up @@ -139,18 +139,18 @@ export function getXtermLineContent(buffer: IBuffer, lineStart: number, lineEnd:
}


export function positionIsInRange(position: IBufferCellPosition, range: IBufferRange): boolean {
if (position.y < range.start.y || position.y > range.end.y) {
return false;
}
if (position.y === range.start.y && position.x < range.start.x) {
return false;
}
if (position.y === range.end.y && position.x > range.end.x) {
return false;
}
return true;
}
// export function positionIsInRange(position: IBufferCellPosition, range: IBufferRange): boolean {
// if (position.y < range.start.y || position.y > range.end.y) {
// return false;
// }
// if (position.y === range.start.y && position.x < range.start.x) {
// return false;
// }
// if (position.y === range.end.y && position.x > range.end.x) {
// return false;
// }
// return true;
// }

/**
* For shells with the CommandDetection capability, the cwd for a command relative to the line of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ import { convertBufferRangeToViewport } from 'vs/workbench/contrib/terminal/brow
import { RunOnceScheduler } from 'vs/base/common/async';

export type XtermLinkMatcherHandler = (event: MouseEvent | undefined, link: string) => Promise<void>;
export type XtermLinkMatcherValidationCallback = (uri: string, callback: (isValid: boolean) => void) => void;

interface IPath {
join(...paths: string[]): string;
Expand Down
8 changes: 0 additions & 8 deletions src/vs/workbench/contrib/terminal/browser/terminal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,14 +414,6 @@ export interface ISearchOptions {
incremental?: boolean;
}

export interface ITerminalBeforeHandleLinkEvent {
terminal?: ITerminalInstance;
/** The text of the link */
link: string;
/** Call with whether the link was handled by the interceptor */
resolve(wasHandled: boolean): void;
}

export interface ITerminalInstance {
/**
* The ID of the terminal instance, this is an arbitrary number only used to uniquely identify
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { TerminalQuickFixType } from 'vs/workbench/contrib/terminal/browser/widg
export const GitCommandLineRegex = /git/;
export const GitPushCommandLineRegex = /git\s+push/;
export const GitTwoDashesRegex = /error: did you mean `--(.+)` \(with two dashes\)\?/;
export const AnyCommandLineRegex = /.+/;
const AnyCommandLineRegex = /.+/;
export const GitSimilarOutputRegex = /(?:(most similar (command|commands) (is|are)))((\n\s*(?<fixedCommand>[^\s]+))+)/m;
export const FreePortOutputRegex = /address already in use (0\.0\.0\.0|127\.0\.0\.1|localhost|::):(?<portNumber>\d{4,5})|Unable to bind [^ ]*:(\d{4,5})|can't listen on port (\d{4,5})|listen EADDRINUSE [^ ]*:(\d{4,5})/;
export const GitPushOutputRegex = /git push --set-upstream origin (?<branchName>[^\s]+)/;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { IFileQuery, ISearchComplete, ISearchService } from 'vs/workbench/servic
import { SearchService } from 'vs/workbench/services/search/common/searchService';
import { ITerminalOutputMatcher } from 'vs/platform/terminal/common/xterm/terminalQuickFix';

export interface ITerminalLinkActivationResult {
interface ITerminalLinkActivationResult {
source: 'editor' | 'search';
link: string;
selection?: ITextEditorSelection;
Expand Down

0 comments on commit ec70dcd

Please sign in to comment.