New CRMScript editor (again): Monaco

lock
push_pin
done
Answered
44

Hi all,

We have been testing whether it is possible to replace Codemirror as our CRMScript editor with Monaco (the basis of VSCode). We have currently implemented this as a testable feature in our latest build, hoping that some of you will try it out and tell us what is not working :-)

You can enable Monaco as your CRMScript editor by using the "rms.fcgi?action=debug" panel and tick the Monaco-checkbox. The setting is stored as a cookie in your browser and will only affect you in that particular browser, other users will not be affected. This setting is available in build "main_10.3.7_2024.05.23-01".

Sverre

23 May 2024 | 08:04 AM

All Replies (44)

Haven't got this build on SOD yet, but just curious, any particular reason why you are replacing the editor (again)? (better javascript/typescript support for the future? something else?)

23 May 2024 | 08:17 AM
Yes, after testing we have concluded that Monaco is easier to work with for us, and it offers better support for intellisense for both javascript/typescript as well as CRMScript.

Sverre
23 May 2024 | 11:00 AM

I haven't got this build yet either, but this is exciting! I can't wait to try it out. 

23 May 2024 | 09:44 AM

If you guys have some SOD tennant ID's, I can upgrade them.

Sverre

23 May 2024 | 11:00 AM
Cust36938
23 May 2024 | 11:17 AM
Cust11255 please!
23 May 2024 | 11:17 AM
Cust36668
23 May 2024 | 02:01 PM
Cust27129, Thank you!
23 May 2024 | 02:03 PM
Cust32284
24 May 2024 | 11:28 AM

Cust26135 please.

23 May 2024 | 06:19 PM

Hi all,

I have upgraded the abovementioned sites to main_10.3.7_2024.05.24-01 and also changed them from being on Release to being on Main (otherwise they would have gotten upgraded back to Release tonight). Be aware that these sites will now be upgraded more frequently to our latest code. Let us know if you need them back on the Release-branch. This can probably not be done immediately, but next week when we merge from main to release.

Sverre

24 May 2024 | 10:30 AM

Hi Sverre,

I got the new editor now, first impressions are good (related to intellissense, formatting, etc).

Did notice that it is trying to load a ts.worker.js file from the wrong url:

'https://sod.superoffice.com/superoffice/cs/javascript/monaco/ts.worker.js' instead of 'https://sod2.superoffice.com/Cust11255/cs/javascript/monaco/ts.worker.js'

24 May 2024 | 10:40 AM

Thank you Sverre! I tested it out for about five minutes and I like it so far.

Things I like:

  • Intellisense description dialog box is easy to read and well formatted.

 

  • Things like struct properties are immediately visible in Intellisense without having to click Save first. Yay!

 

Things to look at:

  • When hitting enter at the end of a line, it inserts four spaces. I expect it not to insert any spaces or tabs, I can do that myself if needed. 🙂


  • When getting multiple syntax errors after clicking save, they sometimes lie on top of each other, making it cluttered:


  • After first getting one syntax error (likes the ones above), it doesn't help fixing the error and then clicking save. The error tooltips still show up until I click OK.
24 May 2024 | 11:06 AM

To the good people in this thread: 
https://community.superoffice.com/en/technical/forums/api-forums/service-crmscript/from-javascript-to-typescript/ 

//Eivind

7 Jun 2024 | 01:00 PM

Is there a shortcut to get the editor in fullscreen mode ? 

27 Jun 2024 | 11:09 AM
Hello Ummair,

No, there is no fullscreen-mode as of now. I've added it as feedback, though, and we might look into how it could be done.
But I'm not making any promises! :)

Out of curiosity, would you expect pressing 'F11' in the browser to ented fullscreen, or would a button somewhere be sufficient?
13 Aug 2024 | 11:23 AM
In the old editor I'm used to pressing F11, so I think keeping it the "old style" is fine.

I'm also missing a shortcut to indent the code in one line or selecting all the code and pressing shift+tab in the new editor. Is there a shortcut for that ?
23 Aug 2024 | 08:55 AM
Hi,
Pressing F1 when editor has focus will open up all available shortcuts. In next version we are also adding shortcuts to reindent lines. Thanks for providing input!
28 Aug 2024 | 11:19 AM

Cust45357

31 Jul 2024 | 07:10 AM
Hello Rayan,

This should already be available on your tenant.
Go to https://sod2.superoffice.com/{{YOUR_TENANT}}/cs/scripts/rms.fcgi?action=debug and look for the checkbox that says "Use monaco as script editor" :)

13 Aug 2024 | 01:02 PM

Cust38253

21 Aug 2024 | 11:29 AM

This is live in the 10.3.8 release now, so you can test it on SOD/production test tenants that have been upgraded to that version.

23 Aug 2024 | 08:25 AM

It looks like this is not a feature anymore and that its been activated as standard in a tenant we have. 
Is there a way to get the old editor back ? 

I dont like the fact that we cannot use ctrl+shift to auto indent the code. 
The indentation also looks wierd if I just use line shift after defining variables which should have same indentation.

28 Aug 2024 | 10:52 AM
Hi Ummair,
Thank you for pointing this issue out, we are working on making this experience better in next version (10.3.9). We enabled Monaco as default editor to be able to gather more input on experience that perhaps is not covered in our testing. Appreciate your patience with us.
28 Aug 2024 | 11:17 AM

Whats up with the color changing of commented bulk of code in the new editor.

There are several examples
This is one. Here it looks like the last right paranthesis is part of a comment by the color of it. 



When it in reality is not. Taking the code to notepad++

 

It is quite frustrating with these kind of "false" problems, specially in files with alot of code.

29 Aug 2024 | 09:49 AM
Hi Ummair,
Could you please post your whole script ?
29 Aug 2024 | 10:40 AM
Its a big script with alot of sensitive code.
I will try to recreate it with some dummy code later and post it.
29 Aug 2024 | 10:42 AM
%EJSCRIPT_START%

<%
  
    String a; 
    String b;
        
%>


    
%EJSCRIPT_END%
29 Aug 2024 | 01:17 PM
Looks like the editor here is not accepting the pasted code.
Trying this one:


function firstFunction() {

}

/* function secondFunction(){


/* var url = "<%print(getProgramBlogic());%>";
var script = "&action=doScript&includeId=testscript";

$.ajax({
url: url+script,
dataType: "",
type: "GET",
contentType: "application/json; charset=utf-8",
beforeSend: function(jqXHR, settings) {
url = settings.url;
//console.log(url);
},
success: function(data) {

console.log(data);
if(data>0){

}else{
//showError(data);
}
},
error: function(XMLHttpRequest, textStatus, errorThrown) {console.log("error:"+ errorThrown);}
});

}
*/


function thirdFunction() {

}

/* end document ready */



});

29 Aug 2024 | 01:18 PM

Hi,
It looks like you have a block comment start in front of function secondFunction, but no end?

29 Aug 2024 | 01:24 PM
Yeah, I think I wrote that in one of the comments which didnt get posted here.
There was/is no no end for one of the comments. But all the other editors (including notepad++, the editor used in SuperOffice community, and the old editor in Service) shows this mistake differently.
You can try to paste the code in other editors and see for yourself. The code will also run without any error that an "end comment" is missing, or an unexpected syntax error has occured.
30 Aug 2024 | 09:18 AM
Since this is using the mixed-mode feature, where you can jump in and out of CRMScript, what actually is written when out of CRMScript is just treated as text by CS. So it will always work to execute the CRMScript, no matter what is in there.
You could imagine creating a CRMScript which would be called as an API, and the response should be json or XML.
In the above example, it can be that this is executed fine by a browser, because most browsers allows a certain degree of syntactical errors, and do their best to guess the intention of the JavaScript.

My personal meaning, when testing the above script, is that I found the error with one starting comment without an end comment more easily when seeing this in the Monaco editor, compared to for example VS code. In VS code I was mislead at first glance to think that everything was ok.
In Monaco, I pretty fast could spot that there was an error with the commenting.
But this is of course just my personal opinion.
30 Aug 2024 | 10:50 AM
I agree that it should be strict @Stian, and in new scripts it should also be OK.
But imagine going through a script with 4000+ lines and then you encounter some bulks of code with a wrong color because of an unfinished comment, like the example above..
30 Aug 2024 | 11:33 AM

Hi,

The command pallet says the following shortcuts should work for commenting out multiple lines should work, however non of them actually do.

Also, having text selected and selecting one of the commands does not do anything either.

 

I'm using Firefox.

Jari

 

 

29 Aug 2024 | 01:50 PM
We have done some improvements in upcoming release (10.3.9), so please verify again after. But in some scenarios it does not require you to actually select line, just placing cursor should be enough.
30 Aug 2024 | 07:04 AM

Just tried in on SOD, release SuperOffice CRM Online 10.3 Build main_10.3.9_2024.08.30-01. There the commands with a shortcut assigned do work, both with and without selection.

30 Aug 2024 | 07:15 AM
Thanks for verifying this David.
30 Aug 2024 | 07:23 AM

Still a few issues that still exists since switching to the new editors.

  1. Hold Alt and mousekey down and drag over multiple rows and write anything.
    Expected: If you highlighted rows and for example wrote // it would comment out the affected rows.
  2. Might not be because of the new editor (think it came before that), but not being able to copy text from a script unless you edit it is anoying as hell.

Regards
Pär

30 Aug 2024 | 09:30 AM
'Might not be because of the new editor (think it came before that), but not being able to copy text from a script unless you edit it is anoying as hell.'

This is fixed in this new new editor (you can also copy again without the editor specifically being in focus!)
30 Aug 2024 | 09:52 AM

When adding a comment via // and press enter afterwards, the next line will have an indent which I think should be removed

 

I would expect:

4 Sep 2024 | 01:32 PM
We have made alot of improvements in next version 10.3.9, so please retest when this is available.
4 Sep 2024 | 01:57 PM
I tested this in the upcoming release, and it now works as you would expect.
5 Sep 2024 | 06:15 AM

The intellisense suggestions seem a bit too enthusiastic..

If for example I type in the else keyword, i get these suggestions:

So pressing enter after else will auto complete to 'executeSQLQuery'...

Tested on SuperOffice CRM Online 10.3 Build main_10.3.9_2024.09.10-01

10 Sep 2024 | 08:07 AM
Hi David,
We have made some additional improvements when it comes to reserved keywords in coming release (10.3.10). Thank you for pointing this out.
11 Sep 2024 | 11:12 AM

Add reply