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

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


   }
  
   public String getCurrentSlide()
   {
      // search starting two lines ahead
      Position cursorPos = docDisplay_.getCursorPosition();
      Position searchPos = Position.create(cursorPos.getRow()+2, 0);
      InputEditorSelection sel = docDisplay_.search(SLIDE_REGEX,
                                                true,
                                                false,
                                                false,
                                                false,
View Full Code Here


   public static void navigateToSlide(final EditingTarget editor,
                                      int slideIndex)
   {
      // scan for the specified slide
      int currentSlide = 0;
      Position navPos = null;
      Position pos = Position.create(0, 0);
      while ((pos = editor.search(pos, "^\\={3,}\\s*$")) != null)
      {
         if (currentSlide++ == slideIndex)
         {
            navPos = Position.create(pos.getRow() - 1, 0);
            break;
         }
        
         pos = Position.create(pos.getRow() + 1, 0);
      }
     
      // navigate to the slide
      if (navPos != null)
      {
         final Position navPosAlias = navPos;
         Scheduler.get().scheduleDeferred(new ScheduledCommand() {

            @Override
            public void execute()
            {
               editor.navigateToPosition(
                 SourcePosition.create(navPosAlias.getRow(), 0),
                 false);
              
            }
         });
      }
View Full Code Here

                                              position.getColumn() - 1),
                        endPosition);
            }
            else if (pattern != null)
            {
               Position pos = target.search(pattern);
               if (pos != null)
               {
                  navigate(target,
                           SourcePosition.create(pos.getRow(), 0),
                           null);
               }
            }
         }
        
View Full Code Here

     
      // save cursor bounds
      cursorBounds_ = docDisplay_.getCursorBounds();
 
      // create an anchored selection to track editing
      Position start = docDisplay_.getSelectionStart();
      start = Position.create(start.getRow(), start.getColumn() - 1);
      Position end = docDisplay_.getSelectionEnd();
      end = Position.create(end.getRow(), end.getColumn() + 1);
      anchor_ = docDisplay_.createAnchoredSelection(start, end);
    
      // set the max width
      setMaxWidth(Window.getClientWidth() - 200);
     
View Full Code Here

               Scheduler.get().scheduleDeferred(new ScheduledCommand() {

                  @Override
                  public void execute()
                  {
                     Position cursorPos = docDisplay_.getCursorPosition();
                     Range anchorRange = anchor_.getRange();
                     if (cursorPos.isBeforeOrEqualTo(anchorRange.getStart()) ||
                         cursorPos.isAfterOrEqualTo(anchorRange.getEnd()))
                     {
                        hide();
                     }
                  }
               });
View Full Code Here

   {
      // get the current line of code
      String line = docDisplay.getCurrentLine();
     
      // get the cursor position
      Position position = docDisplay.getCursorPosition();
     
      // is there already a C++ identifier character at this position?
      // if so then bail
      if ((position.getColumn() < line.length()) &&
          CppCompletionUtils.isCppIdentifierChar(
                                        line.charAt(position.getColumn())))
      {
         return null;
      }
     
     
      // determine the column right before this one
      int inputCol = position.getColumn() - 1;
              
      // walk backwards across C++ identifer symbols
      int col = inputCol;
      while ((col >= 0) &&
            CppCompletionUtils.isCppIdentifierChar(line.charAt(col)))
      {
         col--;
      }
    
      // record source position
      Position startPos = Position.create(position.getRow(), col + 1);
     
      // check for a completion triggering sequence
      char ch = line.charAt(col);  
      char prefixCh = line.charAt(col - 1);
     
View Full Code Here

         {
            completionContext_.withUpdatedDoc(new CommandWithArg<String>() {
               @Override
               public void execute(final String docPath)
               {
                  Position pos = docDisplay_.getCursorPosition();
                 
                  server_.goToCppDefinition(
                      docPath,
                      pos.getRow() + 1,
                      pos.getColumn() + 1,
                      new SimpleRequestCallback<CppSourceLocation>() {
                         @Override
                         public void onResponseReceived(CppSourceLocation loc)
                         {
                            if (loc != null)
View Full Code Here

      docDisplay_ = docDisplay;
      completionPosition_ = completionPosition;
      invalidationToken_ = token;
      explicit_ = explicit;
     
      Position pos = completionPosition_.getPosition();
     
      server_.getCppCompletions(docPath,
                                pos.getRow() + 1,
                                pos.getColumn() + 1,
                                completionPosition_.getUserText(),
                                this);
   }
View Full Code Here

      docDisplay_.replaceSelection(insertText, true);
     
      if (completion.hasParameters() &&
          uiPrefs_.showSignatureTooltips().getValue())
      {
         Position pos = docDisplay_.getCursorPosition();
         pos = Position.create(pos.getRow(), pos.getColumn() - 1);
         docDisplay_.setSelectionRange(Range.fromPoints(pos, pos));
         new CppCompletionSignatureTip(completion, docDisplay_);
      }
   }
View Full Code Here

      public TargetSelectionTracker()
      {
         // expand the selection to include lines (ace will effectively do
         // this for a range based search)
         editor_.fitSelectionToLines(true);
         Position start = editor_.getSelectionStart();
         Position end = editor_.getSelectionEnd();
         anchoredSelection_ = editor_.createAnchoredSelection(start,end);
        
         // collapse the cursor to the beginning or end
         editor_.collapseSelection(defaultForward_);
        
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.