Skip to content

Commit

Permalink
fix: view and monaco glyph interactions with debug and diffviedw (#571)
Browse files Browse the repository at this point in the history
Logic fix for handling monaco glyph mounting.

Originally it will error on diffView/debug mode due to rendering of
unmounted glyphs.
<img width="1094" alt="Screenshot 2024-02-20 at 3 05 05 PM"
src="https://github.com/near/queryapi/assets/42101107/9542852d-6a27-413a-9b56-d90a2abbb1fa">

Video post fix:

https://www.loom.com/share/dd797612590d4f12a27e7216ab009b68?sid=4ec944fd-e718-4851-b231-4339ffab5bd8
  • Loading branch information
Kevin101Zhang authored Feb 21, 2024
1 parent 89e96e6 commit 92d5526
Show file tree
Hide file tree
Showing 2 changed files with 218 additions and 301 deletions.
25 changes: 12 additions & 13 deletions frontend/src/components/Editor/Editor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,24 +370,23 @@ const Editor = ({ actionButtonText }) => {
}

function handleEditorWillMount(editor, monaco) {
const decorations = editor.deltaDecorations([],
[
{
range: new monaco.Range(1, 1, 1, 1),
options: {
isWholeLine: true,
glyphMarginClassName: "glyphSuccess",
glyphMarginHoverMessage: { value: "" },
if (!diffView) {
const decorations = editor.deltaDecorations([],
[
{
range: new monaco.Range(1, 1, 1, 1),
options: {},
},
},
]
);
]
);
monacoEditorRef.current = editor;
setDecorations(decorations);
}
monaco.languages.typescript.typescriptDefaults.addExtraLib(
`${primitives}}`,
"file:///node_modules/@near-lake/primitives/index.d.ts"
);
monacoEditorRef.current = editor;
setDecorations(decorations);

setMonacoMount(true);
}

Expand Down
Loading

0 comments on commit 92d5526

Please sign in to comment.