Skip to content

Commit 09abdc8

Browse files
committed
Fix #291: Dot-source reference detection should ignore ScriptBlocks
1 parent 1b0bf41 commit 09abdc8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PowerShellEditorServices/Language/FindDotSourcedVisitor.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public FindDotSourcedVisitor()
3232
/// or a decision to continue if it wasn't found</returns>
3333
public override AstVisitAction VisitCommand(CommandAst commandAst)
3434
{
35-
if (commandAst.InvocationOperator.Equals(TokenKind.Dot))
35+
if (commandAst.InvocationOperator.Equals(TokenKind.Dot) &&
36+
commandAst.CommandElements[0] is StringConstantExpressionAst)
3637
{
3738
// Strip any quote characters off of the string
3839
string fileName = commandAst.CommandElements[0].Extent.Text.Trim('\'', '"');

0 commit comments

Comments
 (0)