Skip to content

Fix multiple occurrences of the same typo #778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/PowerShellEditorServices/Language/FindReferencesVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ internal class FindReferencesVisitor : AstVisitor
private Dictionary<String, String> AliasToCmdletDictionary;
private string symbolRefCommandName;
private bool needsAliases;

public List<SymbolReference> FoundReferences { get; set; }

/// <summary>
Expand All @@ -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);
Expand All @@ -60,7 +60,7 @@ public FindReferencesVisitor(SymbolReference foundSymbol)

/// <summary>
/// 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
/// </summary>
/// <param name="commandAst">A CommandAst in the script's AST</param>
Expand All @@ -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)
Expand All @@ -85,11 +85,11 @@ public override AstVisitAction VisitCommand(CommandAst commandAst)
AliasToCmdletDictionary.TryGetValue(commandName, out command);
if (alaises == null) { alaises = new List<string>(); }
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()) ||
Expand All @@ -112,20 +112,20 @@ public override AstVisitAction VisitCommand(CommandAst commandAst)
commandNameAst.Extent));
}
}

}
return base.VisitCommand(commandAst);
}

/// <summary>
/// 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
/// </summary>
/// <param name="functionDefinitionAst">A functionDefinitionAst in the script's AST</param>
/// <returns>A visit action that continues the search for references</returns>
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(
Expand All @@ -151,8 +151,8 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
}

/// <summary>
/// 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
/// </summary>
/// <param name="commandParameterAst">A commandParameterAst in the script's AST</param>
/// <returns>A visit action that continues the search for references</returns>
Expand All @@ -169,8 +169,8 @@ public override AstVisitAction VisitCommandParameter(CommandParameterAst command
}

/// <summary>
/// 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
/// </summary>
/// <param name="variableExpressionAst">A variableExpressionAst in the script's AST</param>
/// <returns>A visit action that continues the search for references</returns>
Expand All @@ -186,4 +186,4 @@ public override AstVisitAction VisitVariableExpression(VariableExpressionAst var
return AstVisitAction.Continue;
}
}
}
}
12 changes: 6 additions & 6 deletions src/PowerShellEditorServices/Language/FindSymbolsVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public FindSymbolsVisitor()
}

/// <summary>
/// Adds each function defintion as a
/// Adds each function definition as a
/// </summary>
/// <param name="functionDefinitionAst">A functionDefinitionAst object in the script's AST</param>
/// <returns>A decision to stop searching if the right symbol was found,
/// <returns>A decision to stop searching if the right symbol was found,
/// or a decision to continue if it wasn't found</returns>
public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst functionDefinitionAst)
{
Expand All @@ -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(
Expand All @@ -55,7 +55,7 @@ public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst fun
/// Checks to see if this variable expression is the symbol we are looking for.
/// </summary>
/// <param name="variableExpressionAst">A VariableExpressionAst object in the script's AST</param>
/// <returns>A descion to stop searching if the right symbol was found,
/// <returns>A descion to stop searching if the right symbol was found,
/// or a decision to continue if it wasn't found</returns>
public override AstVisitAction VisitVariableExpression(VariableExpressionAst variableExpressionAst)
{
Expand All @@ -71,7 +71,7 @@ public override AstVisitAction VisitVariableExpression(VariableExpressionAst var

return AstVisitAction.Continue;
}

private bool IsAssignedAtScriptScope(VariableExpressionAst variableExpressionAst)
{
Ast parent = variableExpressionAst.Parent;
Expand Down
10 changes: 5 additions & 5 deletions src/PowerShellEditorServices/Language/FindSymbolsVisitor2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace Microsoft.PowerShell.EditorServices
// PS versions in the new PSES-as-a-module world (issue #276)

///// <summary>
///// 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.
///// </summary>
///// <remarks>
///// Requires PowerShell v5 or higher
///// </remarks>
/////
/////
//internal class FindSymbolsVisitor2 : AstVisitor2
//{
// private FindSymbolsVisitor findSymbolsVisitor;
Expand All @@ -38,10 +38,10 @@ namespace Microsoft.PowerShell.EditorServices
// }

// /// <summary>
// /// Adds each function defintion as a
// /// Adds each function definition as a
// /// </summary>
// /// <param name="functionDefinitionAst">A functionDefinitionAst object in the script's AST</param>
// /// <returns>A decision to stop searching if the right symbol was found,
// /// <returns>A decision to stop searching if the right symbol was found,
// /// or a decision to continue if it wasn't found</returns>
// public override AstVisitAction VisitFunctionDefinition(FunctionDefinitionAst functionDefinitionAst)
// {
Expand All @@ -52,7 +52,7 @@ namespace Microsoft.PowerShell.EditorServices
// /// Checks to see if this variable expression is the symbol we are looking for.
// /// </summary>
// /// <param name="variableExpressionAst">A VariableExpressionAst object in the script's AST</param>
// /// <returns>A descion to stop searching if the right symbol was found,
// /// <returns>A descion to stop searching if the right symbol was found,
// /// or a decision to continue if it wasn't found</returns>
// public override AstVisitAction VisitVariableExpression(VariableExpressionAst variableExpressionAst)
// {
Expand Down
4 changes: 2 additions & 2 deletions src/PowerShellEditorServices/Language/GetDefinitionResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
namespace Microsoft.PowerShell.EditorServices
{
/// <summary>
/// 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
/// </summary>
public class GetDefinitionResult
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ await this.SendRequest(
}

[Fact]
public async Task FindsDefintionOfVariable()
public async Task FindsDefinitionOfVariable()
{
await this.SendOpenFileEvent("TestFiles\\FindReferences.ps1");

Expand Down