securingsincity / react-ace

React Ace Component
http://securingsincity.github.io/react-ace/
MIT License
4.05k stars 604 forks source link

Missing spaces in auto-complete #1871

Open catalina-mo opened 5 months ago

catalina-mo commented 5 months ago

Hello,

I am using the editor's auto-complete functionality like this:

    let wordList = [{
      "word": "when phoneA is online",
      "freq": 24,
      "score": 300,
    },
      {
        "word": "when phoneB is online",
        "freq": 24,
        "score": 300,
      }
    ];
    var stepCompleter = {
      getCompletions: (editor, session, pos, prefix, callback) => {
        if (prefix.length === 0) {
          callback(null, []);
          return
        }
        callback(null, wordList.map(function(ea) {
          return {
            name: ea.word,
            value: ea.word,
            score: ea.score,
          };
        }))
      }
    }
    const langTools = acequire("ace/ext/language_tools");
    langTools.setCompleters([stepCompleter]);

And the auto completer works, but after typing "when phoneA" in the editor, the auto complete popup is missing a space between "phoneA" and "is", as in the image below:

Screenshot from 2024-04-09 11-55-08

Any ideas how I can troubleshoot this?

Thanks!