Skip to content

Commit

Permalink
fix some reference bug
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Apr 26, 2024
1 parent 7cb0db8 commit 9f34a9b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public void AddCompletion(CompleteContext context)
{
var leftPos = trigger.Position - 1;
var paramToken = context.SemanticModel.Document.SyntaxTree.SyntaxRoot.TokenAt(leftPos);
if (paramToken?.Parent is LuaSyntaxNode node)
if (paramToken?.Parent is { } node)
{
AddPostfixCompletion(context, node);
}
Expand Down
2 changes: 1 addition & 1 deletion LanguageServer/Definition/DefinitionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ protected override DefinitionRegistrationOptions CreateRegistrationOptions(Defin
}
}
var node = document.SyntaxTree.SyntaxRoot.NodeAt(pos.Line, pos.Character);
var node = document.SyntaxTree.SyntaxRoot.NameNodeAt(pos.Line, pos.Character);
var declarationTree = semanticModel.DeclarationTree;
if (node is not null)
{
Expand Down
2 changes: 1 addition & 1 deletion LanguageServer/References/ReferencesHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override ReferenceRegistrationOptions CreateRegistrationOptions(Refere
{
var document = semanticModel.Document;
var pos = request.Position;
var node = document.SyntaxTree.SyntaxRoot.NodeAt(pos.Line, pos.Character);
var node = document.SyntaxTree.SyntaxRoot.NameNodeAt(pos.Line, pos.Character);
if (node is not null)
{
var references = semanticModel.FindReferences(node);
Expand Down
2 changes: 1 addition & 1 deletion LanguageServer/TypeHierarchy/TypeHierarchyHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override TypeHierarchyRegistrationOptions CreateRegistrationOptions(Ty
var semanticModel = context.GetSemanticModel(request.TextDocument.Uri.ToUnencodedString());
if (semanticModel is not null)
{
var node = semanticModel.Document.SyntaxTree.SyntaxRoot.NodeAt(request.Position.Line,
var node = semanticModel.Document.SyntaxTree.SyntaxRoot.NameNodeAt(request.Position.Line,
request.Position.Character);
if (node is not null)
{
Expand Down

0 comments on commit 9f34a9b

Please sign in to comment.