Skip to content

Commit

Permalink
Added completion items for boolean fields
Browse files Browse the repository at this point in the history
  • Loading branch information
penev92 committed Oct 23, 2022
1 parent 06f2bd1 commit 081374c
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ public class TextDocumentCompletionHandler : BaseRpcMessageHandler
CommitCharacters = new[] { ":" }
};

readonly CompletionItem trueCompletionItem = new ()
{
Label = "true",
Kind = CompletionItemKind.Value,
Detail = "A boolean value."
};

readonly CompletionItem falseCompletionItem = new ()
{
Label = "false",
Kind = CompletionItemKind.Value,
Detail = "A boolean value."
};

public TextDocumentCompletionHandler(SymbolCache symbolCache, OpenFileCache openFileCache)
: base(symbolCache, openFileCache) { }

Expand Down Expand Up @@ -329,6 +343,11 @@ protected override IEnumerable<CompletionItem> HandleRulesValue(CursorTarget cur
});
}

if (fieldInfo.InternalType == "bool")
{
return new[] { trueCompletionItem, falseCompletionItem };
}

return Enumerable.Empty<CompletionItem>();
}

Expand Down Expand Up @@ -481,6 +500,11 @@ protected override IEnumerable<CompletionItem> HandleWeaponValue(CursorTarget cu
});
}

if (fieldInfo.InternalType == "bool")
{
return new[] { trueCompletionItem, falseCompletionItem };
}

return Enumerable.Empty<CompletionItem>();
}

Expand Down Expand Up @@ -593,6 +617,11 @@ IEnumerable<CompletionItem> HandleSpriteSequenceProperty()
}
}

if (fieldInfo.InternalType == "bool")
{
return new[] { trueCompletionItem, falseCompletionItem };
}

return Enumerable.Empty<CompletionItem>();
}

Expand Down

0 comments on commit 081374c

Please sign in to comment.