bundles/org.eclipse.orion.client.editor/web/orion/editor/contentAssist.js
function(proposal) {
			if (!proposal) {
				return false;
			}
	
			// now handle prefixes
			// if there is a non-empty selection, then replace it,
			// if overwrite is truthy, then also replace the prefix
			var view = this.textView;
			var sel = view.getSelection();
			var start = this._initialCaretOffset;
			var mapStart = start;
			var end = Math.max(sel.start, sel.end), mapEnd = end;
			var model = view.getModel();
			if (model.getBaseModel) {
				mapStart = model.mapOffset(mapStart);
				mapEnd = model.mapOffset(mapEnd);
				model = model.getBaseModel();
			}
			
			if (proposal.overwrite) {
			    if(typeof proposal.prefix === 'string') {
			        start = mapStart-proposal.prefix.length;
			    } else {
				    start = this.getPrefixStart(model, mapStart);
				}
			}

			var data = {
				proposal: proposal,
				start: mapStart,
				end: mapEnd
			};
			this.setState(State.INACTIVE);
			var proposalText = typeof proposal === "string" ? proposal : proposal.proposal;
			view.setText(proposalText, start, end);
			if (proposal.additionalEdits) {
				var edit;
				for (var i = 0; i < proposal.additionalEdits.length; i++) {
					edit = proposal.additionalEdits[i];
					view.setText(edit.text, edit.offset, edit.offset + edit.length);
				}
			}
			this.dispatchEvent({type: "ProposalApplied", data: data}); //$NON-NLS-0$
			mMetrics.logEvent("contentAssist", "apply"); //$NON-NLS-1$ //$NON-NLS-0$
			return true;
		}
function(proposal) {
			if (!proposal) {
				return false;
			}
	
			// now handle prefixes
			// if there is a non-empty selection, then replace it,
			// if overwrite is truthy, then also replace the prefix
			var view = this.textView;
			var sel = view.getSelection();
			var start = this._initialCaretOffset;
			var mapStart = start;
			var end = Math.max(sel.start, sel.end), mapEnd = end;
			var model = view.getModel();
			if (model.getBaseModel) {
				mapStart = model.mapOffset(mapStart);
				mapEnd = model.mapOffset(mapEnd);
				model = model.getBaseModel();
			}
			
			if (proposal.overwrite) {
			    if(typeof proposal.prefix === 'string') {
			        start = mapStart-proposal.prefix.length;
			    } else {
				    start = this.getPrefixStart(model, mapStart);
				}
			}

			var data = {
				proposal: proposal,
				start: mapStart,
				end: mapEnd
			};
			this.setState(State.INACTIVE);
			var proposalText = typeof proposal === "string" ? proposal : proposal.proposal;
			view.setText(proposalText, start, end);
			if (proposal.additionalEdits) {
				var edit;
				for (var i = 0; i < proposal.additionalEdits.length; i++) {
					edit = proposal.additionalEdits[i];
					view.setText(edit.text, edit.offset, edit.offset + edit.length);
				}
			}
			this.dispatchEvent({type: "ProposalApplied", data: data}); //$NON-NLS-0$
			mMetrics.logEvent("contentAssist", "apply"); //$NON-NLS-1$ //$NON-NLS-0$
			return true;
		}
function ( proposal ) { if ( ! proposal ) { return false ; } // now handle prefixes
 // if there is a non-empty selection, then replace it,
 // if overwrite is truthy, then also replace the prefix
 var view = this . textView ; var sel = view . getSelection ( ) ; var start = this . _initialCaretOffset ; var mapStart = start ; var end = Math . max ( sel . start , sel . end ) , mapEnd = end ; var model = view . getModel ( ) ; if ( model . getBaseModel ) { mapStart = model . mapOffset ( mapStart ) ; mapEnd = model . mapOffset ( mapEnd ) ; model = model . getBaseModel ( ) ; } if ( proposal . overwrite ) { if ( typeof proposal . prefix === 'string' ) { start = mapStart - proposal . prefix . length ; } else { start = this . getPrefixStart ( model , mapStart ) ; } } var data = { proposal : proposal , start : mapStart , end : mapEnd } ; this . setState ( State . INACTIVE ) ; var proposalText = typeof proposal === "string" ? proposal : proposal . proposal ; view . setText ( proposalText , start , end ) ; if ( proposal . additionalEdits ) { var edit ; for ( var i = 0 ; i < proposal . additionalEdits . length ; i ++ ) { edit = proposal . additionalEdits [ i ] ; view . setText ( edit . text , edit . offset , edit . offset + edit . length ) ; } } this . dispatchEvent ( { type : "ProposalApplied" , data : data } ) ; //$NON-NLS-0$
 mMetrics . logEvent ( "contentAssist" , "apply" ) ; //$NON-NLS-1$ //$NON-NLS-0$
 return true ; }
Applies the given proposal to the TextView.
@param {Object} [proposal]
@returns {Boolean} <code>true</code> if the proposal was applied; <code>false</code> if no proposal was provided.
Applies the given proposal to the TextView .