From 9c3f618005a7b6a654ef39e5a1e20346ee3b1445 Mon Sep 17 00:00:00 2001 From: Adarsh Chavali Date: Tue, 4 Feb 2020 10:42:12 -0800 Subject: [PATCH] Fix syntax highlighting --- README.md | 22 +++++++++----- Xcode.SourceCodeLanguage.Rust.plist | 46 +++++++++++++++++++++++++++++ setup.sh | 34 +++++++++++++++++++++ 3 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 Xcode.SourceCodeLanguage.Rust.plist create mode 100755 setup.sh diff --git a/README.md b/README.md index fd023a1..de6bae0 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,22 @@ Based on: https://github.com/youknowone/rust-xcode-langspec https://github.com/steventroughtonsmith/lua-xclangspec -## Install -Place the `Plug-ins` and `Specifications` folders in `~Library/Developer/Xcode` - -You may have to quit and reopen Xcode once or twice and click the `Load Bundle` button in a popup that should appear automatically. - -Additionally if your Xcode UUID is not listed [here](https://github.com/mtak-/rust-xcode-plugin/blob/master/Plug-ins/Rust.ideplugin/Contents/Info.plist), please make an issue (or a pull request!) and I'll add it. +If your Xcode UUID is not listed [here](https://github.com/mtak-/rust-xcode-plugin/blob/master/Plug-ins/Rust.ideplugin/Contents/Info.plist), please make an issue (or a pull request!) and I'll add it. You can check your UUID with this command: ```sh $ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID -``` \ No newline at end of file +``` +Once the UUID is added, execute the `setup.sh` script + +You may have to quit and reopen Xcode once or twice and click the `Load Bundle` button in a popup that should appear automatically. + +## Manual Install +Place the `Plug-ins` folders in `~Library/Developer/Xcode` + +Place the `Rust.xclangspec` in `/Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageSpecifications` + +Place `Xcode.SourceCodeLanguage.Rust.plist` in `/Applications/Xcode.app/Contents/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageMetadata` + + + diff --git a/Xcode.SourceCodeLanguage.Rust.plist b/Xcode.SourceCodeLanguage.Rust.plist new file mode 100644 index 0000000..36e4572 --- /dev/null +++ b/Xcode.SourceCodeLanguage.Rust.plist @@ -0,0 +1,46 @@ + + + + + commentSyntaxes + + + prefix + /* + suffix + */ + + + prefix + // + + + conformsToLanguageIdentifiers + + Xcode.SourceCodeLanguage.Generic + + fileDataTypeIdentifiers + + public.rust-source + + identifier + Xcode.SourceCodeLanguage.Rust + isHidden + + languageName + Rust + languageSpecification + xcode.lang.rust + supportsIndentation + + allowWhitespaceTrimming + + requiresHardTabs + + indentationTriggers + + { + } + + + diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..9e6a4ae --- /dev/null +++ b/setup.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -x + +# Create plug-ins directory if it doesn't exist +plugins_dir=~/Library/Developer/Xcode/Plug-ins/ +if [ ! -d "$plugins_dir" ]; then + mkdir $plugins_dir +fi + +# Copy the IDE Plugin to the plug-ins directory + +cp -r Plug-ins/Rust.ideplugin $plugins_dir + +#Get the selected Xcode.app's path +xcode_path=$(xcode-select -p) +xcode_path=$(dirname $xcode_path) + +# Get Specifications directory +spec_dir="${xcode_path}/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageSpecifications" + +# Copy the language specification to the specs directory +cp Specifications/Rust.xclangspec $spec_dir +#cp Specifications/Rust.xcspec $spec_dir + +# Get language metadata directory +metadata_dir="${xcode_path}/SharedFrameworks/SourceModel.framework/Versions/A/Resources/LanguageMetadata" + +# Copy the source code language plist to the metadata directory +cp Xcode.SourceCodeLanguage.Rust.plist $metadata_dir + +defaults read ${xcode_path}/Info DVTPlugInCompatibilityUUID + +echo "Please restart Xcode"