do not show lineNumbers in console editor#883
Conversation
✅ Deploy Preview for livecodes ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded a Monaco editor configuration to disable line numbers in console instances and made Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Core as core.getAllEditors()
participant Monaco as Monaco.init(consoleOptions)
Note over Monaco: Initialization change (UI-only)
Caller->>Monaco: initialize editor/console
activate Monaco
Monaco-->>Caller: editor instance (with lineNumbers: 'off')
deactivate Monaco
Note over Core: Collection change (control-flow)
Caller->>Core: getAllEditors()
activate Core
Core->>Core: gather potential editors (may include null/undefined)
Core-->>Core: filter out null/undefined entries
Core-->>Caller: return CodeEditor[] (only valid editors)
deactivate Core
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
|
Size Change: -200 B (-0.02%) Total Size: 956 kB ℹ️ View Unchanged
|
Deploying livecodes with
|
| Latest commit: |
2d6fa4c
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://251c5e18.livecodes.pages.dev |
| Branch Preview URL: | https://fix-console-line-numbers.livecodes.pages.dev |
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/livecodes/core.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/livecodes/core.ts (1)
src/sdk/models.ts (1)
CodeEditor(1521-1558)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: Redirect rules - livecodes
- GitHub Check: Header rules - livecodes
- GitHub Check: Pages changed - livecodes
- GitHub Check: build (18.x)
- GitHub Check: tests (18.x, 5)
- GitHub Check: tests (18.x, 1)
- GitHub Check: tests (18.x, 4)
- GitHub Check: tests (18.x, 2)
- GitHub Check: tests (18.x, 3)
- GitHub Check: build (18.x)
| const getAllEditors = (): CodeEditor[] => | ||
| [ | ||
| ...Object.values(editors), | ||
| toolsPane?.console?.getEditor?.(), | ||
| toolsPane?.compiled?.getEditor?.(), | ||
| ].filter((x) => x != null); |
There was a problem hiding this comment.
Use a proper type guard in the filter.
The filter((x) => x != null) call still yields (CodeEditor | undefined)[], so the function body is not assignable to the declared CodeEditor[] return type and fails TypeScript’s strict checking. Please tighten the predicate to narrow the type before returning.
- ].filter((x) => x != null);
+ ].filter((x): x is CodeEditor => x != null);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const getAllEditors = (): CodeEditor[] => | |
| [ | |
| ...Object.values(editors), | |
| toolsPane?.console?.getEditor?.(), | |
| toolsPane?.compiled?.getEditor?.(), | |
| ].filter((x) => x != null); | |
| const getAllEditors = (): CodeEditor[] => | |
| [ | |
| ...Object.values(editors), | |
| toolsPane?.console?.getEditor?.(), | |
| toolsPane?.compiled?.getEditor?.(), | |
| ].filter((x): x is CodeEditor => x != null); |
🤖 Prompt for AI Agents
In src/livecodes/core.ts around lines 1972-1977, the array filter currently uses
filter((x) => x != null) which does not narrow the type to CodeEditor[]; replace
that predicate with a proper TypeScript type guard such as filter((x): x is
CodeEditor => x != null) (or an equivalent type-predicate function) so the
result is correctly inferred as CodeEditor[] and satisfies strict checking.



Summary by CodeRabbit
Style
Bug Fixes