|
3 | 3 | // Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
4 | 4 | //
|
5 | 5 |
|
6 |
| -using Microsoft.PowerShell.EditorServices.Utility; |
7 | 6 | using System;
|
8 | 7 | using System.Collections.Generic;
|
9 | 8 | using System.Linq;
|
10 | 9 | using System.Management.Automation;
|
11 | 10 | using System.Threading.Tasks;
|
| 11 | +using Microsoft.PowerShell.EditorServices.Utility; |
12 | 12 |
|
13 | 13 | namespace Microsoft.PowerShell.EditorServices
|
14 | 14 | {
|
@@ -323,8 +323,11 @@ private async Task FetchStackFramesAndVariables()
|
323 | 323 | private async Task FetchGlobalAndScriptVariables()
|
324 | 324 | {
|
325 | 325 | // Retrieve globals first as script variable retrieval needs to search globals.
|
326 |
| - this.globalScopeVariables = await FetchVariableContainer(VariableContainerDetails.GlobalScopeName, null); |
327 |
| - this.scriptScopeVariables = await FetchVariableContainer(VariableContainerDetails.ScriptScopeName, null); |
| 326 | + this.globalScopeVariables = |
| 327 | + await FetchVariableContainer(VariableContainerDetails.GlobalScopeName, null); |
| 328 | + |
| 329 | + this.scriptScopeVariables = |
| 330 | + await FetchVariableContainer(VariableContainerDetails.ScriptScopeName, null); |
328 | 331 | }
|
329 | 332 |
|
330 | 333 | private async Task<VariableContainerDetails> FetchVariableContainer(
|
@@ -392,7 +395,8 @@ private bool AddToAutoVariables(PSVariable psvariable, string scope)
|
392 | 395 | if (((psvariable.Options | constantAllScope) == constantAllScope) ||
|
393 | 396 | ((psvariable.Options | readonlyAllScope) == readonlyAllScope))
|
394 | 397 | {
|
395 |
| - if (this.globalScopeVariables.Children.ContainsKey(VariableDetails.DollarPrefix + psvariable.Name)) |
| 398 | + string prefixedVariableName = VariableDetails.DollarPrefix + psvariable.Name; |
| 399 | + if (this.globalScopeVariables.Children.ContainsKey(prefixedVariableName)) |
396 | 400 | {
|
397 | 401 | return false;
|
398 | 402 | }
|
|
0 commit comments