-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat: add Monaco Editor as beta alternative for script editors #7793
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sanish-bruno
wants to merge
6
commits into
usebruno:main
Choose a base branch
from
sanish-bruno:feat/monaco-editor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9a100e7
feat: integrate Monaco Editor for enhanced scripting experience
sanish-bruno 671cec3
feat: enhance Monaco Editor integration with variable autocomplete an…
sanish-bruno 95a3d17
refactor: simplify comments in MonacoEditor and enhance variable tool…
sanish-bruno 2bb3dc3
Review fixes
sanish-bruno da491de
refactor: improve variable tooltip logic in Monaco Editor
sanish-bruno 47d52a5
feat: enhance Monaco Editor integration with new ScriptEditor and glo…
sanish-bruno File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/bruno-app/src/components/MonacoEditor/StyledWrapper.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| const StyledWrapper = styled.div` | ||
| width: 100%; | ||
| height: 100%; | ||
| display: flex; | ||
| flex-direction: column; | ||
|
|
||
| .monaco-editor-container { | ||
| flex: 1 1 0; | ||
| min-height: 0; | ||
| border: solid 1px ${(props) => props.theme.codemirror.border}; | ||
| background: ${(props) => props.theme.codemirror.bg}; | ||
| } | ||
|
|
||
| /* Flush line numbers to the left edge like CodeMirror */ | ||
| .monaco-editor .margin-view-overlays .line-numbers { | ||
| text-align: left !important; | ||
| padding-left: 3px !important; | ||
| } | ||
|
|
||
| /* Bruno variable highlighting decorations */ | ||
| .bruno-variable-valid { | ||
| color: ${(props) => props.theme.codemirror.variable.valid} !important; | ||
| font-weight: 500; | ||
| } | ||
|
|
||
| .bruno-variable-invalid { | ||
| color: ${(props) => props.theme.codemirror.variable.invalid} !important; | ||
| font-weight: 500; | ||
| text-decoration: wavy underline ${(props) => props.theme.codemirror.variable.invalid}; | ||
| text-underline-offset: 3px; | ||
| } | ||
|
|
||
| .bruno-variable-prompt { | ||
| color: ${(props) => props.theme.codemirror.variable.prompt} !important; | ||
| font-weight: 500; | ||
| } | ||
| `; | ||
|
|
||
| export default StyledWrapper; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: usebruno/bruno
Length of output: 469
🏁 Script executed:
Repository: usebruno/bruno
Length of output: 8586
🏁 Script executed:
rg -n "React\.lazy|dynamic.*import|import.*monaco" packages/bruno-app/src/components/MonacoEditor --type js --type jsxRepository: usebruno/bruno
Length of output: 85
Lazy-load Monaco behind the beta flag.
monaco-editoris statically imported inMonacoEditor/index.js(line 3), which means the entire ~2MB minified bundle loads for all users on app startup—even though the feature is opt-in beta only. Currently,ScriptEditorconditionally renders eitherMonacoEditororCodeEditor, but this conditional happens after the static import has already pulled the bundle.Move the
MonacoEditorimport inScriptEditor/index.jsto useReact.lazy(), and defer loading until the beta flag is actually enabled:This prevents non-beta users from incurring the bundle cost on initial load.
🤖 Prompt for AI Agents