feature: Add editor for .class, .semanticdb and tasty files#1908
feature: Add editor for .class, .semanticdb and tasty files#1908tgodzik merged 1 commit intoscalameta:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughAdds a VS Code custom readonly editor (viewType "metals.classDecoder") to decode and display Changes
Sequence DiagramsequenceDiagram
participant User
participant VSCode as VS Code
participant CustomEditor as Custom Editor Provider
participant LanguageClient
participant MetalsServer as Metals Server
participant FileDecoder as decodeAndShowFile
User->>VSCode: Open `.class`/`.tasty`/`.semanticdb` file
VSCode->>CustomEditor: Resolve custom editor (metals.classDecoder)
CustomEditor->>LanguageClient: Ensure client started
LanguageClient-->>CustomEditor: Client ready
CustomEditor->>CustomEditor: Determine decode mode (file suffix or `metals.classFileOpenEncoding`)
alt Mode is "none" or unsupported
CustomEditor->>VSCode: Open file as text editor
else Mode is supported
CustomEditor->>FileDecoder: Request decoded content with mode
FileDecoder->>MetalsServer: Ask for decoded output
MetalsServer-->>FileDecoder: Return decoded content
FileDecoder->>VSCode: Render decoded content in webview
end
VSCode-->>User: Display file content
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/classFileCustomEditor.ts (1)
79-81: Simplify redundant mode check.
mode !== "tasty-decoded"is unnecessary here because"tasty-decoded"is already allowed byisClassFileOpenDecoder(mode).Suggested cleanup
- if ( - mode === "none" || - (!isClassFileOpenDecoder(mode) && mode !== "tasty-decoded") - ) { + if (mode === "none" || !isClassFileOpenDecoder(mode)) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/classFileCustomEditor.ts` around lines 79 - 81, The condition block in the class file editor contains a redundant check: remove the explicit `mode !== "tasty-decoded"` from the compound conditional and rely on `isClassFileOpenDecoder(mode)` to already allow `"tasty-decoded"`; update the conditional around `mode === "none" || (!isClassFileOpenDecoder(mode) && mode !== "tasty-decoded")` to the simplified form using only `mode === "none" || !isClassFileOpenDecoder(mode)` so the logic stays equivalent and clearer (locate the check near the existing `isClassFileOpenDecoder(mode)` usage in classFileCustomEditor.ts).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/classFileCustomEditor.ts`:
- Line 68: Replace the use of the var declaration for the variable named "mode"
with a block-scoped let declaration to satisfy the ESLint no-var rule; locate
the var mode declaration in src/classFileCustomEditor.ts (identifier: mode) and
change it to let mode so CI linting passes and scoping is correct.
---
Nitpick comments:
In `@src/classFileCustomEditor.ts`:
- Around line 79-81: The condition block in the class file editor contains a
redundant check: remove the explicit `mode !== "tasty-decoded"` from the
compound conditional and rely on `isClassFileOpenDecoder(mode)` to already allow
`"tasty-decoded"`; update the conditional around `mode === "none" ||
(!isClassFileOpenDecoder(mode) && mode !== "tasty-decoded")` to the simplified
form using only `mode === "none" || !isClassFileOpenDecoder(mode)` so the logic
stays equivalent and clearer (locate the check near the existing
`isClassFileOpenDecoder(mode)` usage in classFileCustomEditor.ts).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ffd54823-fadc-4d91-83d0-b59c12e546ad
📒 Files selected for processing (3)
package.jsonsrc/classFileCustomEditor.tssrc/extension.ts
This allows users to use metals decoding for binary files. It will show up after "open anyway" and we can make Metals the default in the settings.
This allows users to use metals decoding for binary files. It will show up after "open anyway" and we can make Metals the default in the settings.
Summary by CodeRabbit