Fix syntax highlighting

This commit is contained in:
Adarsh Chavali
2020-02-04 10:42:12 -08:00
parent f6d4359f4d
commit 9c3f618005
3 changed files with 95 additions and 7 deletions

View File

@@ -8,14 +8,22 @@ Based on:
https://github.com/youknowone/rust-xcode-langspec https://github.com/youknowone/rust-xcode-langspec
https://github.com/steventroughtonsmith/lua-xclangspec https://github.com/steventroughtonsmith/lua-xclangspec
## Install 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.
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.
You can check your UUID with this command: You can check your UUID with this command:
```sh ```sh
$ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID $ defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID
``` ```
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`

View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>commentSyntaxes</key>
<array>
<dict>
<key>prefix</key>
<string>/*</string>
<key>suffix</key>
<string>*/</string>
</dict>
<dict>
<key>prefix</key>
<string>//</string>
</dict>
</array>
<key>conformsToLanguageIdentifiers</key>
<array>
<string>Xcode.SourceCodeLanguage.Generic</string>
</array>
<key>fileDataTypeIdentifiers</key>
<array>
<string>public.rust-source</string>
</array>
<key>identifier</key>
<string>Xcode.SourceCodeLanguage.Rust</string>
<key>isHidden</key>
<false/>
<key>languageName</key>
<string>Rust</string>
<key>languageSpecification</key>
<string>xcode.lang.rust</string>
<key>supportsIndentation</key>
<true/>
<key>allowWhitespaceTrimming</key>
<true/>
<key>requiresHardTabs</key>
<false/>
<key>indentationTriggers</key>
<array>
<string>{</string>
<string>}</string>
</array>
</dict>
</plist>

34
setup.sh Executable file
View File

@@ -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"