Beispiel #1
0
 public WindowChangedEventArgs(IntPtr hwnd, IWindow window, ICodePane pane, FocusType type)
 {
     Hwnd      = hwnd;
     Window    = window;
     CodePane  = pane;
     EventType = type;
 }
Beispiel #2
0
 public DeclarationChangedEventArgs(ICodePane pane, Declaration declaration, IVBComponent component = null, bool multipleControls = false)
 {
     ActivePane  = pane;
     Declaration = declaration;
     VBComponent = component;
     MultipleControlsSelected = multipleControls;
 }
Beispiel #3
0
 public CodeModule(IVBE vbe, string name, string content, IVBComponent component, ICodePane codePane)
 {
     VBE      = vbe;
     Name     = name;
     _lines   = content.Split(new[] { Environment.NewLine }, StringSplitOptions.None).ToList();
     Parent   = component;
     CodePane = codePane;
 }
Beispiel #4
0
        public string Format(ICodePane activeCodePane, Declaration declaration)
        {
            if (activeCodePane == null)
            {
                return(string.Empty);
            }

            var qualifiedSelection = activeCodePane.GetQualifiedSelection();

            if (declaration == null || !qualifiedSelection.HasValue)
            {
                return(string.Empty);
            }

            var selection             = qualifiedSelection.Value;
            var codePaneSelectionText = selection.Selection.ToString();
            var contextSelectionText  = FormatDeclaration(declaration);

            return(string.Format("{0} | {1}", codePaneSelectionText, contextSelectionText));
        }
Beispiel #5
0
        public async Task <string> FormatAsync(ICodePane activeCodePane, Declaration declaration, CancellationToken token)
        {
            if (activeCodePane == null)
            {
                return(string.Empty);
            }

            var qualifiedSelection = activeCodePane.GetQualifiedSelection();

            if (declaration == null || !qualifiedSelection.HasValue)
            {
                return(string.Empty);
            }

            var selection             = qualifiedSelection.Value;
            var codePaneSelectionText = selection.Selection.ToString();
            var contextSelectionText  = await FormatDeclarationAsync(declaration, token);

            return($"{codePaneSelectionText} | {contextSelectionText}");
        }
Beispiel #6
0
        private void ResetSelection(ICodePane codePane, Selection initialSelection)
        {
            using (var window = _vbe.ActiveWindow)
            {
                if (initialSelection == default || codePane == null || window == null ||
                    window.IsWrappingNullReference || window.Type != WindowKind.CodeWindow ||
                    codePane.IsWrappingNullReference)
                {
                    return;
                }
            }

            using (var module = codePane.CodeModule)
            {
                // This will only "ballpark it" for now - it sets the absolute line in the module, not necessarily
                // the specific LoC. That will be a TODO when the parse tree is used to indent. For the time being,
                // maintaining that is ridiculously difficult vis-a-vis the payoff if the vertical spacing is
                // changed.
                var lines = module.CountOfLines;
                codePane.Selection = lines < initialSelection.StartLine
                    ? new Selection(lines, initialSelection.StartColumn, lines, initialSelection.StartColumn)
                    : initialSelection;
            }
        }
Beispiel #7
0
 private static Selection GetSelection(ICodePane codePane)
 {
     return(codePane.Selection);
 }
 public Declaration FindSelectedDeclaration(ICodePane activeCodePane)
 {
     return(DeclarationFinder?.FindSelectedDeclaration(activeCodePane));
 }
Beispiel #9
0
 public bool Equals(ICodePane other)
 {
     return(Equals(other as SafeComWrapper <VB.CodePane>));
 }
 public SelectionChangedEventArgs(ICodePane pane)
 {
     CodePane = pane;
 }
Beispiel #11
0
 public bool Equals(ICodePane other)
 {
     throw new NotImplementedException();
 }
 public Declaration FindSelectedDeclaration(ICodePane activeCodePane, bool procedureLevelOnly = false)
 {
     return(DeclarationFinder?.FindSelectedDeclaration(activeCodePane));
 }
 private Declaration FindCodePaneTarget(ICodePane codePane)
 {
     return(_state.FindSelectedDeclaration(codePane));
 }
Beispiel #14
0
 internal CodePaneSubclass(IntPtr hwnd, ICodePane pane) : base(hwnd)
 {
     _pane = pane;
 }