-
Notifications
You must be signed in to change notification settings - Fork 54
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
added custom modes #59
base: master
Are you sure you want to change the base?
added custom modes #59
Conversation
@RichardHooijmaijers Can you provide a bit more information about how you envision this would work? Can you add a reproducible example as well? |
Hello there. I just stumbled upon this PR and wanted to note something. It is generally not a good idea to copy files into the location where a package is built because of writing permissions. If an administrator builds the It would be a better idea to copy the JavaScript files into the sessions temporary directory ( |
Thanks for the PR @RichardHooijmaijers but I would have to agree with @GregorDeCillia on this one. Is there a reason you would not want to include the custom mode in shinyAce? Is it very large? Not generally useful outside of your application? Perhaps another option might be to "source" the mode file by providing a full path to the mode file in your package using something like |
The The way the package is setup, I don't think sourcing it would be an option, also the mode that was created is not really useful outside the application. Furthermore, I thought it would be nice to be able to include any user created mode. |
@RichardHooijmaijers I agree that it might be nice to be able to include any user created mode. However, it is not feasible to have all modes available a tempdir. If you can add an option to source a mode from another package or resource that could be a useful PR |
The way I imagined it was to only move user-defined mode(s) into the tempdir when the The option to load modes only from packages seems a little bit rigid to me, since every change in the user-mode would require a new installation of the package containing it. Also, some users might want to add custom-modes without a package which would not be possible in that case. Of course another option would be to create a hidden directory in home, for example
|
If the user can specify a path to a mode to load that seems fine to me. That path could be in the tempdir or a package directory |
I am not able to get this working unfortunately.. If anyone want to give it a try, that would be great. For now I am gonna leave it as it is and explore other options.. |
Hi @vnijs I am interested in this functionality for an app that would require a single custom mode (and thus not part of the default list of modes). I am confused by the conflicted information of this thread and was wondering if you confirm if there is a way to implement this or not? Thanks PS: very cool and useful package by the way! |
@sbihorel Thanks for your interest @sbihorel. I liked @GregorDeCillia's suggestions on the setup but I don't know if it is feasible. If you can make it work, feel free to create a PR. |
I can have a look into this over the weekend. From a conceptual point of view, this seems like a straight-forward feature to add but time will tell. The way I imagined it would be to supply the mode in the constructor
or the update function.
The function |
@GregorDeCillia |
Very interesting indeed. I'm very curious to hear more about how this might address #24 |
Unfortunately I couldn't get this to work properly but it should be possible to change the resource folder for modes on the JavaScript side with
as described in ajaxorg/ace#1518. This could potentially be combined with
I can't say if I will have time to dig into this deeper but I will try |
Hi, A colleague of mine has created a custom mode file (mode-whatever.js) which works when included in ace editors inserted in regular web pages (ie, non shiny-based). I have tried to insert this file in the inst/www/ace folder of the shinyAce source, rebuilt the package and re-installed it. Now, when I run the 01-basic example app, the whatever mode is listed in the drop-down for modes but it does not seem to affect the editor content at all when I select this mode.
Thanks |
@sbihorel I would indeed expect this to work. Check the JS console for any errors and compare to the other "mode" files |
@sbihorel you can find an example for a custom mode in the issue related to this PR #57 (there is a zip attached at the end). Although I really agree with @GregorDeCillia regarding not copying files to the installation directory of a package, if you want to test or use it in a controlled environment the following worked for me without adapting the original package: |
@vnijs @RichardHooijmaijers |
No description provided.