private void AddContextualParameter(List <ParameterValue> context, DocRange functionCallRange, int parameter) { // No parameters set, set range for first parameter to callRange. if (parameter == 0 && OrderedParameters.All(p => p?.Value == null)) { OrderedParameters[0].ExpressionRange = functionCallRange; } // If this is the last contextual parameter and the context contains comma, set the expression range so signature help works with the last comma when there is no set expression. else if (LastContextualParameterIndex == parameter && parameter < context.Count && context[parameter].NextComma != null) { // Set the range to be the end of the comma to the start of the call range. OrderedParameters[parameter].ExpressionRange = context[parameter].NextComma.Range.End + functionCallRange.End; } }
private void AddContextualParameter(DeltinScriptParser.Call_parametersContext context, DocRange functionCallRange, int parameter) { // No parameters set, set range for first parameter to callRange. if (parameter == 0 && OrderedParameters.All(p => p?.Value == null)) { OrderedParameters[0].ExpressionRange = functionCallRange; } // If this is the last contextual parameter and the context contains comma, set the expression range so signature help works with the last comma when there is no set expression. else if (LastContextualParameterIndex == parameter && context.COMMA().Length > 0) { // Get the last comma in the context. var lastComma = context.COMMA().Last(); // Set the expression range if the last child in the context is a comma. if (lastComma == context.children.Last()) { // Set the range to be the end of the comma to the start of the call range. OrderedParameters[parameter].ExpressionRange = new DocRange( DocRange.GetRange(lastComma).end, functionCallRange.end ); } } }