Commit Graph

1873 Commits (c73b18be77ca73e461a991bf8d30a8c5f95af597)

Author SHA1 Message Date
Yuya Nishihara d04a7cd78b Move diffing job to worker thread instead of printing loop
The scoped thread API allows this change, and I think it's slightly easier
to follow. We can also remove the AtomicBool.
2023-12-07 08:37:42 +07:00
Yuya Nishihara 44578368ab Use scoped thread API in directory diff frontend
Just a code cleanup. As the minimum Rust version is now 1.63.0, we don't need
to manage the spawned thread manually.
2023-12-07 08:37:42 +07:00
Wilfred Hughes 4b0fff2d19 cargo fmt 2023-12-05 08:28:37 +07:00
Rodolphe Blancho e18b5d0712
Merge branch 'master' into feature/salesforce_apex_support 2023-12-05 12:31:59 +07:00
Wilfred Hughes e01b2f9f83 Fix a clippy warning about nested ifs 2023-11-28 13:29:33 +07:00
Wilfred Hughes cac80e992a Avoid `res` locals in favour of more meaningful names 2023-11-28 13:27:27 +07:00
Wilfred Hughes 2adb2f8531 Include rustc version in --version output
Fixes #554
2023-11-28 13:07:33 +07:00
Wilfred Hughes 569f0038d1 Always filter blank lines at start and end in positions
Fixes #595
2023-11-28 12:35:28 +07:00
Wilfred Hughes d89d057345 Clarify parameter name 2023-11-28 11:57:11 +07:00
Wilfred Hughes 08853fa9b6 Clarify comment 2023-11-28 11:34:45 +07:00
Wilfred Hughes e96c9463a0 Fix typo 2023-11-28 11:15:11 +07:00
Wilfred Hughes f31106fddd Fix capitalisation in display name for SCSS 2023-11-24 19:42:16 +07:00
Wilfred Hughes 3e5783c2a7 Treat --sort-paths as a flag option 2023-11-24 01:11:26 +07:00
Nimrod Kor e9a8fda9cb
Skip dirs specified in gitignore (#574)
Take ignored dirs into consideration when calculating diff

Co-authored-by: Nimrod <nimrod@getbaz.com>
2023-11-24 00:48:55 +07:00
Milan Damen a8d6253509
Sort by path before outputting directory diff so that the order is always the same (#593)
* Sort by path before outputting directory diff so that the order is always the same

* Added feature flag --sort-paths (DFT_SORT_PATHS) to enable/disable sorting paths when diffing directory (default disabled)
2023-11-20 10:24:35 +07:00
Wilfred Hughes 1ec868e1df Update to latest line-numbers 2023-11-19 13:11:07 +07:00
Wilfred Hughes 1dbcd08a90 cargo fmt 2023-11-19 13:10:41 +07:00
Wilfred Hughes 8fd79c2885 Remove unused content length calculations 2023-11-18 17:31:40 +07:00
Wilfred Hughes fe62cf4cf5 Don't ignore novel blank lines
Fixes #575
2023-11-18 17:27:41 +07:00
Wilfred Hughes 1138a4623d Remove unused commit_hash struct field 2023-11-18 16:46:13 +07:00
Wilfred Hughes 4c387e4cfe Remove unused struct field 2023-11-18 16:46:13 +07:00
Wilfred Hughes f2b3b34bec Use pub(crate) everywhere for visibility
This isn't strictly necessary since difftastic is a binary-only
crate. However, it improves compiler warnings (see next commit) and
potentially helps future changes to make difftastic available as a
library.
2023-11-18 16:46:13 +07:00
Wilfred Hughes 60d0f61cbd Define a separate words module 2023-11-18 16:46:13 +07:00
Wilfred Hughes 635e62c19b Support .snap files
Closes #571
2023-11-18 14:50:54 +07:00
Wilfred Hughes 2e415f687d cargo fmt 2023-11-11 20:57:41 +07:00
Wilfred Hughes 142144e484 Clarify doc comment 2023-11-11 11:16:52 +07:00
Wilfred Hughes 27b14ae4c7 Clarify probably_punctuation 2023-11-11 11:14:49 +07:00
Wilfred Hughes 7321f663dc Enable some more clippy warnings 2023-11-11 10:48:22 +07:00
Wilfred Hughes 848984d482 Silence some clippy warnings 2023-11-11 10:47:26 +07:00
Wilfred Hughes 778a6bee9a Flatten nullable types in Kotlin
Workaround for #589 and #411
2023-10-26 08:56:37 +07:00
Wilfred Hughes 21ed3ec48b Add missing environment variable for --skip-unchanged
Fixes #581
2023-10-13 08:41:38 +07:00
Wilfred Hughes dfe48a29e1 Format bytes counts in logging in a human-friendly manner 2023-10-11 20:30:01 +07:00
Wilfred Hughes 81714c17ce
Merge pull request #573 from brneor/scss
Add Scss parser
2023-10-11 08:57:58 +07:00
Rodolphe Blancho 5256d9c98e Merge branch 'master' into feature/salesforce_apex_support 2023-10-11 09:56:51 +07:00
Wilfred Hughes 67dbf0e962 Add --strip-cr
Closes #486
2023-10-10 08:36:57 +07:00
Rodolphe Blancho 05d78ca741 add support for Salesforce Apex
Apex Language documentation:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dev_guide.htm

Uses https://github.com/aheber/tree-sitter-sfapex
2023-10-06 11:08:02 +07:00
Wilfred Hughes 992437db1d Show the language name when parsing fails 2023-09-28 00:33:49 +07:00
Wilfred Hughes 40403b2b8f Pass lang_conf with language so they're Some/None together 2023-09-27 23:51:45 +07:00
Wilfred Hughes 00f7ef8522 Improve variable name 2023-09-27 15:49:57 +07:00
Breno Reis 1bffcf4e2b
add support for SCSS 2023-09-20 14:26:43 +07:00
Wilfred Hughes aeb974ba7e Add TODO 2023-09-15 16:06:44 +07:00
Wilfred Hughes 6dd0c70767 Add TODO 2023-09-12 13:05:05 +07:00
Wilfred Hughes 1e7866b64e Do word diffing on text too 2023-09-12 13:03:27 +07:00
Wilfred Hughes 243a4a5f48 Group imports consistently
This corresponds to:

$ cargo +nightly fmt -- --config group_imports=StdExternalCrate

Since this option is only available on nightly, I'm not adding a
rustfmt.toml to enforce this, just doing it as a one-off run.
2023-09-12 12:32:51 +07:00
Wilfred Hughes 8731a1b908 Fix rustdoc warnings 2023-09-12 12:21:43 +07:00
Wilfred Hughes f3ba79f34d Qualify all difftastic imports with crate:: 2023-09-12 12:17:58 +07:00
Wilfred Hughes f06c611ed7 More XML file patterns 2023-09-09 10:18:11 +07:00
Wilfred Hughes d6fe1221a4 Add *.ui to the XML file extensions 2023-09-09 10:07:11 +07:00
Wilfred Hughes 577bb99228 Treat XSLT as XML 2023-09-09 00:12:22 +07:00
Wilfred Hughes 004a0da67f Flatten modifiers in C# to improve highlighting 2023-09-08 23:44:11 +07:00
Wilfred Hughes 9134593a39 Add XML support
Fixes #10
2023-09-08 23:43:20 +07:00
Wilfred Hughes d56f775f31 Highlight constructors consistently with type names 2023-09-03 01:30:22 +07:00
Wilfred Hughes a4ee2cf99e cargo fmt 2023-08-26 21:41:41 +07:00
Wilfred Hughes b78ba2da4b Use type names from line_numbers directly 2023-08-26 20:36:07 +07:00
Wilfred Hughes 41c9165c79 Use my line_numbers crate for newline position calculations 2023-08-26 16:25:32 +07:00
Wilfred Hughes ca44de78e1 Group overrides from the same language together
No functional change, but makes --list-languages easier to read.

Fixes #549
2023-08-25 08:22:28 +07:00
Wilfred Hughes 0db99d76c6 Allow a language override to include multiple globs 2023-08-24 08:47:59 +07:00
eth3lbert b6d8ecbd4f
feat: display commit info in --version (#558)
This improves --version output for #554.
2023-08-18 08:10:47 +07:00
Wilfred Hughes 803a3a673c Improve variable names 2023-08-18 00:28:17 +07:00
Alex Krantz 11a96e5aec Add JSON cli flag 2023-08-17 08:49:59 +07:00
Wilfred Hughes 11f457b5f9 Fix typo 2023-08-16 21:20:17 +07:00
Wilfred Hughes 191f42e9d5 Clippy fixes 2023-08-15 21:42:06 +07:00
Wilfred Hughes 6b1c82efdf Prefer Option<&T> over &Option<T> 2023-08-15 21:37:41 +07:00
Wilfred Hughes a43b9ae9eb Dim the extra information section in hunks 2023-08-15 21:33:11 +07:00
Wilfred Hughes e1f97e614f Improve wording of conflict information
Fixes #555
2023-08-15 17:52:02 +07:00
Wilfred Hughes e0a1405453 Add the ability to parse conflict markers and diff the two files 2023-08-15 09:01:15 +07:00
Wilfred Hughes f06e95ca02 Renamed `old_path` to `extra_info` and format it during option parsing
This allows us to use this field for other purposes that aren't
renames.
2023-08-14 08:41:42 +07:00
Wilfred Hughes f1ba399504 Move local variable closer to first use 2023-08-14 08:27:42 +07:00
Wilfred Hughes eeb2974967 Move option parsing before argument parsing
This is useful for additional mode parsing that wants to access these
options.
2023-08-13 21:34:42 +07:00
Wilfred Hughes 1c60f3efd3 Move content detection out of diff_file_content
This makes the function useful in cases when we already have a string,
not bytes.
2023-08-13 21:31:37 +07:00
Wilfred Hughes 3c702d0490 Use humansize for file size formatting 2023-08-12 22:34:11 +07:00
Wilfred Hughes 5f25bc0ebd Rename information in header should only be shown on first hunk
Fixes #553
2023-08-11 08:21:29 +07:00
Wilfred Hughes a187d7a134 Improve rename styling
It should use the heading with colour, consistent with other modes,
and the header should come before rename information.
2023-08-08 08:53:33 +07:00
Wilfred Hughes ba92a93f9b Fix rustc warning on recent nightly 2023-08-04 23:31:31 +07:00
Wilfred Hughes 19cbf1d458 Implement some other useful traits on EqOnFirstItem
These aren't immediately used, but they're handy for experimenting
with the similar library which requires these.
2023-08-04 23:29:29 +07:00
Wilfred Hughes 892d4fdb58 Ensure size_hint never exceeds graph_limit
If we have thousands of syntax nodes on both sides, we can end
up attempting to preallocate a very large hashmap.

In #542, a user hit an issue with two JSON files where the LHS had
33,000 syntax nodes and the RHS had 34,000 nodes, so we'd attempt to
preallocate a hashmap of capacity 1,122,000,000. This required
allocating 70,866,960,400 bytes (roughly 66 GiB).

Impose a sensible limit on the hashmap.

Fixes #542
2023-08-04 17:19:27 +07:00
Wilfred Hughes c937f819a1 Log the number of bytes in the arena at the end of route finding 2023-08-04 17:04:23 +07:00
Wilfred Hughes 0c01c73398 Be consistent in lifetime names for Vertex 2023-08-03 08:32:16 +07:00
Wilfred Hughes 757c297412 Adjust header style
Show the hunk count and detected language in a dimmed style. This
information is less important than the diff content itself, so this
change makes the important information more prominent.

First part of #544
2023-07-31 08:35:27 +07:00
Wilfred Hughes 797af40ae8 Improve Java highlighting 2023-07-27 08:33:38 +07:00
Wilfred Hughes 4e9637c861 Check more bytes when detecting encoding
I've observed PDF files that have sufficiently large headers that they
were detected as text, which wasn't helpful.

Also improve logging to report how many invalid bytes were found.
2023-07-21 08:34:41 +07:00
Wilfred Hughes 4f750ec359 Clarify how to find language names in argument help 2023-07-21 08:23:36 +07:00
Wilfred Hughes 685a2ef8d5 Merge remote-tracking branch 'grunweg/master' 2023-07-20 22:41:56 +07:00
Wilfred Hughes 7caaaf7fcf Handle nested sliders correctly when preferring the outer delimiter
Previously we didn't check the state of children, which was an
oversight from the original implementation. As a result, we fixed
nested sliders in fewer situations.

Fixes #535
2023-07-14 08:49:55 +07:00
Wilfred Hughes a5d3cb55b7 Treat constructors consistently with variables in Haskell atoms 2023-07-12 17:34:42 +07:00
Wilfred Hughes 8614910fe2 cargo fmt 2023-07-12 16:45:58 +07:00
Wilfred Hughes f6ceb2aefd Update unit test new subword highlighting heuristic 2023-07-12 12:48:45 +07:00
Wilfred Hughes 5606c04261 Treat qualified modules and variables as atoms in Haskell 2023-07-12 12:34:39 +07:00
Wilfred Hughes a814e01d22 Improve word diffing heuristic and add another sample file 2023-07-12 12:12:32 +07:00
Wilfred Hughes 1d3b6836ef Handle multiline atoms more accurately in split_atom_words 2023-07-12 11:49:39 +07:00
Wilfred Hughes c2b7042b80 Do subword highlighting in more cases
This is useful when two strings substantially differ, but have the
same e.g. end.
2023-07-10 21:26:24 +07:00
Wilfred Hughes 5824322244 Require some common words to do subword highlighting
This is important when comparing short string literals. This change
has improved several cases in sample_files/ but I've added a new
example that made the previous unwanted behaviour much more obvious.
2023-07-10 09:03:21 +07:00
Wilfred Hughes 4aca79f220 Use the raw_entry_mut API on hashbrown::HashMap
This saves us searching the hash map twice. This is a modest
performance improvement: an instruction count reduction of 4% on
slow_before.rs, and 1% reduction on typing_before.ml.
2023-07-09 22:49:37 +07:00
Wilfred Hughes 8eb949eb02 Use DftHashMap everywhere
This is a 4% reduction in instructions for typing_before.ml, but a
0.2% increase instructions for slow_before.rs. This seems like a win
overall, and it also keeps the codebase more consistent and simpler.
2023-07-09 15:41:01 +07:00
Wilfred Hughes d9911e0b49 Move DftHashMap to a separate file 2023-07-09 15:37:51 +07:00
Wilfred Hughes f2456a12b2 Use hashbrown for the alloc_if_new data
This was intended to allow usage of .entry_ref(), but it's already a
performance win without using that API! It's around a 9% reduction in
instructions in slow_before.rs, and 2% reduction in typing_before.ml.
2023-07-09 11:11:03 +07:00
Wilfred Hughes 27f59c0b3a Don't treat - as a word constituent
This produces slightly better results with some string replacements.
2023-07-08 17:16:14 +07:00
Wilfred Hughes 2607d17d73 Fix spelling in comment 2023-07-08 17:16:14 +07:00
Zhenge Chen ffd49d523a Detect replaced strings
If a string is replaced with another, apply subword highlighting
similar to how we handle replaced comments.

Co-authored-by: Wilfred Hughes <me@wilfred.me.uk>
2023-07-08 17:16:06 +07:00
Wilfred Hughes f86ba13abf Increase punctuation cost to 200 2023-07-08 14:59:47 +07:00
Wilfred Hughes 495dbe5b14 Improve comments in Edge::cost 2023-07-08 14:53:33 +07:00
Wilfred Hughes 574fb5bd50 Fix clippy lint 2023-07-07 23:52:51 +07:00
Wilfred Hughes 53855e415e Reduce copying further in set_neighbours
This saves a remarkable 8.5% of instructions on slow_before.rs.
2023-07-07 23:37:16 +07:00
Wilfred Hughes a180fd6d24 Don't return the neighbours inside get_set_neighbours
This caused unnecessarying closing, costing 0.2% instructions in some
cases, and also made the code less readable.
2023-07-07 23:29:51 +07:00
Wilfred Hughes 87d27c5598 Only split numbers inside comments
Inside text files, it seems to be better to be conservative and
consider abc123def as one word rather than three.

This is noticeable when looking at changes to the compare.expected
file, which contains hashes. 123c456 and 345c789 don't really have a
`c` in common, so subword highlighting is ugly.
2023-07-07 08:40:06 +07:00
Wilfred Hughes c07e640b24 Remove contiguous penalty
The contiguous penalty was an attempt to fix the slider problem:

// Old
A B
C D

// New
A B
A B
C D

// Unwanted diff
A +B+
+A+ B
C D

However, it doesn't make sense for Dijkstra, which is stateless. The
best route from vertex X is independent of how we got to vertex X.

This worked by dumb luck: in some circumstances we terminate early
rather than fully executing Dijkstra's algorithm. This cost tweak
improved results on a few test files. However, the post-processing
slider logic is a proper, general solution. This was added much later.

There's no reason to keep the contiguous penalty now. It's confusing,
and makes adding new edge costs with consistent 'X costs more than Y'
behaviours more difficult.

Performance is essentially neutral: a small decrease in
typing_before.ml, a small increase in slow_before.rs.
2023-07-06 08:37:02 +07:00
Wilfred Hughes 31df177881 Increase the punctuation penalty
This ensures that choosing a unchanged non-punctuation atom with some
novel atoms is better than choosing punctuation and some changed
comments. This produces better results in general, see
comma_and_comment_after.js for an example.

This will be more noticeable after the next commit, where costs of
novel atoms are in a smaller range of values.
2023-07-06 08:16:24 +07:00
Wilfred Hughes c3016eca4a Add TODO 2023-07-06 08:14:03 +07:00
Wilfred Hughes 43c24047b4 Don't track contiguous status on novel delimiter edges
This is harder to reason about, and
2e6666041f did not include a motivating
test case.

Removing contiguous status is a minor perf improvement (2% reduction
in instructions), makes the code simpler, and does not significantly
affect diffing results.

Of the two sample files that have changed, the erlang_before.erl file
has improved and nest_before.rs is neutral.
2023-07-04 23:53:16 +07:00
Wilfred Hughes 1e4d1828c7 Store probably_punctuation on unchanged edges
This is equivalent (increased cost on unchanged nodes vs decreased
cost on changed nodes), but easier to reason about.

Previously we have multiple notions of changed atoms: NovelAtomLHS,
NovelAtomRHS, and ReplacedComment. We want to consider punctuation as
less desirable even when e.g. comments arereplaced.
2023-07-03 19:48:31 +07:00
Wilfred Hughes c405b58327 Fix cost for ReplacedComment
This needs to be 2x novel nodes, or we prefer it far too often.
2023-07-02 23:12:31 +07:00
Wilfred Hughes 3730580ca3 Improve word splitting heuristics
This is particularly noticeable when diffing comments with timestamps
2000-12-31T23:59:59 where we don't want 31T23 to be a single word.
2023-06-29 08:33:30 +07:00
Wilfred Hughes 9eb48ca661 Configure comments as atoms in latest scala parser 2023-06-12 22:28:01 +07:00
Wilfred Hughes 81ac9d167b cargo fmt 2023-06-02 08:45:21 +07:00
Gao, Xiang 653660e92f
Treat CUDA as C++ (#522) 2023-05-27 12:30:46 +07:00
Wilfred Hughes b0a3a0ada9 Use DFT_LOG as the internal logging environment variable
Fixes #519
2023-05-21 23:33:34 +07:00
Wilfred Hughes b6895d42e4 Document the --override option in CHANGELOG and --help
This also enables users to disable language parsing.
Closes #439
Closes #440
2023-05-15 23:04:20 +07:00
Wilfred Hughes 745253d4d9 cargo fmt 2023-05-15 21:49:07 +07:00
Wilfred Hughes f302952748 Add unit test for overrides 2023-05-15 17:54:23 +07:00
Wilfred Hughes 325926eead Update tests for overrides argument 2023-05-15 17:51:39 +07:00
Wilfred Hughes 943a9e91f1 Fully document --override 2023-05-15 08:53:34 +07:00
Wilfred Hughes c9cabac517 Allow overriding language associations from numbered environment variables 2023-05-15 08:43:53 +07:00
Wilfred Hughes b3a7bec430 Pass overrides to guess() and display them in --list-languages 2023-05-15 08:20:32 +07:00
Wilfred Hughes 0e2c167dda Move LanguageOverride to guess_language 2023-05-14 21:49:59 +07:00
Wilfred Hughes adff907aaa Pass language_overrides to all modes 2023-05-14 21:46:54 +07:00
Wilfred Hughes 47a0690286 Initial support for parsing --override 2023-05-14 21:44:30 +07:00
Wilfred Hughes 84af470128 Remove --language 2023-05-14 15:57:43 +07:00
Wilfred Hughes 05a1b184ea Use globbing to match file names in language detection 2023-05-14 15:50:56 +07:00
Wilfred Hughes 893b56b6b1 Consistent casing 2023-05-14 00:56:45 +07:00
Wilfred Hughes e37a6b2087 Improve naming and ordering of JSX/TSX languages 2023-05-14 00:54:58 +07:00
Wilfred Hughes 4d85b5c15e Prefer pattern matching and EnumIter for Language rather than lists 2023-05-13 23:46:18 +07:00
Wilfred Hughes 1f16d207f6 Clarify comment 2023-05-13 23:15:26 +07:00
Mike Grunweg 7984b7a59e Audit node types with children: none should be treated as atoms. 2023-05-05 22:45:53 +07:00
Mike Grunweg 2c2461667b Configure parsing and language detection. 2023-05-05 22:00:15 +07:00
Wilfred Hughes 87f19f5e10 Don't including trailing newlines in comment nodes
This makes constructing hunks harder to reason about.

This change doesn't affect output, but helps when debugging, as it
makes multiline atoms much less common.
2023-04-30 09:51:39 +07:00
Wilfred Hughes b5cc0787f4 Clarify debug printing of LineNumber 2023-04-30 09:29:08 +07:00
Wilfred Hughes faaec9ad4c Use the SyntaxId type explicitly in ChangeMap 2023-04-22 19:59:03 +07:00
Wilfred Hughes 8d44e91a06 Improve lifetime names 2023-04-22 15:25:45 +07:00
Wilfred Hughes d521b29c9e set_prev_sibling should always recurse 2023-04-20 08:42:10 +07:00
Wilfred Hughes 2074b97117 Fix clippy lint 2023-04-19 20:34:33 +07:00
Wilfred Hughes 18ef47e20d Use a path separator constant that is available on Rust 1.57 2023-04-19 20:04:56 +07:00
Wilfred Hughes f08e77a675 Prefer a single optional string for old_name when renames occur 2023-04-15 17:20:30 +07:00
Wilfred Hughes 6f9ccd9ec4 Use a single display_path field in the diff options struct 2023-04-15 17:19:56 +07:00
Wilfred Hughes 2224602ad5 Store file renames explicitly in Diff struct 2023-04-15 00:57:27 +07:00
Valentin 4296796053 Run cargo fmt 2023-04-06 09:44:38 +07:00
Valentin b86d4dbf9e Add solidity support 2023-04-05 11:12:19 +07:00
Wilfred Hughes 8c004be87b Remove unnecessary helper function 2023-04-02 19:28:57 +07:00
Wilfred Hughes cb9367c129 Remove tests that no longer apply after 8b842387a 2023-03-31 08:19:23 +07:00
Wilfred Hughes 45121f6f6d Fix clippy warnings 2023-03-31 08:15:18 +07:00
Wilfred Hughes 8b842387a1 Don't clean trailing newline before diffing
Difftastic should take the user's input as-is, or it risks performing
an incorrect diff in both textual and syntactic diffing.

Fixes #499
2023-03-30 08:46:11 +07:00
Wilfred Hughes 713220613e Support diffing directories where files are only in one side
This was broken in 1e9f43768. Add test.

Fixes #500
2023-03-24 23:57:49 +07:00
Wilfred Hughes 1e9f437688 Remove --missing-as-empty 2023-03-17 08:40:21 +07:00
Wilfred Hughes e4ff6d7d09 Update atom nodes for latest Java 2023-03-17 00:42:19 +07:00
Wilfred Hughes 69e511e638 Tweak UTF-16 heuristics to prefer files with a BOM 2023-03-16 00:46:24 +07:00
Wilfred Hughes 7fbe0d6c2f Improve UTF-16 detection heuristics and add test 2023-03-16 00:31:58 +07:00
Wilfred Hughes 20ad284882 Add 'vendored_parsers/tree-sitter-clojure/' from commit '421546c2547c74d1d9a0d8c296c412071d37e7ca'
Closes #448

git-subtree-dir: vendored_parsers/tree-sitter-clojure
git-subtree-mainline: ebfc043a4a
git-subtree-split: 421546c254
2023-03-15 15:43:55 +07:00
Wilfred Hughes a67be0f845 Treat quoted_keys as atoms in TOML 2023-03-15 15:12:33 +07:00
Wilfred Hughes ec6e4665bc
Merge pull request #494 from karlding/add_ada_support
Add Ada support
2023-03-15 10:25:46 +07:00
Karl Ding 01522a9d58 Remove alire.toml from LANG_FILE_NAMES
Fix an incorrect assumption about how LANG_FILE_NAMES works.

We want the alire.toml file to still be treated as TOML (and not Ada),
so adding an entry here is not necessary for Ada support.
2023-03-15 01:09:48 +07:00
Wilfred Hughes 6ad77c620c Don't highlight text in purple
Closes #498
2023-03-14 23:47:17 +07:00
Karl Ding d5ed2deb6e Run formatter over changes 2023-03-14 21:46:40 +07:00
Karl Ding 5271f65f92 Add language support for Ada
Implement support in difftastic for the Ada programming language
using the treesitter grammar provided in 'briot/tree-sitter-ada'.

Language detection depends on the following suffixes:

    * adb
    * ads
    * ada

The presence of the alire TOML file (alire.toml) is also used as
a heuristic.
2023-03-14 21:46:40 +07:00
Stavros Korokithakis 85b9493eaa
Recognize the Arduino extension as C++ 2023-03-13 19:44:46 +07:00
Wilfred Hughes c7bfc72529 Clarify --exit-code behaviour on plain text 2023-03-09 08:54:21 +07:00
Wilfred Hughes ac35c6c047 Document the different options for --display
Fixes #491
2023-03-09 08:54:21 +07:00
Wilfred Hughes 2d1a2c906e Count errors on the root node too
Fixes #377
2023-03-03 00:25:41 +07:00
Wilfred Hughes 045d6a2c58 Treat Newick and Racket as lisps 2023-03-03 00:23:11 +07:00
Wilfred Hughes 03985066f5 Treat Makefile text as atoms
Improves another case identified in #476
2023-03-02 23:52:01 +07:00
Wilfred Hughes 54eb22ea98 Use FileFormat consistently everywhere 2023-03-02 22:25:14 +07:00
Wilfred Hughes dae8c8a3b5 Update parameter names for type 2023-03-02 22:01:13 +07:00
Wilfred Hughes 133c05e46b Define an explicit enum for file formats 2023-03-02 21:58:33 +07:00
Wilfred Hughes c33d7f2520 Support --check-only on text files too 2023-03-02 08:50:45 +07:00
Wilfred Hughes ca2902cee2 Add more doc comments to FileContent 2023-03-02 08:35:45 +07:00
Wilfred Hughes e99b2ce27c Represent byte limit and parse error limit as Result return types 2023-02-24 08:38:15 +07:00
Wilfred Hughes 9556cd978e Merge branch 'delehef/master' 2023-02-21 08:46:07 +07:00
6cdh 5e659e2d98 add racket highlight 2023-02-21 08:30:00 +07:00
Franklin Delehelle a0b9df0e29
Add support for Newick tree files 2023-02-16 15:52:16 +07:00
6cdh 2fade3e0bf fix here string 2023-02-12 13:57:45 +07:00
6cdh fe756905bf added Racket support 2023-02-12 13:39:58 +07:00
Wilfred Hughes 96fc044e6d Improve syntax highlighting
`@include` and `@exception` are both used for highlighting keywords in
several languages.
2023-02-10 08:50:43 +07:00
Wilfred Hughes 62da0d56cc Fix error message 2023-02-05 22:43:58 +07:00
Wilfred Hughes 952d55ee22 Don't bother logging parse errors 2023-02-05 22:03:08 +07:00
Wilfred Hughes 96a80c4d21 Improve naming for parse error limit 2023-02-05 17:30:24 +07:00
Wilfred Hughes 63cf71641a Display file size in the header if it's too big 2023-02-05 17:28:39 +07:00
Wilfred Hughes 7d5afd78dc Respect --error-limit when parsing
Next step for #472
2023-02-04 22:29:18 +07:00
Wilfred Hughes 7ec0c2a956 Remove unnecessary concat! calls 2023-02-04 22:02:28 +07:00
Wilfred Hughes 553a1ef231 Count error nodes when walking tree-sitter tree
First steps of #472
2023-02-04 16:46:17 +07:00
Wilfred Hughes f77730005e Add clarifying comment 2023-02-04 14:09:30 +07:00
Wilfred Hughes 34f21c6d9f Only run the gzip test on Linux CI
This test fails when a MIME database isn't present, such as the
Windows CI environment or minimal environments (reported in #478).
2023-02-04 11:14:46 +07:00
Wilfred Hughes ed0f50fa68 Remove --error-limit to prepare for release 2023-02-02 22:22:23 +07:00
Wilfred Hughes b6e756ed1a
Merge pull request #473 from Miksu82/master
Fix file content type detection for small gzipped files
2023-02-02 22:18:59 +07:00
Wilfred Hughes b78067a96b Disable unfinished error_limit logic to prepare for release 2023-02-02 22:11:31 +07:00
Mika Ristimäki 926055634c Remove application/octet-stream check when checking mime type 2023-02-02 11:08:24 +07:00
Niklas Vogel abdef09bdd Check arguments passed from Git for `/dev/null` 2023-02-01 17:53:16 +07:00
Mika Ristimäki c573094ee5 Make sure gzip files are treated as binary 2023-02-01 11:01:26 +07:00
Mika Ristimäki 289632afcc Fix formatting 2023-02-01 10:20:47 +07:00
Mika Ristimäki bb81f0e524 Fix file content type detection for small gzipped files 2023-02-01 10:20:47 +07:00
Wilfred Hughes 92d21dc5c0 Silence another clippy lint 2023-01-30 08:35:24 +07:00
Wilfred Hughes 8e1503a11d Add an --error-limit CLI option
Starts #472.
2023-01-26 23:55:41 +07:00
Wilfred Hughes cc3f266969 Treat `%in%` as a single atom in R 2023-01-26 22:40:10 +07:00