Comments (6)
I was looking for autocomplete support for ace earlier but ended up with this issue, which was closed 4 months ago. Then I see this long running thread. I also did find this commit, which just confuses me.
Something tells me that they don't have a great support for autocomplete?
from rcloud.
There's this, which has been merged: ajaxorg/ace#1189
from rcloud.
Yayayay! How do we get the words to complete with?
from rcloud.
There's several steps to this.
First, we need a function that takes the current cursor position and isolates the "relevant R statement". There might be R code that does this (@s-u, help here?). Here are some relevant use cases, where I'm using <>
to denote the position of the cursor.
First, trivial cases:
x <- rno<>
This should return rnorm
, etc. Then, almost-as-trivial:
x <- 5; y <- rno<>
Then, a little more annoying, since it mixes markdown:
# Some title
A paragraph
```{r}
x <- rno<>
This takes some annoying parsing code duplication with knitr, but I see no way around it.
from rcloud.
Assuming we can isolate the latest incomplete R statement, the next step is to crib the rcompgen.completion
function from the R graphical client:
> rcompgen.completion
function (x)
{
utils:::.assignLinebuffer(x)
utils:::.assignEnd(nchar(x))
utils:::.guessTokenFromLine()
utils:::.completeToken()
utils:::.CompletionEnv[["comps"]]
}
With that,
> rcompgen.completion("rno")
[1] "rnorm"
> rcompgen.completion("x <- rnorm(")
[1] "n=" "mean=" "sd="
> rcompgen.completion("y <- 5; x <- rnorm(")
[1] "n=" "mean=" "sd="
It's smart enough to pluck the last statement by itself, so it might just be a matter of isolating the last R block.
from rcloud.
Pushing basic support for this. Required a few changes to mode-r.js and ext-language_tools.js which I'm not completely sure about and which will need to be reapplied or rethought the next time we upgrade ace.
(See the commit messages.)
from rcloud.
Related Issues (20)
- display host in HTTP error messages
- Open in GitHub should also be disabled on view page
- option to set notebook name when creating new notebook
- Support GitHub App API
- can't add tag to current version
- notebook.R and non-R code
- error in merge
- should the author also be grayed if recent notebook is hidden?
- RCloud as a Package HOT 1
- allow use.gist.user.home with gist service login
- rcloud.jupyter only supports older jupyter packages HOT 1
- progress bars a mess
- view.html?source=1
- Cell commands, or at least "run cell", for view.html
- I been going into hacked fake at&t website HOT 1
- add Export Notebook as R source file to view.html
- passing working directory between languages
- "reload" button for notebook tree
- enhance rcloud.encrypt/rcloud.decrypt to handle user and group keys
- upload to working directory HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rcloud.