Copyleft Games

Editor automatic highlight mode

Currently our web-based editor uses javascript highlighting only. While ACE https://ace.c9.io/ supports highlighting for many languages, we need to way to set which language should be used for a specific file.

Write a javascript function which extracts the file extension (the letters and numbers following the final "." of a filename) and looks up the right language mode to use based on this, then set it for a given tab.

While the save button is not working yet, attach this function for when the save button is selected by prompting the user for a filename (and clearly stating that saving is not yet supported and is being worked on). Then the current tab should change highlight mode.

Submit your .js file and modified along with the necessary changes to templates/editor.xslt (see https://hg.copyleftgames.org/gci/file/tip/templates/editor.xslt ).

Task tags

  • javascript
  • ace

Students who completed this task

timtim17

Task type

  • code Code
  • assessment Outreach / Research
close

2015