diff --git a/Edit/Chime.docc/AddLanguage.md b/Edit/Chime.docc/AddLanguage.md index 0298c02..44e930d 100644 --- a/Edit/Chime.docc/AddLanguage.md +++ b/Edit/Chime.docc/AddLanguage.md @@ -14,7 +14,7 @@ Chime relies heavily internally on [UTIs](https://developer.apple.com/documentat mdls path/to/your/file ``` -These UTIs should first be encorporated into [ChimeKit](https://github.com/ChimeHQ/ChimeKit). From there, they can be added as "Imported Type Identifiers" in Chime's Info.plist. To do this, you'll need to know the file extensions used. ChimeKit also supports well-known file names, like `Makefile`, which the Uniform Type Identifier APIs do not currently support. +These UTIs should first be incorporated into [ChimeKit](https://github.com/ChimeHQ/ChimeKit). From there, they can be added as "Imported Type Identifiers" in Chime's Info.plist. To do this, you'll need to know the file extensions used. ChimeKit also supports well-known file names, like `Makefile`, which the Uniform Type Identifier APIs do not currently support. ## Tree-Sitter @@ -22,17 +22,17 @@ These UTIs should first be encorporated into [ChimeKit](https://github.com/Chime The easiest path to supporting the language syntax is to use Chime's tree-sitter support. Once the parser supports SPM, to incorporate it you must: -- Add the SPM package to the main project -- Add the library as a dependency to `EditKit` and link it there +- Add the SPM package to the `TreeSitterParsers` target of the `Dependencies` local package +- Modify `Dependencies/Sources/TreeSitterParsers/TreeSitterParsers` to re-export the parser symbols - Include the library module name in `NonSwiftWorkaround.xcconfig` to address an Xcode bug -- Import the module into `LanguageProfile+Profiles.swift` -- Add new static property to `LanguageProfile` for the language, and match its UTI +- Add new static property to `LanguageProfile` for the language +- Match the language UTI and return it in `LanguageProfile.profile(for:)` Chime also needs to locate the correct tree-sitter query definitions to perform highlighting and embedded language detection. This will be done automatically if the parser SPM package includes queries. ### Embedding Queries -Even if a parser package includes queries, they should be copied into a dedicated directory within `Resources/LanguageData`. This will make it possible for them to be loaded by the Spotlight Preview extension. +Even if a parser package includes queries, they should be copied into a dedicated directory within `Resources/LanguageData`. This will make it possible for them to be loaded by the Quick Look Preview extension. This duplication is not ideal, but I have not yet been able to find a workaround. You might also be tempted to adjust these queries. Try to resist this temptation and instead fix the queries within their own projects.