Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable autocompletion in tutor Ace instances #9

Merged
merged 14 commits into from
Jan 27, 2017

Conversation

kevinushey
Copy link
Collaborator

NOTE: not yet ready for merge but opening a PR for discussion.

This PR will be used to add autocompletion support to the editors used in an R Markdown tutorial document. Right now we just have the main skeleton necessary for registering a custom completer on Ace; hooking that up to R with a basic completion system is still a WIP.

Now that we're planning different tutor modules (e.g. autocompletion, diagnostics), should we consider generating a single minified tutor.min.js from the core tutor.js stuff alongside the tutor-autocompletion.js file + (pending) diagnostics?

@kevinushey kevinushey changed the title [WIP] enable autocompletion in tutor Ace instances enable autocompletion in tutor Ace instances Jan 26, 2017
@kevinushey
Copy link
Collaborator Author

I think this PR should be good to go -- @jjallaire, can you review + merge if all looks well? We can iterate on specific behaviors on master if there's anything you feel can / should be tweaked.


document.addEventListener("keydown", function(event) {

// TODO: find more appropriate place for one-time initialization
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we okay w/ this or is there still an issue outstanding here?

@@ -0,0 +1,291 @@
<!DOCTYPE html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should just .gitignore this file

@jjallaire
Copy link
Member

I got this error in the R console when typing within the autocompletion sandbox Rmd:

Listening on http://127.0.0.1:5678
Warning: Error in eval: could not find function "<-"
Stack trace (innermost first):
    3: <Anonymous>
    2: do.call
    1: rmarkdown::run [/Users/jjallaire/packages/rmarkdown/R/shiny.R#203]
Error : could not find function "<-"

@jjallaire
Copy link
Member

I'm not seeing completions for the setup chunk (i.e. if I type autocomp| I don't see completions).

@jjallaire
Copy link
Member

Looks great! I'll merge it now. One thing I noticed is that we don't get automatically triggered completions for :: and $ (the latter being much more important of course). Would that be straightforward to do?

@jjallaire jjallaire merged commit 91e31b1 into master Jan 27, 2017
@kevinushey
Copy link
Collaborator Author

It should be relatively straightforward -- I'll give that a shot!

@jjallaire
Copy link
Member

I'm also wondering if we should leave off explicit S3 methods for e.g. summary (because that ends up dominating the listing).

@kevinushey
Copy link
Collaborator Author

We could, but note that those methods are indeed exported + visible on the search path (ie, they're used both in S3 dispatch and are exported as though they are free functions). We also show those completions in the RStudio IDE and nobody has complained thus far.

@jjallaire
Copy link
Member

jjallaire commented Jan 27, 2017 via email

@jjallaire
Copy link
Member

jjallaire commented Jan 28, 2017 via email

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