(WIP) Changes to improve data.table completion #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is where I've got to so far with the data.table completion behaviour as discussed in #18. There are two significant changes:
The regular expression for checking if the completion is happening inside the brackets of a data.frame (or data.table) is changed, so that completions are offered before the first comma is typed. This behaviour can be switched on and off with the
ncm_r_dt
setting, which is also added. I think it would be best to change this so that the class of the object is automatically detected, and this behaviour only happens when the object is a data.table. I think this should be possible - will work on it next.The other objective was to get function names as completions after the first comma is typed in a data.table command. The only way I've found to do this is to set
refresh = 1
in the call tocomplete()
, so that completions are refreshed as the user types. This is somewhat unsatisfactory since it isn't toggled by thencm_r_dt
setting (though could be I think), and presumably goes against the reason why you originally chose not to enable refreshing. Maybe it negatively impacts performance? I've not noticed a slowdown yet, but have only been working with small files. Let me know if you can think of a better solution to this problem.I've also added some test cases to demonstrate the behaviour I'm trying to get (which should currently all pass).