Add an entry to `tree_sitter_parser.rs` for your language.为你的语言在`tree_sitter_parser.rs`中增加一个条目。
为你的语言在`tree_sitter_parser.rs`中增加一个条目。
```
Json => {
@ -64,64 +56,46 @@ Json => {
}
```
`name` is the human-readable name shown in the UI.`name`是用户节目中显示的可读名称。
`name`是用户节目中显示的可读名称。
`atom_nodes` is a list of tree-sitter node names that should be
treated as atoms even though the nodes have children. This is common
for things like string literals or interpolated strings, where the
node might have children for the opening and closing quote.`atom_nodes`是一个树形节点名称的列表,这些节点应被视为原子。即使这些节点有子节点,也应被视为原子。这对于字符串表面之或插值字符串非常常见的,因为在这种情况下,节点可能有用来表示开头和结尾的引用号。
is a useful source of common file extensions.也可能有与你的语言相关的文件名或shebangs。[GitHub的语言定义](https://github.com/github/linguist/blob/master/lib/linguist/languages.yml)是针对常见文件扩展名的一个有用来源。
Difftastic's internal docs are not available on docs.rs, as it [does
not support binary crates today](https://difftastic.wilfred.me.uk/rustdoc/difft/).Difftastic的内部文档在docs.rs上没有提供,因为它[不支持二进制工具箱](https://difftastic.wilfred.me.uk/rustdoc/difft/)。
tools](https://git-scm.com/docs/diff-config#Documentation/diff-config.txt-diffexternal). You
can use `GIT_EXTERNAL_DIFF` for a one-off git command.Git[支持使用外部的diff工具](https://git-scm.com/docs/diff-config#Documentation/diff-config.txt-diffexternal)。你可以使用`GIT_EXTERNEL_DIFF`来进行一键git命令。
@ -32,12 +28,9 @@ $ git show e96a7241760319 --ext-diff
## git-difftool
[git difftool](https://git-scm.com/docs/git-difftool) is a git command
for viewing the current changes with a different diff tool. It's
useful if you want to use difftastic occasionally.[git difftool](https://git-scm.com/docs/git-difftool) 是一款使用不同diff工具来查看当前修改的git命令。如果你想要偶尔使用Difftastic的话,这将会非常有用。
## Installing via homebrew (on macOS or Linux)通过homebrew安装(在macos或者Linux平台)
## 通过homebrew安装(在macos或者Linux平台)
Difftastic can be installed with [Homebrew](https://formulae.brew.sh/formula/difftastic) on macOS or Linux.Difftastic可以用[Homebrew](https://formulae.brew.sh/formula/difftastic)安装在macOS或Linux上。
You will also need a C++ compiler that supports C++14. If you're using
GCC, you need at least version 8.同时你也需要一个支持C++14的C++编译器。如果你正在使用GCC,则GCC版本至少为8。
同时你也需要一个支持C++14的C++编译器。如果你正在使用GCC,则GCC版本至少为8。
### Build编译
You can download and build [difftastic on
crates.io](https://crates.io/crates/difftastic) with Cargo (which is
part of Rust).你可以下载并通过Cargo(它是Rust的一部分)来编译[difftastic on
你可以下载并通过Cargo(它是Rust的一部分)来编译[difftastic on
crates.io](https://crates.io/crates/difftastic) 。
```
$ cargo install difftastic
```
Difftastic uses the `cc` crate for building C/C++ dependencies. This
allows you to use environment variables `CC` and `CXX` to control the
compiler used (see [the cc
docs](https://github.com/alexcrichton/cc-rs#external-configuration-via-environment-variables)). Difftastic使用`cc`程序箱来构建C/C++的依赖关系。这使得你可以通过环境变量`CC`和`CXX`来控制使用的编译器(参照see [the cc
Difftastic使用`cc`程序箱来构建C/C++的依赖关系。这使得你可以通过环境变量`CC`和`CXX`来控制使用的编译器(参照see [the cc
specification](https://specifications.freedesktop.org/shared-mime-info-spec/0.11/ar01s03.html). The
database should be at one of the following paths:MIME数据库的路径[是在XDG的规定下](https://specifications.freedesktop.org/shared-mime-info-spec/0.11/ar01s03.html):
records which features and bug fixes are in each version. 该说明书会表明当前版本DFT_VERSION_HERE。[变更记录](https://github.com/Wilfred/difftastic/blob/master/CHANGELOG.md)会记录每个版本的特性增加和bug的修复。
@ -50,15 +43,10 @@ A line-oriented diff does a much worse job here.如果是以前那种面对行
</code>
</pre>
Some textual diff tools also highlight word changes (e.g. GitHub or
git's `--word-diff`). They still don't understand the code
though. Difftastic will always find matched delimiters: you can see
the closing `)` from `or_else` has been highlighted. 一些文本差异分析工具也会突出单词的变化(例如GitHub或者是git的`--word-diff`),但是它们无法做到理解代码本身。Difftastic永远会找到匹配的定界符:你可以看到`or_else`结尾出的`)`已经被突出显示。
-- mirrored under a CC BY-NC license) are great resources. 如果你对学术文献的摘要感兴趣,[这个帖子](http://useless-factor.blogspot.com/2008/01/matching-diffing-and-merging-xml.html)(和它[附带的论文](http://useless-factor.blogspot.com/2008/01/matching-diffing-and-merging-xml.html)--在CC BY-NC的许可下可以被复制)将是一个很好的资源。