Skip to content

use new rmarkdown's 'output_source' - #701

Merged
kevinushey merged 3 commits into
masterfrom
feature/notebook-output-source
May 12, 2016
Merged

kevinushey merged 3 commits into
masterfrom
feature/notebook-output-source

Conversation

@kevinushey

@kevinushey kevinushey commented May 11, 2016 •

Copy link
Copy Markdown
Collaborator

NOTE: hold this PR pending some more testing.

This PR implements cache item injection using the output_source hook provided by rmarkdown. Essentially, a cleaned-up version of the code we were injecting into the evaluate hook has now been moved to output_source, and we remove a bunch of unneeded code (as that code has been moved to rmarkdown.

We should make sure we sync an rmarkdown version bump and pin to that before merging this PR.

@kevinushey
kevinushey force-pushed the feature/notebook-output-source branch from 6b2dae9 to e864e9f Compare May 11, 2016 18:54
@jjallaire

Copy link
Copy Markdown
Member

LGTM. Feel free to merge once you've done the additional testing you want to.

The last commit in rmarkdown is a version bump so we should be good to go there.

@kevinushey
kevinushey merged commit b8de422 into master May 12, 2016
@valerie-rstudio
valerie-rstudio deleted the feature/notebook-output-source branch January 21, 2022 17:20
kevinushey added a commit that referenced this pull request May 26, 2026
The basename-only readiness check could match the wrong active document
when two open files share a basename (or, on case-sensitive
filesystems, differ only in case). When the caller passes an absolute
path, compare the full normalized path (case-insensitive, slashes
normalized) instead. Relative / bare-basename inputs still fall back
to basename match -- R resolves them against its own cwd, so the
absolute form RStudio reports back is not known to the helper.

Addresses roborev review #701 (MEDIUM).
kevinushey added a commit that referenced this pull request May 26, 2026
* test(e2e): expose active ace editor via automation bridge

Adds window.rstudio.documents.activeEditor(), which returns the native
Ace JS instance backing the active source document (or null). It maps
through SourceColumnManager.getActiveNativeEditor -- the same path the
GWT side already uses to track "the active doc" -- so callers no longer
have to scan the DOM for a .ace_editor element.

The DOM scan in getEditorContent and openExistingFile was the proximate
cause of 8 consistent air_formatting test failures: the bare .ace_editor
selector also matches ShellWidget's console scroll panel, dialog
editors (IgnoreDialog, ViewFileDialog, EditSnippetsDialog,
AceEditorPreview), and stale source editors left in the DOM after a tab
close -- any of which could shadow the real editor and surface as an
empty getValue() in reformatCode.

Refactors:
- getEditorContent() reads activeEditor()?.getValue() instead of
  iterating .ace_editor.
- New openExistingFile() helper (utils/files.ts) waits on
  documents.active().path basename match + activeEditor() != null;
  writeAndOpenFile and SourcePaneActions.createAndOpenFile both delegate
  to it.
- air_formatting.test.ts: openTestFile uses openExistingFile;
  focusEditor wraps its waitForFunction in a diagnostic catch so a
  future focus-drift failure reports the actual active element, the
  in-console / in-source-panel flags, and the source-pane ace count
  instead of an opaque predicate-timeout.

* rename openExistingFile to openFile

* openFile: compare full paths when absolute input is given

The basename-only readiness check could match the wrong active document
when two open files share a basename (or, on case-sensitive
filesystems, differ only in case). When the caller passes an absolute
path, compare the full normalized path (case-insensitive, slashes
normalized) instead. Relative / bare-basename inputs still fall back
to basename match -- R resolves them against its own cwd, so the
absolute form RStudio reports back is not known to the helper.

Addresses roborev review #701 (MEDIUM).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants