Jump to content

monaco editor folding?


Pryme8
 Share

Recommended Posts

Are we using monaco editor for the playground,  is there a way to enable the ability to collapse sections of code aka folding?

I was messing with https://microsoft.github.io/monaco-editor/playground.html#creating-the-editor-editor-basic-options
and was able to enabled folding for like functions and such, but not on a selection.  

Any sort of folding would be useful in the playground.

If its not monaco then never mind but if it is I may do a pull request to add folding:true to the editors options.

*EDIT*

@Deltakosh I made a pull request to add folding into the editors initializing arguments. 

**EDIT AGIAN** haha  never mind you merged it before I could even post the edit! <3

Link to comment
Share on other sites

Hi guys.  I hope this is up for a vote.  The folding glyphs (+ and -) eat-up 3 character spaces, and are annoying to some.  ;)

https://github.com/Microsoft/monaco-editor/issues/22

This could be the secret to toggle-able folding (if it ever works at all).  The folding glyphs/icons could exist by default (all opened, please), but they are not seen/usable until user selects "dark folding" or "light folding" themes (Each would have the CSS adjusted so that the icons can be seen/used).  Default themes = not seen.

Just some thoughts.  I'd prefer they NOT be active, by default, though, on the public PG app.  Sorry if I'm being a "stick-in-the-mud".  :o

Link to comment
Share on other sites

It helps a whole bunch once your scripts get larger wingnut ^_^ like a whole bunch!  
 Once you finalize a section of your script to be able to hide it and not have to jog past it constantly saves quite a bit of time.

And did you awnser my question Im wondering, 

6 minutes ago, Wingnut said:

but they are not usable until user selects "dark folding" or "light folding" themes (Each would have the CSS adjusted so that the icons can be seen/used).  Default themes = not seen.

is that what is happening right now why the folding argument did nothing?

Link to comment
Share on other sites

14 minutes ago, Pryme8 said:

is that what is happening right now why the folding argument did nothing?

A possibility, I suppose.  I'm not well-studied in Monaco.  I just did a Googus search for Monaco editor folding and then started sniffing-around.  :)

Still, no matter how useful, I wish to allow it to be off by default. 

Something else cool?   https://www.babylonjs-playground.com/#WJPB9#39/fo4o8

fo4o8 = (f)oldAll, (o)pen foldpoint (4), (o)pen foldpoint (8).  Kind of neat for showing the exact code being spoken-of...  for helping another user.

That's a pipe dream, though.  :)  How about /h143h18?  Highlight lines 143 and 18.  :)

Link to comment
Share on other sites

I did a little testing. My IE won't load a playground at all, right now.  Still investigating.

As for the editor's CSS...

A section-of prettified www.babylonjs-playground.com/node_modules/monaco-editor/min/vs/editor/editor.main.css... 
all mentions-of 'fold'...

.monaco-editor .margin-view-overlays .folding {
    margin-left: 5px;
    cursor: pointer;
    background-repeat: no-repeat;
    background-origin: border-box;
    background-position: 3px;
    background-size: 15px;
    opacity: 0;
    transition: opacity .5s
}
.monaco-editor .margin-view-overlays:hover .folding {
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTUgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDE1IDE1OyI+CjxwYXRoIHN0eWxlPSJmaWxsOiNCNkI2QjYiIGQ9Ik0xMSw0djdINFY0SDExIE0xMiwzSDN2OWg5VjNMMTIsM3oiLz4KPGxpbmUgc3R5bGU9ImZpbGw6bm9uZTtzdHJva2U6IzZCNkI2QjtzdHJva2UtbWl0ZXJsaW1pdDoxMCIgeDE9IjEwIiB5MT0iNy41IiB4Mj0iNSIgeTI9IjcuNSIvPgo8L3N2Zz4=");
    opacity: 1
}
.monaco-editor .margin-view-overlays .folding.collapsed {
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTUgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDE1IDE1OyI+CjxyZWN0IHg9IjMiIHk9IjMiIHN0eWxlPSJmaWxsOiNFOEU4RTgiIHdpZHRoPSI5IiBoZWlnaHQ9IjkiLz4KPHBhdGggc3R5bGU9ImZpbGw6I0I2QjZCNiIgZD0iTTExLDR2N0g0VjRIMTEgTTEyLDNIM3Y5aDlWM0wxMiwzeiIvPgo8bGluZSBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojNkI2QjZCO3N0cm9rZS1taXRlcmxpbWl0OjEwIiB4MT0iMTAiIHkxPSI3LjUiIHgyPSI1IiB5Mj0iNy41Ii8+CjxsaW5lIHN0eWxlPSJmaWxsOm5vbmU7c3Ryb2tlOiM2QjZCNkI7c3Ryb2tlLW1pdGVybGltaXQ6MTAiIHgxPSI3LjUiIHkxPSI1IiB4Mj0iNy41IiB5Mj0iMTAiLz4KPC9zdmc+");
    opacity: 1
}
.monaco-editor.hc-black .margin-view-overlays:hover .folding,
.monaco-editor.vs-dark .margin-view-overlays:hover .folding {
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTUgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDE1IDE1OyI+CjxwYXRoIHN0eWxlPSJmaWxsOiM1QTVBNUEiIGQ9Ik0xMSw0djdINFY0SDExIE0xMiwzSDN2OWg5VjNMMTIsM3oiLz4KPGxpbmUgc3R5bGU9ImZpbGw6bm9uZTtzdHJva2U6I0M1QzVDNTtzdHJva2UtbWl0ZXJsaW1pdDoxMCIgeDE9IjEwIiB5MT0iNy41IiB4Mj0iNSIgeTI9IjcuNSIvPgo8L3N2Zz4=")
}
.monaco-editor.hc-black .margin-view-overlays .folding.collapsed,
.monaco-editor.vs-dark .margin-view-overlays .folding.collapsed {
    background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMTUgMTUiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDE1IDE1OyI+CjxyZWN0IHg9IjMiIHk9IjMiIHN0eWxlPSJvcGFjaXR5OjAuMTtmaWxsOiNGRkZGRkYiIHdpZHRoPSI5IiBoZWlnaHQ9IjkiLz4KPHBhdGggc3R5bGU9ImZpbGw6IzVBNUE1QSIgZD0iTTExLDR2N0g0VjRIMTEgTTEyLDNIM3Y5aDlWM0wxMiwzeiIvPgo8bGluZSBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojQzVDNUM1O3N0cm9rZS1taXRlcmxpbWl0OjEwIiB4MT0iMTAiIHkxPSI3LjUiIHgyPSI1IiB5Mj0iNy41Ii8+CjxsaW5lIHN0eWxlPSJmaWxsOm5vbmU7c3Ryb2tlOiNDNUM1QzU7c3Ryb2tlLW1pdGVybGltaXQ6MTAiIHgxPSI3LjUiIHkxPSI1IiB4Mj0iNy41IiB5Mj0iMTAiLz4KPC9zdmc+")
}
.monaco-editor .inline-folded:after {
    color: grey;
    margin: .1em .2em 0;
    content: "?";
    display: inline;
    line-height: 1em;
    cursor: pointer
}

Boy, that was sure a pile of unnecessary pasting, huh?  :)

Looks like she's ready for folding, style-wise, eh?

Link to comment
Share on other sites

*nod*  Good question.

I had my IE in "compatibility mode" for bjs site... caused failed loads.  Now it's working again.  No signs of folding in IE playgrounds.

Oh well.  It's late enough in the day to start drinking heavily, so, let's go to the bar, P8, and dump our purses-upon (share our woes-with) some unsuspecting bartender.  :)

Maybe some pretty little thing will help me re-orient my lockJoint.  ;)  heh  (see TWC - The Wingnut Chronicles)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...