Closed wch closed 8 years ago
I think the issue here is with how RStudio detects the active editor:
In this case, the console has lost focus (as the addin has launched and stolen focus), but there is no alternate editor to use.
That said, I'm not sure what the solution here is, since an interactive addin that needs to work with a document will normally work with a source editor, not the console (although perhaps I'm wrong).
Perhaps what we really need is separate APIs for accessing:
getSourceEditorContext()
),getConsoleEditorContext()
),getActiveDocumentContext()
to track focus, and use the last-focused item.Thoughts, @jjallaire?
Yes, I think we definitely need both of those functions and the tracking behavior that you describe in getActiveDocumentContext.
BTW, I wonder if that function should be renamed getActiveEditorContext in light of the names of the other two functions?
On Fri, Jan 22, 2016 at 5:02 PM, Kevin Ushey notifications@github.com wrote:
I think the issue here is with how RStudio detects the active editor:
- If the console has focus, defer to the console.
- Otherwise, defer to the source window.
In this case, the console has lost focus (as the addin has launched and stolen focus), but there is no alternate editor to use.
That said, I'm not sure what the solution here is, since an addin that needs to work with a document will normally work with a source editor, not the console (although perhaps I'm wrong).
Perhaps what we really need is separate APIs for accessing:
- The last-focused source editor (getSourceEditorContext()),
- The console (getConsoleEditorContext()),
- Fix up getActiveDocumentContext() to track focus, and use the last-focused item.
Thoughts, @jjallaire https://github.com/jjallaire?
— Reply to this email directly or view it on GitHub https://github.com/rstudio/addinexamples/issues/2#issuecomment-174066997 .
That sounds good to me (we can 'soft-deprecate' the getActiveDocumentContext()
function)
I'm trying to use Rstudio add-on for citation but I'm getting this error: citr::insert_citation()
Listening on http://127.0.0.1:7082 Warning in RefManageR::ReadBib(file, check = FALSE) :
F:/thesis-HANDmade-akk/My Library.bib:2212:0
syntax error, unexpected TOKEN_LITERAL, expecting TOKEN_ABBREV or TOKEN_COMMA or TOKEN_KEY
Dropping the entry burke_indian_2012
(starting at line 2196)
Warning: Error in .BibEntryCheckBibEntry1: A bibentry of bibtype ‘InCollection’ has to specify the field: editor
Stack trace (innermost first):
80: .BibEntryCheckBibEntry1
79: $<-.BibEntry
78: $<-
77: MakeKeysUnique
76: c.BibEntry
75:
I (roughly) followed the examples in the documentation, and tried installing and running examples, but without any files open in the editor. When I did that, I got errors like this: