src/vs/workbench/contrib/terminal/browser/terminalQuickFixBuiltinActions.ts/freePort
export function freePort(terminalInstance?: Partial<ITerminalInstance>): IInternalOptions {
	return {
		id: 'Free Port',
		type: 'internal',
		commandLineMatcher: AnyCommandLineRegex,
		outputMatcher: {
			lineMatcher: FreePortOutputRegex,
			anchor: 'bottom',
			offset: 0,
			length: 30
		},
		exitStatus: false,
		getQuickFixes: (matchResult: ITerminalCommandMatchResult) => {
			const port = matchResult?.outputMatch?.regexMatch?.groups?.portNumber;
			if (!port) {
				return;
			}
			const label = localize("terminal.freePort", "Free port {0}", port);
			return {
				class: TerminalQuickFixType.Port,
				tooltip: label,
				id: 'Free Port',
				label,
				enabled: true,
				run: async () => {
					await terminalInstance?.freePortKillProcess?.(port, matchResult.commandLine);
				}
			};
		}
	};
}