Skip to content

Commit

Permalink
add error interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
bryankenote committed Dec 1, 2023
1 parent eb02e6c commit 0b9e236
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/Facility.LanguageServer/FsdDocumentSymbolHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ public async Task<SymbolInformationOrDocumentSymbolContainer> Handle(DocumentSym
ServiceEnumInfo => SymbolKind.Enum,
ServiceExternalDtoInfo => SymbolKind.Interface,
ServiceExternalEnumInfo => SymbolKind.Enum,
ServiceErrorSetInfo => SymbolKind.Interface,
_ => SymbolKind.Null,
};

var maxColumn = memberNamePart.EndPosition.ColumnNumber;
var maxLine = memberNamePart.EndPosition.LineNumber;

var childSymbols = new List<DocumentSymbol>();
foreach (var child in member.GetDescendants().OfType<ServiceFieldInfo>())
foreach (var child in member.GetDescendants().OfType<ServiceElementWithAttributesInfo>())
{
var childNamePart = child.GetPart(ServicePartKind.Name);
if (childNamePart == null)
Expand All @@ -54,15 +55,25 @@ public async Task<SymbolInformationOrDocumentSymbolContainer> Handle(DocumentSym

var childTypePart = child.GetPart(ServicePartKind.TypeName);

var childName = child switch
{
ServiceFieldInfo field => field.Name,
ServiceErrorInfo error => error.Name,
_ => null,
};

if (childName == null)
continue;

var childSymbol = new DocumentSymbol
{
Name = child.Name,
Name = childName,
Kind = SymbolKind.Field,
Range = new Range(
new Position(childNamePart.Position),
new Position(
new ServiceDefinitionPosition(
child.Name,
childName,
childTypePart?.EndPosition.LineNumber ?? childNamePart.EndPosition.LineNumber,
childTypePart?.EndPosition.ColumnNumber ?? childNamePart.EndPosition.ColumnNumber))),
SelectionRange = new Range(
Expand Down

0 comments on commit 0b9e236

Please sign in to comment.