mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-13 19:48:34 -05:00
@@ -743,8 +743,12 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
Logger.Write(TraceEventType.Verbose, "HandleRebuildIntelliSenseNotification");
|
||||
|
||||
// This URI doesn't come in escaped - so if it's a file path with reserved characters (such as %)
|
||||
// then we'll fail to find it since GetFile expects the URI to be a fully-escaped URI as that's
|
||||
// what the document events are sent in as.
|
||||
var escapedOwnerUri = Uri.EscapeUriString(rebuildParams.OwnerUri);
|
||||
// Skip closing this file if the file doesn't exist
|
||||
var scriptFile = this.CurrentWorkspace.GetFile(rebuildParams.OwnerUri);
|
||||
var scriptFile = this.CurrentWorkspace.GetFile(escapedOwnerUri);
|
||||
if (scriptFile == null)
|
||||
{
|
||||
return;
|
||||
@@ -1078,7 +1082,11 @@ namespace Microsoft.SqlTools.ServiceLayer.LanguageServices
|
||||
{
|
||||
if (scriptInfo.IsConnected)
|
||||
{
|
||||
var scriptFile = CurrentWorkspace.GetFile(info.OwnerUri);
|
||||
// This URI doesn't come in escaped - so if it's a file path with reserved characters (such as %)
|
||||
// then we'll fail to find it since GetFile expects the URI to be a fully-escaped URI as that's
|
||||
// what the document events are sent in as.
|
||||
var fileUri = Uri.EscapeUriString(info.OwnerUri);
|
||||
var scriptFile = CurrentWorkspace.GetFile(fileUri);
|
||||
if (scriptFile == null)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -101,7 +101,11 @@ namespace Microsoft.SqlTools.ServiceLayer.NotebookConvert
|
||||
|
||||
try
|
||||
{
|
||||
var file = WorkspaceService<SqlToolsSettings>.Instance.Workspace.GetFile(parameters.ClientUri);
|
||||
// This URI doesn't come in escaped - so if it's a file path with reserved characters (such as %)
|
||||
// then we'll fail to find it since GetFile expects the URI to be a fully-escaped URI as that's
|
||||
// what the document events are sent in as.
|
||||
var escapedClientUri = Uri.EscapeUriString(parameters.ClientUri);
|
||||
var file = WorkspaceService<SqlToolsSettings>.Instance.Workspace.GetFile(escapedClientUri);
|
||||
// Temporary notebook that we just fill in with the sql until the parsing logic is added
|
||||
var result = new ConvertSqlToNotebookResult
|
||||
{
|
||||
|
||||
@@ -930,18 +930,22 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
// Internal for testing purposes
|
||||
internal string GetSqlText(ExecuteRequestParamsBase request)
|
||||
{
|
||||
// This URI doesn't come in escaped - so if it's a file path with reserved characters (such as %)
|
||||
// then we'll fail to find it since GetFile expects the URI to be a fully-escaped URI as that's
|
||||
// what the document events are sent in as.
|
||||
var escapedOwnerUri = Uri.EscapeUriString(request.OwnerUri);
|
||||
// If it is a document selection, we'll retrieve the text from the document
|
||||
ExecuteDocumentSelectionParams docRequest = request as ExecuteDocumentSelectionParams;
|
||||
if (docRequest != null)
|
||||
{
|
||||
return GetSqlTextFromSelectionData(docRequest.OwnerUri, docRequest.QuerySelection);
|
||||
return GetSqlTextFromSelectionData(escapedOwnerUri, docRequest.QuerySelection);
|
||||
}
|
||||
|
||||
// If it is a document statement, we'll retrieve the text from the document
|
||||
ExecuteDocumentStatementParams stmtRequest = request as ExecuteDocumentStatementParams;
|
||||
if (stmtRequest != null)
|
||||
{
|
||||
return GetSqlStatementAtPosition(stmtRequest.OwnerUri, stmtRequest.Line, stmtRequest.Column);
|
||||
return GetSqlStatementAtPosition(escapedOwnerUri, stmtRequest.Line, stmtRequest.Column);
|
||||
}
|
||||
|
||||
// If it is an ExecuteStringParams, return the text as is
|
||||
@@ -964,6 +968,7 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||
ScriptFile queryFile = WorkspaceService.Workspace.GetFile(ownerUri);
|
||||
if (queryFile == null)
|
||||
{
|
||||
Logger.Write(TraceEventType.Warning, $"[GetSqlTextFromSelectionData] Unable to find document with OwnerUri {ownerUri}");
|
||||
return string.Empty;
|
||||
}
|
||||
// If a selection was not provided, use the entire document
|
||||
|
||||
Reference in New Issue
Block a user