Repository navigation
feat(run): run current files and individual functions - #51
Conversation
There was a problem hiding this comment.
Devin Review found 4 potential issues.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| .pointer("/document/path") | ||
| .and_then(Value::as_str) | ||
| .filter(|path| !path.is_empty()) | ||
| .filter(|path| safe_document_path(path)) |
There was a problem hiding this comment.
🔴 Java run actions reject host paths
When Viva opens a Java file, collect_actions_function rejects the absolute path Viva sends. Neither the gutter nor the current-file toolbar gets a Java Run or Debug action.
Learn more
The pinned Viva host passes the editor's native path through collectEditorActions and CollectEditorActions without converting it to a relative path. Its documents/getSnapshot response uses a different representation: summarize calls RelativePath to return a slash-separated workspace-relative path. Both representations reach collect_actions_function, but the new filter only accepts the latter. The integration host stub sends a relative path from the start, so it misses the desktop path.
Example: Viva passes /work/shop/src/App.java during gutter collection. The backend rejects it before asking JDT about main, even though the same document's snapshot reports src/App.java.
Recommended fix: Normalize the editor collection path to a verified workspace-relative identity before building the action. For native absolute paths, verify containment in the current workspace rather than accepting arbitrary absolute paths; retain relative-path validation and use the normalized identity for snapshot and rerun comparisons. Exercise both host path formats in the integration test.
Was this helpful? React with 👍 or 👎 to provide feedback.
| "signatureRequirement": "none" | ||
| }, | ||
| "permissions": ["backend.launch", "runtimes.install", "ui.contribute", "documents.contentProvider", "documents.read", "editor.actions", "languageServer.launch", "languageServer.request", "project.generate", "debug.launch", "debug.attach", "debug.start", "run.start", "window.messages", "workspace.metadata"], | ||
| "permissions": ["backend.launch", "runtimes.install", "ui.contribute", "documents.contentProvider", "documents.read", "documents.save", "editor.actions", "languageServer.launch", "languageServer.request", "project.generate", "debug.launch", "debug.attach", "debug.start", "run.start", "window.messages", "workspace.metadata"], |
There was a problem hiding this comment.
🔴 Save permission blocks plugin releases
documents.save is absent from the pinned manifest schema. The contract check rejects the package declaration in both CI and release validation.
Learn more
The SDK transport revision and the manifest schema revision are pinned separately. The SDK verification entry point also runs manifest validation, which loads checksum-pinned schemas from the contract lock. The locked schema's permission enum does not include documents.save, even though the newer Core used by the run-action host does. Both PR CI and release CI invoke that validator.
Example: Validation rejects permissions[6] because its value is documents.save, preventing the release workflow from passing its required test job.
Recommended fix: Move the contract pin and schema hashes to a reviewed Core revision that supports documents.save. Verify the manifest and translations against that revision and document the minimum compatible host. Keep the SDK transport revision independent if its existing request method works.
Was this helpful? React with 👍 or 👎 to provide feedback.
| let documents = context.host().documents().list(reference)?; | ||
| let document = documents["documents"] | ||
| .as_array() | ||
| .into_iter() | ||
| .flatten() | ||
| .find(|document| document["path"] == params["path"]) | ||
| .ok_or_else(invalid_target)?; |
There was a problem hiding this comment.
🟡 Rerun fails after closing source
After the user closes the source tab, rerun_function cannot find the file in the host’s open-document list. The Run panel’s Rerun button fails even though the source is saved and unchanged.
Learn more
In the pinned Viva host, rerunRun saves the project's open documents and forwards the data retained by the finished Run tab. Closing the source editor does not clear that data. The host's Documents implementation enumerates open tabs only. The new lookup therefore refuses a closed file before asking JDT whether the target still exists. The launch request already retains the workspace-relative target path.
Example: Run App.main(), close App.java, and press Rerun in the finished Run tab. The saved main still exists, but the backend refuses the run until the file is reopened.
Recommended fix: Keep the snapshot/versioned-save flow for open files. For a closed file, validate that the stored path identifies an existing file inside the current workspace and ask JDT to revalidate the saved declaration before starting. Cover Rerun with documents/list returning no matching tab.
Was this helpful? React with 👍 or 👎 to provide feedback.
| let snapshot = host | ||
| .documents() | ||
| .get_snapshot(reference, json!({"documentID": params["documentID"]}))?; |
There was a problem hiding this comment.
🟡 Large Java files cannot run
run_action_function requests a full snapshot even though it only needs the document path and version. Viva can collect actions for larger files but rejects snapshots over 128 KiB, so those actions never launch.
Learn more
The pinned Viva host sets EditorHost.ActionSourceBytes to 1 MiB for editor action collection, but handleDocumentsSnapshot delegates to Snapshot with a 128 KiB limit. The click only compares metadata from the snapshot, and action collection only reads the document path before asking JDT for declarations. A large document is therefore rejected before saving or launching, even if it is already clean.
Example: With action paths normalized, a 150 KiB Java file with a valid main can show a Run action. Clicking it fails with the snapshot size error; saving or reopening the file does not shrink it.
Recommended fix: Match the document ID against metadata from documents/list, check the path and revision, then revalidate the declaration and retain the expected-version save. Test a document above the snapshot limit but below the collection limit.
Was this helpful? React with 👍 or 👎 to provide feedback.
Closes #50
关联 Issue / Linked issue
Closes #50
PR 类型 / Type
改动说明 / What changes
背景 / Why
语言插件原有运行入口集中在构建窗口,编辑器打开当前文件时不能直接识别可执行入口;测试模块也不能从函数或方法声明旁边精确运行单个测试。这使模块依赖测试和快速回归需要手写命令或切换运行配置。
改动 / Changes
main、JUnit 测试类和方法,提供 Run/Debug gutter 入口;混合 main/test 类的类级动作优先测试动作,单方法使用精确 JUnit 标识符。editor.actions与run.start,点击前重新读取文档、版本、路径和声明;保存成功后才启动,rerun 会再次验证当前声明。/,拒绝空路径、绝对路径、盘符、反斜杠、控制字符、.和..;执行器路径和工具链来源按宿主选择解析。docs/feature-matrix.md,固定 Rust 工具链为 1.100.0,并保留 SDK revision65cf82343c5e315aae2e335b2e8f0217b703e89a。不在本 PR 范围内 / Out of scope
类型专属:feat
多平台对齐
范围检查 / Scope checks
功能矩阵 / Feature matrix
shared/platform-feature-matrix/features/<id>.json;这是插件能力,已更新本仓库docs/feature-matrix.md并如实保留 macOS/其他架构 pending。.artifacts/生成的矩阵视图或临时运行目录。插件归属 / Plugin ownership
shared/i18n/,插件清单和运行消息由插件自己翻译。UI 验证 / UI evidence
scripts/run/visual.mjs生成并检查 Viva 无头截图;覆盖 Windows x64、before/after/hover、light/dark、en/zh-Hans,逻辑窗口 1440×900(输出 2880×1800)。4191c1553486247026c767ccd52b5cd9e8f38115、Cored426f018065c950754140295e857bc71b870139f。统一日志系统 / Structured logging
stderr、print、私有事件 ID 或直接日志旁路。界面文案 / i18n
node scripts/i18n/verify-app-language-localization.mjs已通过。node scripts/i18n/generate-i18n.mjs --check:宿主基线已有desktop/internal/i18n/shared.generated.go漂移;本 PR 未修改宿主来掩盖该既有问题。逻辑归属 / Logic placement
性能与内存 / Performance and memory
设置 / Settings
插件契约 / Plugin contract
editor.actions/run.start。65cf82343c5e315aae2e335b2e8f0217b703e89a;本 PR 不需要升级 Core pin 或新增 API 计划编号。发行包与资源 / Bundle and resources
verify-runtime-bundle-immutability.sh只属于 Lithe-IDEA 宿主仓;本 PR 没有宿主 bundle 改动。无用代码与重构 / Dead code and refactoring
验证 / Verification
git diff --check、node --check scripts/run/*.mjsscripts/run/actions.mjs真实工具 action(证据:.artifacts/run/evidence.json)scripts/run/visual.mjsViva 无头截图未能执行的检查和原因:
.artifacts/test-stabilityHTML/JUnit、最终 package/manifest/store 门禁尚未生成,留给 CI/维护者验收。actionlint当前版本不认识仓库既有的 GitHub runner 标签(Go 的windows-11-arm、Java 的macos-26),未因工具限制修改工作流。scripts/package/*.test.mjs中的 Linux ELF executable-bit 检查在 Windows 上无法执行,留给 Linux CI;macOS 原生窗口仍 pending。提交前确认 / Final checks
main创建;目标分支:maintarget/、dist/、.artifacts/临时产物、凭据、个人路径或未脱敏日志;截图为本仓库固定 fixture 的验收证据。