diff --git a/src/PowerShellEditorServices/Language/FindReferencesVisitor.cs b/src/PowerShellEditorServices/Language/FindReferencesVisitor.cs index e8a3e9e9e..2b7b160ea 100644 --- a/src/PowerShellEditorServices/Language/FindReferencesVisitor.cs +++ b/src/PowerShellEditorServices/Language/FindReferencesVisitor.cs @@ -19,7 +19,7 @@ internal class FindReferencesVisitor : AstVisitor private Dictionary AliasToCmdletDictionary; private string symbolRefCommandName; private bool needsAliases; - + public List FoundReferences { get; set; } /// @@ -39,7 +39,7 @@ public FindReferencesVisitor( this.CmdletToAliasDictionary = CmdletToAliasDictionary; this.AliasToCmdletDictionary = AliasToCmdletDictionary; - // Try to get the symbolReference's command name of an alias, + // Try to get the symbolReference's command name of an alias, // if a command name does not exists (if the symbol isn't an alias to a command) // set symbolRefCommandName to and empty string value AliasToCmdletDictionary.TryGetValue(symbolReference.ScriptRegion.Text, out symbolRefCommandName); @@ -60,7 +60,7 @@ public FindReferencesVisitor(SymbolReference foundSymbol) /// /// Decides if the current command is a reference of the symbol being searched for. - /// A reference of the symbol will be a of type SymbolType.Function + /// A reference of the symbol will be a of type SymbolType.Function /// and have the same name as the symbol /// /// A CommandAst in the script's AST @@ -74,7 +74,7 @@ public override AstVisitAction VisitCommand(CommandAst commandAst) { if (needsAliases) { - // Try to get the commandAst's name and aliases, + // Try to get the commandAst's name and aliases, // if a command does not exists (if the symbol isn't an alias to a command) // set command to and empty string value string command // if the aliases do not exist (if the symvol isn't a command that has aliases) @@ -85,11 +85,11 @@ public override AstVisitAction VisitCommand(CommandAst commandAst) AliasToCmdletDictionary.TryGetValue(commandName, out command); if (alaises == null) { alaises = new List(); } if (command == null) { command = string.Empty; } - + if (symbolRef.SymbolType.Equals(SymbolType.Function)) { // Check if the found symbol's name is the same as the commandAst's name OR - // if the symbol's name is an alias for this commandAst's name (commandAst is a cmdlet) OR + // if the symbol's name is an alias for this commandAst's name (commandAst is a cmdlet) OR // if the symbol's name is the same as the commandAst's cmdlet name (commandAst is a alias) if (commandName.Equals(symbolRef.SymbolName, StringComparison.CurrentCultureIgnoreCase) || alaises.Contains(symbolRef.ScriptRegion.Text.ToLower()) || @@ -112,20 +112,20 @@ public override AstVisitAction VisitCommand(CommandAst commandAst) commandNameAst.Extent)); } } - + } return base.VisitCommand(commandAst); } /// - /// Decides if the current function defintion is a reference of the symbol being searched for. + /// Decides if the current function definition is a reference of the symbol being searched for. /// A reference of the symbol will be a of type SymbolType.Function and have the same name as the symbol /// /// A functionDefinitionAst in the script's AST /// A visit action that continues the search for references public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst functionDefinitionAst) { - // Get the start column number of the function name, + // Get the start column number of the function name, // instead of the the start column of 'function' and create new extent for the functionName int startColumnNumber = functionDefinitionAst.Extent.Text.IndexOf( @@ -151,8 +151,8 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun } /// - /// Decides if the current function defintion is a reference of the symbol being searched for. - /// A reference of the symbol will be a of type SymbolType.Parameter and have the same name as the symbol + /// Decides if the current function definition is a reference of the symbol being searched for. + /// A reference of the symbol will be a of type SymbolType.Parameter and have the same name as the symbol /// /// A commandParameterAst in the script's AST /// A visit action that continues the search for references @@ -169,8 +169,8 @@ public override AstVisitAction VisitCommandParameter(CommandParameterAst command } /// - /// Decides if the current function defintion is a reference of the symbol being searched for. - /// A reference of the symbol will be a of type SymbolType.Variable and have the same name as the symbol + /// Decides if the current function definition is a reference of the symbol being searched for. + /// A reference of the symbol will be a of type SymbolType.Variable and have the same name as the symbol /// /// A variableExpressionAst in the script's AST /// A visit action that continues the search for references @@ -186,4 +186,4 @@ public override AstVisitAction VisitVariableExpression(VariableExpressionAst var return AstVisitAction.Continue; } } -} \ No newline at end of file +} diff --git a/src/PowerShellEditorServices/Language/FindSymbolsVisitor.cs b/src/PowerShellEditorServices/Language/FindSymbolsVisitor.cs index 21852173c..bfb95aa30 100644 --- a/src/PowerShellEditorServices/Language/FindSymbolsVisitor.cs +++ b/src/PowerShellEditorServices/Language/FindSymbolsVisitor.cs @@ -24,10 +24,10 @@ public FindSymbolsVisitor() } /// - /// Adds each function defintion as a + /// Adds each function definition as a /// /// A functionDefinitionAst object in the script's AST - /// A decision to stop searching if the right symbol was found, + /// A decision to stop searching if the right symbol was found, /// or a decision to continue if it wasn't found public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst functionDefinitionAst) { @@ -39,8 +39,8 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun EndColumnNumber = functionDefinitionAst.Extent.EndColumnNumber }; - SymbolType symbolType = - functionDefinitionAst.IsWorkflow ? + SymbolType symbolType = + functionDefinitionAst.IsWorkflow ? SymbolType.Workflow : SymbolType.Function; this.SymbolReferences.Add( @@ -55,7 +55,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun /// Checks to see if this variable expression is the symbol we are looking for. /// /// A VariableExpressionAst object in the script's AST - /// A descion to stop searching if the right symbol was found, + /// A descion to stop searching if the right symbol was found, /// or a decision to continue if it wasn't found public override AstVisitAction VisitVariableExpression(VariableExpressionAst variableExpressionAst) { @@ -71,7 +71,7 @@ public override AstVisitAction VisitVariableExpression(VariableExpressionAst var return AstVisitAction.Continue; } - + private bool IsAssignedAtScriptScope(VariableExpressionAst variableExpressionAst) { Ast parent = variableExpressionAst.Parent; diff --git a/src/PowerShellEditorServices/Language/FindSymbolsVisitor2.cs b/src/PowerShellEditorServices/Language/FindSymbolsVisitor2.cs index 41efffa00..037027436 100644 --- a/src/PowerShellEditorServices/Language/FindSymbolsVisitor2.cs +++ b/src/PowerShellEditorServices/Language/FindSymbolsVisitor2.cs @@ -14,12 +14,12 @@ namespace Microsoft.PowerShell.EditorServices // PS versions in the new PSES-as-a-module world (issue #276) ///// - ///// The visitor used to find all the symbols (function and class defs) in the AST. + ///// The visitor used to find all the symbols (function and class defs) in the AST. ///// ///// ///// Requires PowerShell v5 or higher ///// - ///// + ///// //internal class FindSymbolsVisitor2 : AstVisitor2 //{ // private FindSymbolsVisitor findSymbolsVisitor; @@ -38,10 +38,10 @@ namespace Microsoft.PowerShell.EditorServices // } // /// - // /// Adds each function defintion as a + // /// Adds each function definition as a // /// // /// A functionDefinitionAst object in the script's AST - // /// A decision to stop searching if the right symbol was found, + // /// A decision to stop searching if the right symbol was found, // /// or a decision to continue if it wasn't found // public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst functionDefinitionAst) // { @@ -52,7 +52,7 @@ namespace Microsoft.PowerShell.EditorServices // /// Checks to see if this variable expression is the symbol we are looking for. // /// // /// A VariableExpressionAst object in the script's AST - // /// A descion to stop searching if the right symbol was found, + // /// A descion to stop searching if the right symbol was found, // /// or a decision to continue if it wasn't found // public override AstVisitAction VisitVariableExpression(VariableExpressionAst variableExpressionAst) // { diff --git a/src/PowerShellEditorServices/Language/GetDefinitionResult.cs b/src/PowerShellEditorServices/Language/GetDefinitionResult.cs index 1401fa039..753e027a1 100644 --- a/src/PowerShellEditorServices/Language/GetDefinitionResult.cs +++ b/src/PowerShellEditorServices/Language/GetDefinitionResult.cs @@ -6,8 +6,8 @@ namespace Microsoft.PowerShell.EditorServices { /// - /// A class to contain the found defintion of a symbol. - /// It contains the symbol reference of the defintion + /// A class to contain the found definition of a symbol. + /// It contains the symbol reference of the definition /// public class GetDefinitionResult { diff --git a/test/PowerShellEditorServices.Test.Host/LanguageServerTests.cs b/test/PowerShellEditorServices.Test.Host/LanguageServerTests.cs index 155e28382..27daf6fae 100644 --- a/test/PowerShellEditorServices.Test.Host/LanguageServerTests.cs +++ b/test/PowerShellEditorServices.Test.Host/LanguageServerTests.cs @@ -434,7 +434,7 @@ await this.SendRequest( } [Fact] - public async Task FindsDefintionOfVariable() + public async Task FindsDefinitionOfVariable() { await this.SendOpenFileEvent("TestFiles\\FindReferences.ps1");