mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Add text utils unit tests and parameter comments. (#192)
* Add unit tests for PositionOfCursor * Add unit tests for PositionOfCursor
This commit is contained in:
@@ -11,17 +11,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
|
||||
/// Find the position of the cursor in the SQL script content buffer and return previous new line position
|
||||
/// </summary>
|
||||
/// <param name="sql"></param>
|
||||
/// <param name="startRow"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="prevNewLine"></param>
|
||||
/// <param name="startRow">parameter is 0-based</param>
|
||||
/// <param name="startColumn">parameter is 0-based</param>
|
||||
/// <param name="prevNewLine">parameter is 0-based</param>
|
||||
public static int PositionOfCursor(string sql, int startRow, int startColumn, out int prevNewLine)
|
||||
{
|
||||
{
|
||||
prevNewLine = 0;
|
||||
if (string.IsNullOrWhiteSpace(sql))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < startRow; ++i)
|
||||
{
|
||||
while (prevNewLine < sql.Length && sql[prevNewLine] != '\n')
|
||||
@@ -39,8 +39,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
|
||||
/// SQL Parser may have similar functionality in which case we'll delete this method.
|
||||
/// </summary>
|
||||
/// <param name="sql"></param>
|
||||
/// <param name="startRow"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="startRow">parameter is 0-based</param>
|
||||
/// <param name="startColumn">parameter is 0-based</param>
|
||||
/// <param name="tokenText"></param>
|
||||
public static int PositionOfPrevDelimeter(string sql, int startRow, int startColumn)
|
||||
{
|
||||
@@ -67,8 +67,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
|
||||
/// Find the position of the next delimeter for autocomplete token replacement.
|
||||
/// </summary>
|
||||
/// <param name="sql"></param>
|
||||
/// <param name="startRow"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="startRow">parameter is 0-based</param>
|
||||
/// <param name="startColumn">parameter is 0-based</param>
|
||||
public static int PositionOfNextDelimeter(string sql, int startRow, int startColumn)
|
||||
{
|
||||
int prevNewLine;
|
||||
|
||||
Reference in New Issue
Block a user