daveho/AceGWT

Support for c, c++, c#, python and others

Closed this issue · 0 comments

Hi there,

I've been using your module and I detected some issues whenever I selected this languages' mode for the editor. The error I get is, for example the c mode:

com.google.gwt.event.shared.UmbrellaException: Exception caught: (TypeError) @edu.ycp.cs.dh.acegwt.client.ace.AceEditor::setModeByName(Ljava/lang/String;)([string: 'c_cpp']): $wnd.require(...) is undefined

After looking some time in the module files, I came to a solution by changing this, in edu.ycp.cs.dh.acegwt.client.ace.AceEditor:

public native void setModeByName(String shortModeName) /-{
var editor = this.@edu.ycp.cs.dh.acegwt.client.ace.AceEditor::editor;
var modeName = "ace/mode/" + shortModeName;
var TheMode = $wnd.require(modeName).Mode;
editor.getSession().setMode(new TheMode());
}-
/;

by:

public native void setModeByName(String shortModeName) /-{
var editor = this.@edu.ycp.cs.dh.acegwt.client.ace.AceEditor::editor;
var modeName = "ace/mode/" + shortModeName;
editor.getSession().setMode(modeName);
}-
/;

This change fixed my issue, but I want to know if this can lead to new issues... Is this a good solution?