mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-30 09:35:38 -05:00
Update Infrastructure (#961)
* Update form .NET Core 2.2 to .NET Core 3.1 - Global variable for projects - Change TFMs from netcoreapp2.2 to netcoreapp3.1 - Update global.json - Update build.json - Remove direct framework cake TestCore task - Update travis dotnet version - Update azure pipline file - Update vscode launch.json * Add Central Package Management * Fix xUnit Breaking Change for MemberData type * Fix xUnit breaking change for duplicate test method name * Fix Rang/Index type conflict with System.Rang/Index * Update vscode tasks.json * Change serviceHostExecutable path in ServiceTestDriver.cs * Downgrade SDK version (https://github.com/appveyor/ci/issues/3440) - Appveyor hasn't installed latest SDK therefore I downgrade it until they install it. * Dump Microsoft.SqlServer.DACFx
This commit is contained in:
@@ -20,6 +20,7 @@ using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using Range = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Range;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Formatter
|
||||
{
|
||||
|
||||
@@ -1,35 +1,36 @@
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Binder;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Intellisense;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Parser;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Main class for Language Service functionality including anything that reqires knowledge of
|
||||
/// the language to perfom, such as definitions, intellisense, etc.
|
||||
/// </summary>
|
||||
public static class AutoCompleteHelper
|
||||
{
|
||||
private static CompletionItem[] emptyCompletionList = new CompletionItem[0];
|
||||
|
||||
public static readonly string[] DefaultCompletionText = new string[]
|
||||
{
|
||||
//
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Binder;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Intellisense;
|
||||
using Microsoft.SqlServer.Management.SqlParser.Parser;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Range = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Range;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Main class for Language Service functionality including anything that reqires knowledge of
|
||||
/// the language to perfom, such as definitions, intellisense, etc.
|
||||
/// </summary>
|
||||
public static class AutoCompleteHelper
|
||||
{
|
||||
private static CompletionItem[] emptyCompletionList = new CompletionItem[0];
|
||||
|
||||
public static readonly string[] DefaultCompletionText = new string[]
|
||||
{
|
||||
"abs",
|
||||
"acos",
|
||||
"action",
|
||||
@@ -469,263 +470,263 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
"xml",
|
||||
"year",
|
||||
"zone",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static instance of an empty completion list to avoid
|
||||
/// unneeded memory allocations
|
||||
/// </summary>
|
||||
internal static CompletionItem[] EmptyCompletionList
|
||||
{
|
||||
get
|
||||
{
|
||||
return AutoCompleteHelper.emptyCompletionList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a given word is in the reserved
|
||||
/// word list or not
|
||||
/// </summary>
|
||||
internal static bool IsReservedWord(string text)
|
||||
{
|
||||
return DefaultCompletionText.Contains(text, StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default completion list from hard-coded list
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
/// <param name="useLowerCase"></param>
|
||||
internal static CompletionItem[] GetDefaultCompletionItems(
|
||||
ScriptDocumentInfo scriptDocumentInfo,
|
||||
bool useLowerCase)
|
||||
{
|
||||
int row = scriptDocumentInfo.StartLine;
|
||||
int startColumn = scriptDocumentInfo.StartColumn;
|
||||
int endColumn = scriptDocumentInfo.EndColumn;
|
||||
string tokenText = scriptDocumentInfo.TokenText;
|
||||
// determine how many default completion items there will be
|
||||
int listSize = DefaultCompletionText.Length;
|
||||
if (!string.IsNullOrWhiteSpace(tokenText))
|
||||
{
|
||||
listSize = 0;
|
||||
foreach (var completionText in DefaultCompletionText)
|
||||
{
|
||||
if (completionText.StartsWith(tokenText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
++listSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// special case empty list to avoid unneed array allocations
|
||||
if (listSize == 0)
|
||||
{
|
||||
return emptyCompletionList;
|
||||
}
|
||||
|
||||
// build the default completion list
|
||||
var completionItems = new CompletionItem[listSize];
|
||||
int completionItemIndex = 0;
|
||||
foreach (var completionText in DefaultCompletionText)
|
||||
{
|
||||
// add item to list if the tokenText is null (meaning return whole list)
|
||||
// or if the completion item begins with the tokenText
|
||||
if (string.IsNullOrWhiteSpace(tokenText) || completionText.StartsWith(tokenText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
completionItems[completionItemIndex] = CreateDefaultCompletionItem(
|
||||
useLowerCase ? completionText.ToLowerInvariant() : completionText.ToUpperInvariant(),
|
||||
row,
|
||||
startColumn,
|
||||
endColumn);
|
||||
++completionItemIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return completionItems;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a completion item from the default item text
|
||||
/// </summary>
|
||||
/// <param name="label"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
private static CompletionItem CreateDefaultCompletionItem(
|
||||
string label,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
return SqlCompletionItem.CreateCompletionItem(label, label + " keyword", label, CompletionItemKind.Keyword, row, startColumn, endColumn);
|
||||
}
|
||||
|
||||
internal static CompletionItem[] AddTokenToItems(CompletionItem[] currentList, Token token, int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
if (currentList != null &&
|
||||
token != null && !string.IsNullOrWhiteSpace(token.Text) &&
|
||||
token.Text.All(ch => char.IsLetter(ch)) &&
|
||||
currentList.All(x => string.Compare(x.Label, token.Text, true) != 0
|
||||
))
|
||||
{
|
||||
var list = currentList.ToList();
|
||||
list.Insert(0, SqlCompletionItem.CreateCompletionItem(token.Text, token.Text, token.Text, CompletionItemKind.Text, row, startColumn, endColumn));
|
||||
return list.ToArray();
|
||||
}
|
||||
return currentList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of Declaration objects to CompletionItem objects
|
||||
/// since VS Code expects CompletionItems but SQL Parser works with Declarations
|
||||
/// </summary>
|
||||
/// <param name="suggestions"></param>
|
||||
/// <param name="cursorRow"></param>
|
||||
/// <param name="cursorColumn"></param>
|
||||
/// <returns></returns>
|
||||
internal static CompletionItem[] ConvertDeclarationsToCompletionItems(
|
||||
IEnumerable<Declaration> suggestions,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn,
|
||||
string tokenText = null)
|
||||
{
|
||||
List<CompletionItem> completions = new List<CompletionItem>();
|
||||
|
||||
foreach (var autoCompleteItem in suggestions)
|
||||
{
|
||||
SqlCompletionItem sqlCompletionItem = new SqlCompletionItem(autoCompleteItem, tokenText);
|
||||
|
||||
// convert the completion item candidates into CompletionItems
|
||||
completions.Add(sqlCompletionItem.CreateCompletionItem(row, startColumn, endColumn));
|
||||
}
|
||||
|
||||
return completions.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a SQL Parser QuickInfo object into a VS Code Hover object
|
||||
/// </summary>
|
||||
/// <param name="quickInfo"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
internal static Hover ConvertQuickInfoToHover(
|
||||
Babel.CodeObjectQuickInfo quickInfo,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
// convert from the parser format to the VS Code wire format
|
||||
var markedStrings = new MarkedString[1];
|
||||
if (quickInfo != null)
|
||||
{
|
||||
markedStrings[0] = new MarkedString()
|
||||
{
|
||||
Language = "SQL",
|
||||
Value = quickInfo.Text
|
||||
};
|
||||
|
||||
return new Hover()
|
||||
{
|
||||
Contents = markedStrings,
|
||||
Range = new Range
|
||||
{
|
||||
Start = new Position
|
||||
{
|
||||
Line = row,
|
||||
Character = startColumn
|
||||
},
|
||||
End = new Position
|
||||
{
|
||||
Line = row,
|
||||
Character = endColumn
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a SQL Parser List of MethodHelpText objects into a VS Code SignatureHelp object
|
||||
/// </summary>
|
||||
internal static SignatureHelp ConvertMethodHelpTextListToSignatureHelp(List<Babel.MethodHelpText> methods, Babel.MethodNameAndParamLocations locations, int line, int column)
|
||||
{
|
||||
Validate.IsNotNull(nameof(methods), methods);
|
||||
Validate.IsNotNull(nameof(locations), locations);
|
||||
Validate.IsGreaterThan(nameof(line), line, 0);
|
||||
Validate.IsGreaterThan(nameof(column), column, 0);
|
||||
|
||||
SignatureHelp help = new SignatureHelp();
|
||||
|
||||
help.Signatures = methods.Select(method =>
|
||||
{
|
||||
return new SignatureInformation()
|
||||
{
|
||||
// Signature label format: <name> param1, param2, ..., paramn RETURNS <type>
|
||||
Label = method.Name + " " + method.Parameters.Select(parameter => parameter.Display).Aggregate((l, r) => l + "," + r) + " " + method.Type,
|
||||
Documentation = method.Description,
|
||||
Parameters = method.Parameters.Select(parameter =>
|
||||
{
|
||||
return new ParameterInformation()
|
||||
{
|
||||
Label = parameter.Display,
|
||||
Documentation = parameter.Description
|
||||
};
|
||||
}).ToArray()
|
||||
};
|
||||
}).Where(method => method.Label.Contains(locations.Name)).ToArray();
|
||||
|
||||
if (help.Signatures.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the matching method signature at the cursor's location
|
||||
// For now, take the first match (since we've already filtered by name above)
|
||||
help.ActiveSignature = 0;
|
||||
|
||||
// Determine the current parameter at the cursor
|
||||
int currentParameter = -1; // Default case: not on any particular parameter
|
||||
if (locations.ParamStartLocation != null)
|
||||
{
|
||||
// Is the cursor past the function name?
|
||||
var location = locations.ParamStartLocation.Value;
|
||||
if (line > location.LineNumber || (line == location.LineNumber && line == location.LineNumber && column >= location.ColumnNumber))
|
||||
{
|
||||
currentParameter = 0;
|
||||
}
|
||||
}
|
||||
foreach (var location in locations.ParamSeperatorLocations)
|
||||
{
|
||||
// Is the cursor past a comma ',' and at least on the next parameter?
|
||||
if (line > location.LineNumber || (line == location.LineNumber && column > location.ColumnNumber))
|
||||
{
|
||||
currentParameter++;
|
||||
}
|
||||
}
|
||||
if (locations.ParamEndLocation != null)
|
||||
{
|
||||
// Is the cursor past the end of the parameter list on a different token?
|
||||
var location = locations.ParamEndLocation.Value;
|
||||
if (line > location.LineNumber || (line == location.LineNumber && line == location.LineNumber && column > location.ColumnNumber))
|
||||
{
|
||||
currentParameter = -1;
|
||||
}
|
||||
}
|
||||
help.ActiveParameter = currentParameter;
|
||||
|
||||
return help;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Gets a static instance of an empty completion list to avoid
|
||||
/// unneeded memory allocations
|
||||
/// </summary>
|
||||
internal static CompletionItem[] EmptyCompletionList
|
||||
{
|
||||
get
|
||||
{
|
||||
return AutoCompleteHelper.emptyCompletionList;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether a given word is in the reserved
|
||||
/// word list or not
|
||||
/// </summary>
|
||||
internal static bool IsReservedWord(string text)
|
||||
{
|
||||
return DefaultCompletionText.Contains(text, StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default completion list from hard-coded list
|
||||
/// </summary>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
/// <param name="useLowerCase"></param>
|
||||
internal static CompletionItem[] GetDefaultCompletionItems(
|
||||
ScriptDocumentInfo scriptDocumentInfo,
|
||||
bool useLowerCase)
|
||||
{
|
||||
int row = scriptDocumentInfo.StartLine;
|
||||
int startColumn = scriptDocumentInfo.StartColumn;
|
||||
int endColumn = scriptDocumentInfo.EndColumn;
|
||||
string tokenText = scriptDocumentInfo.TokenText;
|
||||
// determine how many default completion items there will be
|
||||
int listSize = DefaultCompletionText.Length;
|
||||
if (!string.IsNullOrWhiteSpace(tokenText))
|
||||
{
|
||||
listSize = 0;
|
||||
foreach (var completionText in DefaultCompletionText)
|
||||
{
|
||||
if (completionText.StartsWith(tokenText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
++listSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// special case empty list to avoid unneed array allocations
|
||||
if (listSize == 0)
|
||||
{
|
||||
return emptyCompletionList;
|
||||
}
|
||||
|
||||
// build the default completion list
|
||||
var completionItems = new CompletionItem[listSize];
|
||||
int completionItemIndex = 0;
|
||||
foreach (var completionText in DefaultCompletionText)
|
||||
{
|
||||
// add item to list if the tokenText is null (meaning return whole list)
|
||||
// or if the completion item begins with the tokenText
|
||||
if (string.IsNullOrWhiteSpace(tokenText) || completionText.StartsWith(tokenText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
completionItems[completionItemIndex] = CreateDefaultCompletionItem(
|
||||
useLowerCase ? completionText.ToLowerInvariant() : completionText.ToUpperInvariant(),
|
||||
row,
|
||||
startColumn,
|
||||
endColumn);
|
||||
++completionItemIndex;
|
||||
}
|
||||
}
|
||||
|
||||
return completionItems;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a completion item from the default item text
|
||||
/// </summary>
|
||||
/// <param name="label"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
private static CompletionItem CreateDefaultCompletionItem(
|
||||
string label,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
return SqlCompletionItem.CreateCompletionItem(label, label + " keyword", label, CompletionItemKind.Keyword, row, startColumn, endColumn);
|
||||
}
|
||||
|
||||
internal static CompletionItem[] AddTokenToItems(CompletionItem[] currentList, Token token, int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
if (currentList != null &&
|
||||
token != null && !string.IsNullOrWhiteSpace(token.Text) &&
|
||||
token.Text.All(ch => char.IsLetter(ch)) &&
|
||||
currentList.All(x => string.Compare(x.Label, token.Text, true) != 0
|
||||
))
|
||||
{
|
||||
var list = currentList.ToList();
|
||||
list.Insert(0, SqlCompletionItem.CreateCompletionItem(token.Text, token.Text, token.Text, CompletionItemKind.Text, row, startColumn, endColumn));
|
||||
return list.ToArray();
|
||||
}
|
||||
return currentList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a list of Declaration objects to CompletionItem objects
|
||||
/// since VS Code expects CompletionItems but SQL Parser works with Declarations
|
||||
/// </summary>
|
||||
/// <param name="suggestions"></param>
|
||||
/// <param name="cursorRow"></param>
|
||||
/// <param name="cursorColumn"></param>
|
||||
/// <returns></returns>
|
||||
internal static CompletionItem[] ConvertDeclarationsToCompletionItems(
|
||||
IEnumerable<Declaration> suggestions,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn,
|
||||
string tokenText = null)
|
||||
{
|
||||
List<CompletionItem> completions = new List<CompletionItem>();
|
||||
|
||||
foreach (var autoCompleteItem in suggestions)
|
||||
{
|
||||
SqlCompletionItem sqlCompletionItem = new SqlCompletionItem(autoCompleteItem, tokenText);
|
||||
|
||||
// convert the completion item candidates into CompletionItems
|
||||
completions.Add(sqlCompletionItem.CreateCompletionItem(row, startColumn, endColumn));
|
||||
}
|
||||
|
||||
return completions.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a SQL Parser QuickInfo object into a VS Code Hover object
|
||||
/// </summary>
|
||||
/// <param name="quickInfo"></param>
|
||||
/// <param name="row"></param>
|
||||
/// <param name="startColumn"></param>
|
||||
/// <param name="endColumn"></param>
|
||||
internal static Hover ConvertQuickInfoToHover(
|
||||
Babel.CodeObjectQuickInfo quickInfo,
|
||||
int row,
|
||||
int startColumn,
|
||||
int endColumn)
|
||||
{
|
||||
// convert from the parser format to the VS Code wire format
|
||||
var markedStrings = new MarkedString[1];
|
||||
if (quickInfo != null)
|
||||
{
|
||||
markedStrings[0] = new MarkedString()
|
||||
{
|
||||
Language = "SQL",
|
||||
Value = quickInfo.Text
|
||||
};
|
||||
|
||||
return new Hover()
|
||||
{
|
||||
Contents = markedStrings,
|
||||
Range = new Range
|
||||
{
|
||||
Start = new Position
|
||||
{
|
||||
Line = row,
|
||||
Character = startColumn
|
||||
},
|
||||
End = new Position
|
||||
{
|
||||
Line = row,
|
||||
Character = endColumn
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a SQL Parser List of MethodHelpText objects into a VS Code SignatureHelp object
|
||||
/// </summary>
|
||||
internal static SignatureHelp ConvertMethodHelpTextListToSignatureHelp(List<Babel.MethodHelpText> methods, Babel.MethodNameAndParamLocations locations, int line, int column)
|
||||
{
|
||||
Validate.IsNotNull(nameof(methods), methods);
|
||||
Validate.IsNotNull(nameof(locations), locations);
|
||||
Validate.IsGreaterThan(nameof(line), line, 0);
|
||||
Validate.IsGreaterThan(nameof(column), column, 0);
|
||||
|
||||
SignatureHelp help = new SignatureHelp();
|
||||
|
||||
help.Signatures = methods.Select(method =>
|
||||
{
|
||||
return new SignatureInformation()
|
||||
{
|
||||
// Signature label format: <name> param1, param2, ..., paramn RETURNS <type>
|
||||
Label = method.Name + " " + method.Parameters.Select(parameter => parameter.Display).Aggregate((l, r) => l + "," + r) + " " + method.Type,
|
||||
Documentation = method.Description,
|
||||
Parameters = method.Parameters.Select(parameter =>
|
||||
{
|
||||
return new ParameterInformation()
|
||||
{
|
||||
Label = parameter.Display,
|
||||
Documentation = parameter.Description
|
||||
};
|
||||
}).ToArray()
|
||||
};
|
||||
}).Where(method => method.Label.Contains(locations.Name)).ToArray();
|
||||
|
||||
if (help.Signatures.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the matching method signature at the cursor's location
|
||||
// For now, take the first match (since we've already filtered by name above)
|
||||
help.ActiveSignature = 0;
|
||||
|
||||
// Determine the current parameter at the cursor
|
||||
int currentParameter = -1; // Default case: not on any particular parameter
|
||||
if (locations.ParamStartLocation != null)
|
||||
{
|
||||
// Is the cursor past the function name?
|
||||
var location = locations.ParamStartLocation.Value;
|
||||
if (line > location.LineNumber || (line == location.LineNumber && line == location.LineNumber && column >= location.ColumnNumber))
|
||||
{
|
||||
currentParameter = 0;
|
||||
}
|
||||
}
|
||||
foreach (var location in locations.ParamSeperatorLocations)
|
||||
{
|
||||
// Is the cursor past a comma ',' and at least on the next parameter?
|
||||
if (line > location.LineNumber || (line == location.LineNumber && column > location.ColumnNumber))
|
||||
{
|
||||
currentParameter++;
|
||||
}
|
||||
}
|
||||
if (locations.ParamEndLocation != null)
|
||||
{
|
||||
// Is the cursor past the end of the parameter list on a different token?
|
||||
var location = locations.ParamEndLocation.Value;
|
||||
if (line > location.LineNumber || (line == location.LineNumber && line == location.LineNumber && column > location.ColumnNumber))
|
||||
{
|
||||
currentParameter = -1;
|
||||
}
|
||||
}
|
||||
help.ActiveParameter = currentParameter;
|
||||
|
||||
return help;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using Range = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Range;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
|
||||
@@ -1,45 +1,49 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>MicrosoftSqlToolsServiceLayer</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<EnableDefaultItems>false</EnableDefaultItems>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
|
||||
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<DefineConstants>$(DefineConstants);NETCOREAPP1_0;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<DebugType>portable</DebugType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;osx.10.11-x64;linux-x64;win10-arm;win10-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<TargetFramework>$(ServiceLayerTargetFramework)</TargetFramework>
|
||||
<AssemblyName>MicrosoftSqlToolsServiceLayer</AssemblyName>
|
||||
<OutputType>Exe</OutputType>
|
||||
<EnableDefaultItems>false</EnableDefaultItems>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
|
||||
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
|
||||
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<DefineConstants>$(DefineConstants);NETCOREAPP1_0;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<PreserveCompilationContext>true</PreserveCompilationContext>
|
||||
<DebugType>portable</DebugType>
|
||||
<RuntimeIdentifiers>win7-x64;win7-x86;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64;osx.10.11-x64;linux-x64;win10-arm;win10-arm64</RuntimeIdentifiers>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.0.0" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.6.0-preview3-26501-04" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(PkgMicrosoft_SqlServer_DacFx)\lib\netstandard2.0\Microsoft.Data.Tools.Schema.SqlTasks.targets">
|
||||
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="ObjectExplorer\SmoModel\TreeNodeDefinition.xml" />
|
||||
<EmbeddedResource Include="Localization\sr.resx" />
|
||||
<None Include="Localization\sr.strings" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include=".\Agent\NotebookResources\NotebookJobScript.ps1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.SqlServer.DACFx" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs" Exclude="**/obj/**/*.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Hosting/Microsoft.SqlTools.Hosting.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.Credentials/Microsoft.SqlTools.Credentials.csproj" />
|
||||
<ProjectReference Include="../Microsoft.SqlTools.ManagedBatchParser/Microsoft.SqlTools.ManagedBatchParser.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(PkgMicrosoft_SqlServer_DacFx)\lib\netstandard2.0\Microsoft.Data.Tools.Schema.SqlTasks.targets">
|
||||
<CopyToPublishDirectory>Always</CopyToPublishDirectory>
|
||||
</Content>
|
||||
<EmbeddedResource Include="ObjectExplorer\SmoModel\TreeNodeDefinition.xml" />
|
||||
<EmbeddedResource Include="Localization\sr.resx" />
|
||||
<None Include="Localization\sr.strings" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include=".\Agent\NotebookResources\NotebookJobScript.ps1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||
using Index = Microsoft.SqlServer.Management.Smo.Index;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Composition;
|
||||
using System.Linq;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Broker;
|
||||
using Index = Microsoft.SqlServer.Management.Smo.Index;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ using System.Composition;
|
||||
using System.Linq;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlServer.Management.Smo.Broker;
|
||||
using Index = Microsoft.SqlServer.Management.Smo.Index;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
||||
{
|
||||
|
||||
@@ -26,6 +26,7 @@ using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using Range = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Range;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Hosting;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using Range = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Range;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Workspace
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user