@Override
	public ParameterizedCompletionInsertionInfo getInsertionInfo(
			JTextComponent tc, boolean replaceTabsWithSpaces) {

		ParameterizedCompletionInsertionInfo info =
			new ParameterizedCompletionInsertionInfo();

		StringBuilder sb = new StringBuilder();
		char paramListStart = getProvider().getParameterListStart();
		if (paramListStart!='\0') {
			sb.append(paramListStart);
		}
		int dot = tc.getCaretPosition() + sb.length();
		int paramCount = getParamCount();

		// Get the range in which the caret can move before we hide
		// this tool tip.
		int minPos = dot;
		Position maxPos = null;
		try {
			maxPos = tc.getDocument().createPosition(dot-sb.length()+1);
		} catch (BadLocationException ble) {
			ble.printStackTrace(); // Never happens
		}
		info.setCaretRange(minPos, maxPos);
		int firstParamLen = 0;

		// Create the text to insert (keep it one completion for
		// performance and simplicity of undo/redo).
		int start = dot;
		for (int i=0; i<paramCount; i++) {
			Parameter param = getParam(i);
			String paramText = getParamText(param);
			if (i==0) {
				firstParamLen = paramText.length();
			}
			sb.append(paramText);
			int end = start + paramText.length();
			info.addReplacementLocation(start, end);
			// Patch for param. list separators with length > 2 -
			// thanks to Matthew Adereth!
			String sep = getProvider().getParameterListSeparator();
			if (i<paramCount-1 && sep!=null) {
				sb.append(sep);
				start = end + sep.length();
			}
		}
		sb.append(getProvider().getParameterListEnd());
		int endOffs = dot + sb.length();
		endOffs -= 1;//getProvider().getParameterListStart().length();
		info.addReplacementLocation(endOffs, endOffs); // offset after function
		info.setDefaultEndOffs(endOffs);
		
		int selectionEnd = paramCount>0 ? (dot+firstParamLen) : dot;
		info.setInitialSelection(dot, selectionEnd);
		info.setTextToInsert(sb.toString());
		return info;

	}