Skip to content

Retrieving information about source document should include the mod (Source vs Visual) when applicable #266

Open

Description

@daattali

Related to #265

When trying to work with Rmd/Qmd files, it may be helpful to know whether the script is currently open in Source or in Visual mode.

I do see that there are a few functions that are meant to work with visual mode eg. documentId(), selectionGet() - but these only work for the currently active document, so if I run them from the commandline they don't return something useful.

Activity

  1. GegznaV commented on Oct 1, 2023

    @GegznaV

    Is there any progress towards solving this issue?

  2. kevinushey commented on Oct 2, 2023

    @kevinushey
    Contributor

    Any thoughts on the right fix? Should we add something like documentEditorMode() for querying the editor mode type, or include that as part of the other "context" requests?

  3. GegznaV commented on Oct 3, 2023

    @GegznaV

    I think, the output of rstudioapi::getActiveDocumentContext() and friends could have an additional field, e.g., editor_mode with values visual or source or is_visual_mode with values TRUE or FALSE.

  4. GegznaV commented on Oct 3, 2023

    @GegznaV

    @kevinushey, is there a way to know which type of Visual Editor's content a cursor is in? E.g., is it in the R code block, in heading 1 or heading 3 block, or a regular text block? I.e., in theory, can this type of information be also retrieved?

  5. added this to the 0.16.0 milestone on Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions