Reputation: 83
I recently switched to using VSCode, but it unfortunately doesn't have OCaml syntax highlighting. Is there a way to add this?
Upvotes: 1
Views: 2790
Reputation: 83
Yup! Here is the step by step process for someone on a Mac. 1) Install yo. Instructions are here.
2) Run yo using the command "yo code". MAKE SURE YOU ARE IN THE DEFAULT DIRECTORY OF TERMINAL.
3) Choose "new language support".
4) Copy paste this url when prompted for URL or file: https://raw.githubusercontent.com/whitequark/sublime-better-ocaml/master/OCaml.tmLanguage
5) Fill in the rest of the information. Use the suggestions it provides - sometimes the question will have (*******) where ****** is a word. Detected languageID, name, and file extensions should be suggested, as the OCaml file has this information in it.
6) If everything goes smoothly, you'll receive a message from yo code stating "Your extension extension_name_here has been created!". If you get errors, feel free to post here and I'll try to help out.
7) Next, copy-paste "defaults write com.apple.finder AppleShowAllFiles YES" into terminal. This will show hidden files.
8) Press alt/option and right click on finder. You should see the option "relaunch". Click it.
9) Check for a file with the same name as the extension name you chose while in yo code.
10) Copy this file, then look for .vscode; it will be a faint color since it's normally hidden.
11) If double clicking .vscode doesn't open it, right click on .vscode folder and click "open in new tab". That will open a new tab with the folder "extensions" inside. Double click on extensions and enter the folder.
12) If you have other extensions installed, you'll see their folders here. Paste the folder with extension_name in here and restart VSCode if you currently have it open.
13) Try opening any .ml or .mli file. You should have full syntax highlighting.
14) Copy paste "defaults write com.apple.finder AppleShowAllFiles NO" into terminal. Re-launch finder to reflect these preference changes. This will hide hidden folders again.
Upvotes: 2