Skip to content

Commit 9e58049

Browse files
committed
Improve F12 for using declaration in .bicepparam
1 parent eb45f4e commit 9e58049

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/Bicep.LangServer/Handlers/BicepDefinitionHandler.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,17 @@ private LocationOrLocationLinks HandleUnboundSymbolLocation(DefinitionParams req
109109
return HandleModuleReference(context, stringToken, sourceFile, moduleReference);
110110
}
111111
}
112+
{
113+
// Handle using '<module_path>'
114+
if (SyntaxMatcher.IsTailMatch<UsingDeclarationSyntax, StringSyntax, Token>(matchingNodes, (usingDeclaration, usingPath, token) => token.Type == TokenType.StringComplete) &&
115+
matchingNodes[^3] is UsingDeclarationSyntax usingDeclaration &&
116+
matchingNodes[^2] is StringSyntax stringSyntax &&
117+
context.Compilation.SourceFileGrouping.TryGetSourceFile(usingDeclaration).IsSuccess(out var sourceFile) &&
118+
moduleDispatcher.TryGetArtifactReference(context.Compilation.SourceFileGrouping.EntryPoint, usingDeclaration).IsSuccess(out var moduleReference))
119+
{
120+
return HandleModuleReference(context, stringSyntax, sourceFile, moduleReference);
121+
}
122+
}
112123
{ // Definition handler for a non symbol bound to implement import path goto.
113124
// try to resolve import path syntax from given offset using tail matching.
114125
if (SyntaxMatcher.IsTailMatch<CompileTimeImportDeclarationSyntax, CompileTimeImportFromClauseSyntax, StringSyntax, Token>(

0 commit comments

Comments
 (0)