Skip to content

Commit

Permalink
improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
bryankenote committed Oct 11, 2023
1 parent d54b997 commit 97bd216
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Facility.LanguageServer/FsdDefinitionUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ from field in service.GetDescendants().OfType<ServiceFieldInfo>()
public static IEnumerable<Location> GetReferenceLocationsForMemberAtPosition(this ServiceInfo service, DocumentUri uri, Position requestPosition)
{
var members = service.GetDescendants().OfType<ServiceMemberInfo>().ToList().AsReadOnly();
var memberNameAtPosition = members

// memberNameAtPosition will be null if the cursor is on a field type name.
var memberNameAtCursor = members
.Select(member =>
{
var part = member.GetPart(ServicePartKind.Name);
Expand All @@ -36,7 +38,9 @@ public static IEnumerable<Location> GetReferenceLocationsForMemberAtPosition(thi
.FirstOrDefault();

var fields = service.GetDescendants().OfType<ServiceFieldInfo>().ToList().AsReadOnly();
var fieldTypeNameAtPosition = fields

// fieldTypeNameAtPosition will be null if the cursor is on a member name.
var fieldTypeNameAtCursor = fields
.Select(field =>
{
var part = field.GetPart(ServicePartKind.TypeName);
Expand All @@ -56,7 +60,7 @@ public static IEnumerable<Location> GetReferenceLocationsForMemberAtPosition(thi

return new { part, typeName };
})
.Where(x => x.part != null && (x.typeName == memberNameAtPosition || x.typeName == fieldTypeNameAtPosition))
.Where(x => x.part != null && (x.typeName == memberNameAtCursor|| x.typeName == fieldTypeNameAtCursor))

Check failure on line 63 in src/Facility.LanguageServer/FsdDefinitionUtility.cs

View workflow job for this annotation

GitHub Actions / build (macos-latest)

Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055)
.Select(x => new Location()
{
Uri = uri,
Expand Down

0 comments on commit 97bd216

Please sign in to comment.