Complete `load` as with `require` #22

wants to merge 1 commit into


None yet

2 participants

rking commented Nov 3, 2012

Addresses #19.

Next up, I want to make it so it respects ./ so you can do: load './lib/<tab><tab>'

rking commented Nov 18, 2012



Sorry for the delayed response. Having #load autocomplete all local files is intentional and something I use. While I appreciate making #load act like #require, I don't want to it to override autocompleting local files. Before I can pull this in you'll need to address autocompleting './'. An untested, suggested approach:

# move require block into here
def require_files

complete(:method => "Kernel#require") {|e| files_search(e.input, require_files) }

complete(:method=>"Kernel#load") do |e|
  input = e.input
  files_to_autocomplete = input.start_with?('.') ? files(input) : require_files(input)
  files_search(input,  files_to_autocomplete)
rking commented Dec 5, 2012

Yeah definitely. Actually, my plan was to make both require and load complete local files.

We'd also presumably want it to work for the start_with?('/') case.

Also, I'm tempted to throw in require_files() caching. Do you think it'd need to get invalidated during the lifetime of a bond sessoin?


I wasn't planning on caching within completion methods but since there isn't a general purpose caching mechanism yet, I'm ok with it. If you add caching for this completion, I'd expect to see a test for it ;)


Closing as this has been stale for awhile. I can reopen if you want to follow up

@cldwalker cldwalker closed this Jan 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment