CommandLinePatcher (final Project project, final PythonCommandLineState pyState, final int serverLocalPort, final RunProfile profile) { return new CommandLinePatcher() { @Override public void patchCommandLine(GeneralCommandLine commandLine) { // script name is the last parameter; all other params are for python interpreter; insert just before name ParametersList parametersList = commandLine.getParametersList(); @SuppressWarnings("ConstantConditions") @NotNull ParamsGroup debugParams = parametersList.getParamsGroup(PythonCommandLineState.GROUP_DEBUGGER); assert debugParams != null; boolean isModule = patchExeParams(parametersList); fillDebugParameters(project, debugParams, serverLocalPort, pyState, commandLine, profile, isModule); @SuppressWarnings("ConstantConditions") @NotNull ParamsGroup exeParams = parametersList.getParamsGroup(PythonCommandLineState.GROUP_EXE_OPTIONS); final PythonSdkFlavor<?> flavor = pyState.getSdkFlavor(); if (flavor != null) { assert exeParams != null; for (String option : flavor.getExtraDebugOptions()) { exeParams.addParameter(option); } } } }; }