"TypeError: identStart is undefined" when using Codemirror with XText

Viewed 37

I'm currently trying to get a CodeMirror editor going with XText 2.25. But since I updated my CodeMirror from 5.51 to 5.59.4 I always get an error that's called when using the autocomplete:

TypeError: identStart is undefined

I was already able to narrow it down to the function "cursorActivity" in "show-hint.js" where CodeMirror tries to set the variable:

var identStart = this.startPos;
if(this.data) {
  identStart = this.data.from;
}

This works well when using the editor without XText, but "from" is never set when I'm using XText so it fails. I'm a bit at loss here what I can do. I tried to find out if I can configure XText to set the variable when the validation is called on the XText server but couldn't find anything. I currently create the editor like this:

self.editor = xtext.createEditor({
          document: shadowRoot,
          xtextLang: self.xtextLang,
          sendFullText: true,
          syntaxDefinition: mode,
          lineNumbers: self.hasLineNumbers,
          showCursorWhenSelecting: true,
          enableValidationService: true,
          textUpdateDelay: self.textUpdateDelay,
          gutters: ["CodeMirror-lint-markers"],
          extraKeys: {"Ctrl-Space": "autocomplete"},
          hintOptions: { 
            container: widget_container
          }
        });
1 Answers

Problem arises because the Xtext-Codemirror bridge misses to set the "from" variable CodeMirror is looking for since version 53. It can be fixed by editing the file xtext-codemirror.js and include the "from" near the "to" variable. But it's more a workaround than a fix.

Related