I am trying to figure out how I might be able to add autocomplete support to a REPL I am building.
To get started, what I did was convert each snippet executed in the REPL to a file (type = full, text = snippet content), and issued a completions request with a query and the resulting set of files. This worked fine - got the completions I expected.
Next I hoped to be able to call addFile for each snippet as it was executed in the REPL, rather than each time I wanted to get completions. My new completions request only specified the query bit, with a reference to one of the files added via addFile. However this didn't work - got back 0 completions for the same snippets.
So questions ... trying to understand if I am thinking about this right, and what is the right usage of tern to enable the scenario.
- What is the way to use tern in these incremental/REPL scenarios?
- I am assuming I can continue calling addFile with unique file names for each snippet entered, and have these factored in producing the completions list. Is that right?
- What is the right use of addFile and having completions work off of those?
Happy to provide more detail in any part that was unclear.
Thanks
Nikhil