use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.
the class TextEditingTargetRenameHelper method renameInScope.
public int renameInScope() {
init();
TextFileType type = editor_.getFileType();
if (type.isR() || type.isRhtml() || type.isRmd() || type.isRnw() || type.isRpres())
return renameInScopeR();
return 0;
}
use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.
the class DocumentOutlineWidget method shouldDisplayNode.
private boolean shouldDisplayNode(Scope node) {
String shownSectionsPref = uiPrefs_.shownSectionsInDocumentOutline().getGlobalValue();
if (node.isChunk() && shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_SECTIONS_ONLY))
return false;
if (isUnnamedNode(node) && !shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_ALL))
return false;
// NOTE: the 'is*' items are not mutually exclusive
if (node.isAnon() || node.isLambda() || node.isTopLevel())
return false;
// Don't show namespaces in the scope tree
if (node.isNamespace())
return false;
// don't show R functions or R sections in .Rmd unless requested
TextFileType fileType = target_.getDocDisplay().getFileType();
if (!shownSectionsPref.equals(UIPrefsAccessor.DOC_OUTLINE_SHOW_ALL) && fileType.isRmd()) {
if (node.isFunction())
return false;
if (node.isSection() && !node.isMarkdownHeader())
return false;
}
// TODO: Annotate scope tree in such a way that this isn't necessary
if (node.getLabel() != null && node.getLabel().startsWith("<function>"))
return false;
return node.isChunk() || node.isClass() || node.isFunction() || node.isNamespace() || node.isSection();
}
use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.
the class TextEditingTargetIdleMonitor method refreshCommands.
private void refreshCommands() {
commands_.clear();
timer_.cancel();
// attach commands based on file type
TextFileType fileType = display_.getFileType();
if (fileType == null)
return;
if (fileType.isRmd()) {
registerCommand(idleCommands_.PREVIEW_LINK);
registerCommand(idleCommands_.PREVIEW_LATEX);
}
}
use of org.rstudio.studio.client.common.filetypes.TextFileType in project rstudio by rstudio.
the class AceEditorBackgroundLinkHighlighter method refreshHighlighters.
private void refreshHighlighters(String mode) {
clearAllMarkers();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@Override
public void execute() {
TextFileType fileType = editor_.getFileType();
highlighters_.clear();
highlighters_.add(webLinkHighlighter());
if (fileType != null && (fileType.isMarkdown() || fileType.isRmd()))
highlighters_.add(markdownLinkHighlighter());
nextHighlightStart_ = 0;
timer_.schedule(700);
}
});
}
Aggregations