rstudio/rstudio — pull request #232 by kevinushey (2014-11-27 00:00:52+00:00)
Title: Signature tooltip positioning and anchoring

NOTE: Not ready for merge -- this is more a 'proof of concept' of an idea I had re: automatically updating the signature tooltip. @jjallaire, let me know if you think this looks work exploring -- if so, I think it will be the last major autocompletion feature for this initial push.

In this PR, I introduce lazy tracking for the signature tooltip -- as the cursor is moved around, the signature tooltip is updated (if necessary) to represent the function scope the cursor currently lies in. The signature tooltip is placed above the associated function. See:

![sigtip-tracking](https://cloud.githubusercontent.com/assets/1976582/5210594/a7cb5e62-7584-11e4-97fa-fcb229fdaa92.gif)

Implementation summary: we put the logic that finds the current function 'scope' in a timer. We reset and reschedule that timer on every event, so that the event is only actually run if the user pauses for a pre-set amount of time. To find the function scope, we use the tokens to find the opening parenthesis establishing the current 'argument' scope and produce a tooltip from there.

This PR also brings in the anchored selection work in the Cpp completion tooltip, whereby moving the cursor outside of an anchored selection will close the tooltip.