public bool QuickCheckAvailability()

in Backend/Core/ForTea.Core/Services/TypingAssist/T4TypingAssist.cs [43:88]


    public bool QuickCheckAvailability(ITextControl textControl, IPsiSourceFile projectFile)
      => projectFile.LanguageType.Is<T4ProjectFileType>();

    /// <summary>When = is typed, insert "".</summary>
    private bool OnEqualTyped(ITypingContext context)
    {
      ITextControl textControl = context.TextControl;

      // get the token type before =
      CachingLexer cachingLexer = GetCachingLexer(textControl);
      if (cachingLexer == null)
        return false;
      var offset = textControl.Caret.DocumentOffset();
      if (!cachingLexer.FindTokenAt(offset.Offset - 1))
        return false;

      // do nothing if we're not after an attribute name
      TokenNodeType tokenType = cachingLexer.TokenType;
      if (tokenType != T4TokenNodeTypes.TOKEN)
        return false;

      // insert =
      textControl.Selection.Delete();
      textControl.FillVirtualSpaceUntilCaret();
      textControl.Document.InsertText(offset, "=");
      textControl.Caret.MoveTo(offset + 1, CaretVisualPlacement.DontScrollIfVisible);

      // insert ""
      context.QueueCommand(() =>
      {
        using (CommandProcessor.UsingCommand("Inserting \"\""))
        {
          textControl.Document.InsertText(offset + 1, "\"\"");
          textControl.Caret.MoveTo(offset + 2, CaretVisualPlacement.DontScrollIfVisible);
        }

        // ignore if a subsequent " is typed by the user
        SkippingTypingAssist.SetCharsToSkip(textControl.Document, "\"");

        // popup auto completion
        _codeCompletionSessionManager.ExecuteAutoCompletion<T4AutopopupSettingsKey>(textControl, Solution,
          key => key.InDirectives);
      });

      return true;
    }