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

WIP / EXPERIMENTAL: Interpret javascript in snippets #2139

Closed
wants to merge 9 commits into from

Conversation

harshad1
Copy link
Collaborator

@harshad1 harshad1 commented Oct 21, 2023

In this PR I have added support for the evaluation of javascript when expanding snippets.

Additionally the following keywords are supporteed:

  • {{selection}}: replaced with currently selected text
  • {{date}}: Inserts today's date in yyyy-MM-dd format
  • {{time}}: Inserts the current time in HH:mm format
  • {{title}}: Inserts current / new document title
  • {{cursor}}: Cursor placed here after snippet insertion

I have had to include an external library and bump up the min version to 18 in order to enable this. I am investigating if we can achieve JS in snippets in other ways. We should probably bump up min version to 20 anyway as it is now 10 years old.

@gsantner
Copy link
Owner

to be honest, not really a fan of adding JS on every end. and neither too much about increasing minSdk.

It might make sense over time to increase to sensible number but trying to keep it as low possibke.

@harshad1
Copy link
Collaborator Author

harshad1 commented Nov 6, 2023

While this branch is working well (and now does not require external dependencies or an increase in API level) I have decided that adding JS interpolation to markor is not something we should try to do after all.

Closing this for now. I will pull the other changes into a new branch + PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants