implement custom modes
Opened this issue · 5 comments
Is there a possibility to include custom made modes within the package?
I noticed that '/inst/www/ace' includes all the available modes for the different languages. I can imagine that if I place my custom mode in here and built the package, it would be accessible by aceEditor().
I am not sure if it would be this simple? If it is, it is still not preferable because it would require to make the package myself. It would be easier to use the CRAN version and for instance reference the mode file in the function.
Could you please advise what possibilities there are?
Sorry but I have not done this before. If you have a mode that would be generally useful (e.g., a good Rmd mode) it could perhaps be included in shinyFiles
.
Otherwise, if you can find a way to make the mode accessible to shinyFiles
from "outside" of the shinyFiles
package feel free to submit a PR for review.
I proposed a way to work with custom modes in PR #59
The way it was implemented is that you can provide a filename in the mode argument that should follow the ace editor requirement (method-name.js). it will then add the mode to the package folder under certain conditions so it is available for the editor. I have done some tests and it works on my system but if you have any questions or concerns please let me know
Ah. Missed this when look at the PR. I'd still like to see a reproducible example so I can try to think through if this is indeed the best way to do something like this
I made a simple example:
library(shiny) library(shinyAce) ui <- bootstrapPage( aceEditor( "ace", value = "; example code", mode="mode-test.js") ) server <- function(input, output) {} shinyApp(ui = ui, server = server)
The test file is the fortran mode where only the comment character is adapted (I attached the file here as a zip). I made one tiny change to the code in the PR, you can check this here: link it is on line 127.
Let me know if you need anything more.
Sorry, the code did not come trough the way I wanted:
library(shiny)
library(shinyAce)
ui <- bootstrapPage(
aceEditor(
"ace",
value = "; example code",
mode="mode-test.js")
)
server <- function(input, output) {}
shinyApp(ui = ui, server = server)