Where should I make this setting? ace.config.set('basePath', 'path')

Where should I make this setting? ace.config.set('basePath', 'path')

by moon moodle -
Number of replies: 4

I can't use the ACE editor in CodeRunner, and I received an error message as follows, but I don't know which file I should configure.
tishi

In reply to moon moodle

Re: Where should I make this setting? ace.config.set('basePath', 'path')

by Richard Lobb -
You shouldn't need to configure Ace in this way. It should work out of the box. I've never seen that error before. And lots of sites are running CodeRunner. 

Please provide more information about your install such as:
  1. Version of Moodle
  2. Version of CodeRunner
  3. Past history (have you installed other Moodle's and has Ace ever worked for you?(
  4. Did you make any changes to the CodeRunner code or change the install procedures from normal?
  5. Base OS on which you've installed Moodle.
  6. If you open the Browser development panel, select the network tab and refresh that page, you should then be able to click on Ace.js to see details of its load. Could you paste in a screenshot of what you see, please, like that below.
  7. Do you have any idea why your install might be different from other people's?

Attachment Screenshot from 2025-01-10 13-12-27.png
In reply to Richard Lobb

Re: Where should I make this setting? ace.config.set('basePath', 'path')

by moon moodle -

The version of Moodle is Moodle 4.5.1+, the version of CodeRunner is 5.4.1. No changes have been made to the CodeRunner code, and the base operating system is  ubuntu22.img

In reply to moon moodle

Re: Where should I make this setting? ace.config.set('basePath', 'path')

by Richard Lobb -

Your URL for ace.js appears to be of the form

<something>/javascript.php?rev=nnnnn&jsfile=/question/type/coderunner/ace/ace.js.

This is not the usual way that Moodle manages URLs. The ace.js URL on all servers I've used is of the form

https://<servername>/lib/javascript.php/nnnnnnn/question/type/coderunner/ace/ace.js

Some web searching tells me that Moodle can be configured to disable the more modern style of URL with a line like the following in config.php:

$CFG->slasharguments = false;

I tried adding that to one of my servers, and indeed I then get the error you're seeing. It appears the Ace editor isn't able to deal with that style of URL.

I suggest you check your config.php for that line and comment it out. Alternatively if you really do require the query-parameter style of URL, I'd like to know why. But I'm afraid I can't help you with the required configuration change to the Ace editor in that case - you'll have to figure it out yourself.


In reply to Richard Lobb

Re: Where should I make this setting? ace.config.set('basePath', 'path')

by moon moodle -
Thank you. After I commented out the line $CFG->slasharguments in config.php, the path to ace.js became the same as yours, and the Ace editor is now working properly.