Files
godot-csharp-visualstudio/GodotCompletionProviders/InputActionCompletionProvider.cs
Ignacio Etcheverry 9c0de9611b Initial commit
2020-06-13 13:40:06 +02:00

27 lines
1.6 KiB
C#

using System.Collections.Generic;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Completion;
namespace GodotCompletionProviders
{
[ExportCompletionProvider(nameof(InputActionCompletionProvider), LanguageNames.CSharp)]
public class InputActionCompletionProvider : SpecificInvocationCompletionProvider
{
// TODO: Support offline (not connected to a Godot editor) completion of input actions (parse godot.project).
private static readonly IEnumerable<ExpectedInvocation> ExpectedInvocations = new[]
{
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "IsActionPressed", ArgumentIndex = 0, ArgumentTypes = StringTypes},
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "IsActionJustPressed", ArgumentIndex = 0, ArgumentTypes = StringTypes},
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "IsActionJustReleased", ArgumentIndex = 0, ArgumentTypes = StringTypes},
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "GetActionStrength", ArgumentIndex = 0, ArgumentTypes = StringTypes},
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "ActionPress", ArgumentIndex = 0, ArgumentTypes = StringTypes},
new ExpectedInvocation {MethodContainingType = InputType, MethodName = "ActionRelease", ArgumentIndex = 0, ArgumentTypes = StringTypes}
};
public InputActionCompletionProvider() : base(ExpectedInvocations, CompletionKind.InputActions, "InputAction")
{
}
}
}