Allow a launch to override the standard input file of its launch configuration
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start in ProcessConsole, where it reads IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE from the launch configuration only, and check how the process's ILaunch is reachable there. Add a lookup on the launch attribute that takes precedence, then extend ProcessConsoleTests and update the attribute's javadoc. Done when a launch-level value wins over the configuration's Input File and the existing EOF and missing-file behaviour still holds.
由索引模型根据 Issue 内容生成。
描述
Use case
I write small C and Java programs that read their input from stdin, and I debug them over and over with the same input. Today there are two ways to supply it:
- type or paste it into the console on every run, or
- set Common > Input File in the launch configuration, separately for every configuration. A new program needs a new configuration and its own setup before the first run which is tedious process since there are no keyboard shortcuts for that.
Other IDEs make this a one-time setting. In VS Code, for example, a single launch configuration with an input file applies to whatever program is started - be it a python script or a C program.
I built a plugin with a toolbar toggle. When it is on, every Run and Debug launch reads its standard input from one chosen file. It works with CDT (run, and debug with GDB) and with Java launches. It feeds the file through the process's IStreamsProxy and closes the input for EOF.
It has one gap a plugin cannot close: when a launch configuration has its own Input File, ProcessConsole feeds that file as well, and the two inputs get mixed. ProcessConsole reads IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE only from the launch configuration, so nothing outside the configuration can change which file a launch reads.
Proposal
Let the launch override the configuration. ProcessConsole would first look for ATTR_CAPTURE_STDIN_FILE among the attributes of the process's ILaunch, and use the launch configuration's attribute only if the launch has none:
String stdinFile = process.getLaunch().getAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE);
if (stdinFile == null && configuration != null) {
stdinFile = configuration.getAttribute(IDebugUIConstants.ATTR_CAPTURE_STDIN_FILE, (String) null);
}
A plugin sets the attribute in ILaunchListener.launchAdded, which runs before the launch delegate creates any process. Everything else already exists:
- resolving variables in the file name,
- the "file not found" message,
- EOF after the file (#2969),
- a new console for every process the launch gets later, for example after a restart of a CDT debug session.
The plugin would then only set the attribute. It would no longer write to process streams or touch launch configurations.
This adds no new API type. The javadoc of ATTR_CAPTURE_STDIN_FILE would say that it may also be set on the launch, and that the launch's value wins.
The same could be done for ATTR_CAPTURE_IN_FILE (output file) for symmetry, but I have no use case for that.
Alternative
A more general variant is a contributed input provider: an extension point or service returning the InputStream for a process, so input could also come from somewhere other than a file. That needs new API, plus a priority order when several providers claim the same process. The launch attribute covers
the file case with much less, and a provider could still be added later.
Limitation
Without a ProcessConsole (Common > Allocate console off), no input is fed, neither from the configuration nor from the launch. That is unchanged.
A prototype with tests in ProcessConsoleTests is on my fork: https://github.com/anydoby/eclipse.platform/tree/launch-stdin-override. I'll open it as a PR if this direction is acceptable
Here's how my plugin looks like today (I only have it locally, not shared with the community yet, but if this feature is accepted I can also share the plugin since it will be much more usable).
- 主要语言
- Java
- 星标
- 165
- 派生
- 174
- 平均合并
- 4 天 1 小时
- 30 天内合并 PR
- 41
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
eclipse-platform/eclipse.platform 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
eclipse-platform/eclipse.platform#3019 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
eclipse-platform/eclipse.platform#2940 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 68/100
eclipse-platform/eclipse.platform#2593 · 7 条评论 ·
维护者通常 1 天内回复
-
JGit runtime logs are spamming debugger console可能已有人在做 @HannesWell 于 15 天前认领。 未关闭bug regression
难度 3/5 1-2 天 新手友好度 56/100
eclipse-platform/eclipse.platform#3022 · 19 条评论 ·
维护者通常 1 天内回复
-
enhancement
难度 4/5 3-5 天 新手友好度 42/100
eclipse-platform/eclipse.platform#3015 ·
维护者通常 1 天内回复
查看 eclipse-platform/eclipse.platform 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
aws/context-ontology-accelerator#325 ·
维护者通常 1 天内回复
-
The README tells to run `mvn jeo:disassemble`, which fails with `No plugin found for prefix 'jeo'`未关闭
难度 1/5 1 小时以内 新手友好度 82/100
objectionary/jeo-maven-plugin#1938 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
oVirt/ovirt-engine#1219 ·
维护者通常 1 天内回复
-
pending:code-area pending:issue-category to-triage
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
area:core bug priority:p2
难度 2/5 1-3 小时 新手友好度 82/100
aomarai/minecraft-mcp#247 ·
维护者通常 1 天内回复