Package org.rstudio.studio.client.workbench.views.source.editors.text.ace

Examples of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position


  
   private void withPreservedSelection(Command command)
   {
      // save the selection and scroll position for restoration
      int scrollPosition = docDisplay_.getScrollTop();
      Position start = docDisplay_.getSelectionStart();
      Position end = docDisplay_.getSelectionEnd();
      AnchoredSelection anchoredSelection =
                           docDisplay_.createAnchoredSelection(start,end);
     
      // execute the command
      command.execute();
View Full Code Here


      // get doc path (bail if the document is unsaved)
      String file = docUpdateSentinel_.getPath();
      if (file == null)
         return null;
     
      Position selPos = docDisplay_.getSelectionStart();
      int line = selPos.getRow() + 1;
      int column = selPos.getColumn() + 1;
      return SourceLocation.create(file, line, column, fromClick);
   }
View Full Code Here

                                        docDisplay_.getSelectionEnd());
         if (range.isEmpty())
         {
            // If no selection, unfold the closest fold on the current row
  
            Position pos = range.getStart();
  
            AceFold startCandidate = null;
            AceFold endCandidate = null;
  
            for (AceFold f : JsUtil.asIterable(docDisplay_.getFolds()))
            {
               if (startCandidate == null
                   && f.getStart().getRow() == pos.getRow()
                   && f.getStart().getColumn() >= pos.getColumn())
               {
                  startCandidate = f;
               }
  
               if (f.getEnd().getRow() == pos.getRow()
                   && f.getEnd().getColumn() <= pos.getColumn())
               {
                  endCandidate = f;
               }
            }
  
            if (startCandidate == null ^ endCandidate == null)
            {
               docDisplay_.unfold(startCandidate != null ? startCandidate
                                                          : endCandidate);
            }
            else if (startCandidate != null)
            {
               // Both are candidates; see which is closer
               int startDelta = startCandidate.getStart().getColumn() - pos.getColumn();
               int endDelta = pos.getColumn() - endCandidate.getEnd().getColumn();
               docDisplay_.unfold(startDelta <= endDelta? startCandidate
                                                        : endCandidate);
            }
         }
         else
View Full Code Here

            });
   }
  
   private SourcePosition toSourcePosition(Scope func)
   {
      Position pos = func.getPreamble();
      return SourcePosition.create(pos.getRow(), pos.getColumn());
   }
View Full Code Here

   }
  
   private boolean checkCanAutoPopup(char c, int lookbackLimit)
   {
      String currentLine = docDisplay_.getCurrentLine();
      Position cursorPos = input_.getCursorPosition();
      int cursorColumn = cursorPos.getColumn();

      boolean canAutocomplete = canAutoPopup_ &&
            (currentLine.length() > lookbackLimit - 1 && isValidForRIdentifier(c));

      if (canAutocomplete)
View Full Code Here

            continue;
        
         if (commaCount < 2)
            return "";

         Position start = cursor.currentPosition();
         if (!cursor.moveToNextToken())
            return "";

         if (!cursor.fwdToMatchingToken())
            return "";

         Position end = cursor.currentPosition();
         end.setColumn(end.getColumn() + 1);

         return editor.getTextForRange(Range.fromPoints(
               start, end));
      }
      return "";
View Full Code Here

           
            // if there was no previous selection then put the cursor
            // inside the braces
            if (selection.length() == 0)
            {
               Position pos = editor_.getCursorPosition();
               int row = pos.getRow();
               if (suffix.startsWith("\n"))
                  row = Math.max(0,  row - 1);
               int col = Math.max(0, pos.getColumn() - suffix.length());
          
               editor_.setCursorPosition(Position.create(row, col));
            }
         }};
   }
View Full Code Here

      AceEditor editor = (AceEditor) editor_;

      // NOTE: this will be null in the console, so protect against that
      if (editor != null)
      {
         Position cursorPosition =
               editor.getSession().getSelection().getCursor();
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
         JsArray<RFunction> scopedFunctions =
               codeModel.getFunctionsInScope(cursorPosition);
View Full Code Here

      AceEditor editor = (AceEditor) editor_;

      // NOTE: this will be null in the console, so protect against that
      if (editor != null)
      {
         Position cursorPosition =
               editor.getSession().getSelection().getCursor();
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
     
         JsArray<RScopeObject> scopeVariables = codeModel.getVariablesInScope(cursorPosition);
         for (int i = 0; i < scopeVariables.length(); i++)
View Full Code Here

   {
      AceEditor editor = (AceEditor) editor_;

      if (editor != null)
      {
         Position cursorPosition =
               editor.getSession().getSelection().getCursor();
         CodeModel codeModel = editor.getSession().getMode().getCodeModel();
        
         // Try to see if we can find a function name
         TokenCursor cursor = codeModel.getTokenCursor();
View Full Code Here

TOP

Related Classes of org.rstudio.studio.client.workbench.views.source.editors.text.ace.Position

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.