void ICommandHandler <ToggleCompletionModeCommandArgs> .ExecuteCommand(ToggleCompletionModeCommandArgs args, Action nextHandler)
        {
            if (Workspace.TryGetWorkspace(args.SubjectBuffer.AsTextContainer(), out var workspace))
            {
                var newState = !workspace.Options.GetOption(EditorCompletionOptions.UseSuggestionMode);
                workspace.Options = workspace.Options.WithChangedOption(EditorCompletionOptions.UseSuggestionMode, newState);

                // If we don't have a computation in progress, then we don't have to do anything here.
                if (this.sessionOpt == null)
                {
                    return;
                }

                this.sessionOpt.SetModelBuilderState(newState);
            }
        }
        void ICommandHandler <ToggleCompletionModeCommandArgs> .ExecuteCommand(ToggleCompletionModeCommandArgs args, Action nextHandler)
        {
            Workspace workspace;

            if (Workspace.TryGetWorkspace(args.SubjectBuffer.AsTextContainer(), out workspace))
            {
                var optionService = workspace.Services.GetService <IOptionService>();
                var optionSet     = optionService.GetOptions();

                var wasEnabled = optionService.GetOption(EditorCompletionOptions.UseSuggestionMode);
                optionService.SetOptions(optionSet.WithChangedOption(EditorCompletionOptions.UseSuggestionMode, !wasEnabled));

                // If we don't have a computation in progress, then we don't have to do anything here.
                if (this.sessionOpt == null)
                {
                    return;
                }

                this.sessionOpt.SetModelBuilderState(!wasEnabled);
            }
        }
Ejemplo n.º 3
0
        CommandState ICommandHandler <ToggleCompletionModeCommandArgs> .GetCommandState(ToggleCompletionModeCommandArgs args, System.Func <CommandState> nextHandler)
        {
            AssertIsForeground();

            var isEnabled = args.SubjectBuffer.GetFeatureOnOffOption(EditorCompletionOptions.UseSuggestionMode);

            return(new CommandState(isAvailable: true, isChecked: isEnabled));
        }
 CommandState ICommandHandler <ToggleCompletionModeCommandArgs> .GetCommandState(ToggleCompletionModeCommandArgs args, System.Func <CommandState> nextHandler)
 {
     AssertIsForeground();
     return(GetCommandStateWorker(args, nextHandler));
 }
 void ICommandHandler <ToggleCompletionModeCommandArgs> .ExecuteCommand(ToggleCompletionModeCommandArgs args, System.Action nextHandler)
 {
     AssertIsForeground();
     ExecuteCommandWorker(args, nextHandler);
 }
 void IChainedCommandHandler <ToggleCompletionModeCommandArgs> .ExecuteCommand(ToggleCompletionModeCommandArgs args, Action nextHandler, CommandExecutionContext context)
 {
     AssertIsForeground();
     ExecuteCommandWorker(args, nextHandler, context);
 }
Ejemplo n.º 7
0
 bool ICommandHandler <ToggleCompletionModeCommandArgs> .ExecuteCommand(ToggleCompletionModeCommandArgs args, CommandExecutionContext executionContext)
 {
     // Do nothing. We merely enable others to call this command
     return(true);
 }
Ejemplo n.º 8
0
 CommandState ICommandHandler <ToggleCompletionModeCommandArgs> .GetCommandState(ToggleCompletionModeCommandArgs args)
 {
     return(CommandState.Available);
 }
Ejemplo n.º 9
0
 public bool ExecuteCommand(ToggleCompletionModeCommandArgs args, CommandExecutionContext executionContext)
 {
     // Record that user used the Ctrl+Alt+Space command to use Suggestion Mode
     return(false); // If we return true, the command is marked as "handled" and not actually executed
 }
Ejemplo n.º 10
0
 // Use CommandState.Unspecified to not interfere with execution,
 // but if there are not command handlers that mark this command as Available,
 // then we won't run
 public CommandState GetCommandState(ToggleCompletionModeCommandArgs args) => CommandState.Unspecified;