Commit Graph

324 Commits

Author SHA1 Message Date
lubinglun f4d606ed72 Add GN Build Files and Custom Modifications
Issue:https://gitee.com/openharmony/build/issues/I6UFTP
Signed-off-by: lubinglun <lubinglun@huawei.com>
2023-04-12 17:25:55 +08:00
Brendan Zabarauskas a722a97853 Release version 0.11.0
We've skipped some versions for `codespan-reporting` and `codespan` to get the crate versions back in sync with `codespan-lsp`.

Co-authored-by: Johann150 <20990607+Johann150@users.noreply.github.com>
2020-11-30 10:40:38 +11:00
Brendan Zabarauskas a287aa658d Implement Eq and PartialEq for diagnostic types 2020-11-30 10:38:02 +11:00
Johann150 8a0fc021bc change error types (#295)
- move error to files module; removed the special error types from codespan-lsp
- use error type in codespan and codespan-lsp
- make dependency on codespan-reporting non-optional
2020-10-07 14:01:20 +02:00
Johann150 97fc1abc75 write changelog
Just looked through all closed pull requests since the last release.
Left out anything related to codespan-lsp since there were already versions released for that.
I assume the changelog for that has been maintained.
2020-10-02 15:48:44 +02:00
dependabot-preview[bot] 8d7e3ea4e2 Update insta requirement from 0.16 to 1.0
Updates the requirements on [insta](https://github.com/mitsuhiko/insta) to permit the latest version.
- [Release notes](https://github.com/mitsuhiko/insta/releases)
- [Changelog](https://github.com/mitsuhiko/insta/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mitsuhiko/insta/compare/0.16.0...1.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-10-01 19:12:51 +00:00
Johann150 73bb6a22f7 implement clippy recommendations 2020-09-20 20:27:46 +02:00
Johann150 23222c83ec improve documentation in the files module 2020-09-19 15:53:54 +02:00
Johann150 ee0a2e5d52 Merge pull request #287 from Johann150/label-start-todo
move handling of label start to renderer
resolves the TODO comment
2020-09-16 07:59:51 +02:00
Johann150 c08abac44d simplify range to usize
added comments instead
2020-09-16 07:53:17 +02:00
Johann150 39600d6ec1 move handling of label start to renderer
this eliminates a failure condition from RichDiagnostic::render
because the full source code does not have to be loaded here any more
2020-09-15 22:42:18 +02:00
Johann150 057b741c22 Merge pull request #286 from Johann150/285-docs
add label rendering order to documentation
2020-09-14 20:23:09 +02:00
Johann150 6f5dc869c3 add label order to documentation
resolves #285
2020-09-14 19:47:00 +02:00
Brendan Zabarauskas 5654600a55 Merge pull request #266 from Johann150/patch-3
medium rendering mode
2020-09-07 20:22:50 +10:00
Johann150 b38320b895 add errorcode tests 2020-09-06 21:45:38 +02:00
RDambrosio 9d34c12fba Fix: boolean logic is hard 2020-09-06 13:25:43 -04:00
RDambrosio 2975e0e9d1 Fix: do not render code if it is an empty string 2020-09-06 13:21:32 -04:00
Brendan Zabarauskas 7f5ae6ca28 Merge pull request #282 from Johann150/patch-6
fix locus calculation
2020-09-04 21:46:28 +10:00
Johann150 e21c029d57 Merge branch 'master' into patch-3 2020-09-04 13:36:35 +02:00
Johann150 4d073bfdfb fix mistakes from #260
Changed the multiline_overlap test to cover this case too.
The output should be unchanged although the ordering of the labels has been changed.
2020-09-04 13:19:19 +02:00
Johann150 d5fe0c25fb remove indirection for configuration access 2020-08-31 15:44:41 +02:00
Johann150 4c4192eb21 Return errors instead of panicking (#275)
Co-authored-by: Markus Westerlind <marwes91@gmail.com>
Co-authored-by: Brendan Zabarauskas <bjzaba@yahoo.com.au>
Co-authored-by: Markus Westerlind <marwes91@gmail.com>
2020-08-31 11:00:36 +10:00
Johann150 99c320f2e6 remove empty line
also adjusted tests
2020-08-23 11:42:58 +02:00
Johann150 20f9b6e997 add remaining tests 2020-07-15 20:19:22 +02:00
Johann150 e67efa01da forgot something & add test macros
also added two small test to see that it works
2020-07-15 20:07:57 +02:00
Johann150 12ab4dfce5 add medium rendering mode
just added it onto the short diagnostic rendering
otherwise big chunks of code would be duplicated
2020-07-15 20:04:30 +02:00
Johann150 b2223d45b3 Make diagnostic locus point to the first primary label (#260) 2020-07-13 08:13:16 +10:00
Johann150 fd889608e9 Support collapsing multi line output (#257)
* Skip lines if there are too many lines in a label

The number of lines of context which are displayed should probably be configurable.

* make lines of context configurable

This changes the Config data structure and might be a breaking change.

* fix calculation of which lines to show

* fix formatting

* change the implementation to actually work

* start adding tests

* complete tests

* correctly filter lines

never skip lines which contain SingleLabel:s
if there is a single empty line, get back filtered out labels

* fix typo in comment

* simplify test

* continue labels across breaks

* better naming and more comments

* remove stray tests

* match test to usual pattern

* reviewed test

* store omittability on line instead of single label

This makes the code less complicated.

* separate configuration for start and end

* test separate configuration options

* improve documentation and comments

* simplify label retrieval

* change omittable to must_render

* remove current_labels

* add fixme comments

Co-authored-by: Brendan Zabarauskas <bjzaba@yahoo.com.au>

* simplify empty array

Co-authored-by: Brendan Zabarauskas <bjzaba@yahoo.com.au>
2020-07-12 21:38:06 +10:00
Markus Westerlind cfd3878c3d Remove codespan dev dependency from codespan-lsp 2020-07-06 08:57:48 +02:00
Brendan Zabarauskas 47ada132d3 Mention tab stop changes in changelog
We forgot to mention this in #254!
2020-06-24 13:55:05 +10:00
Brendan Zabarauskas a91f8cbce8 Bump cargo version to v0.9.5 2020-06-24 13:34:09 +10:00
Brendan Zabarauskas 28ecdbb7c0 Tweak multilabel enum to clean up patterns 2020-06-23 19:44:10 +10:00
Brendan Zabarauskas 0f8ad34f7b Clean up source coloring logic 2020-06-23 19:36:15 +10:00
Brendan Zabarauskas ee7bef4cee Colour source code within primary label ranges 2020-06-23 16:27:10 +10:00
Brendan Zabarauskas e523ad24e8 Use try_for_each more consistently 2020-06-23 12:55:24 +10:00
Brendan Zabarauskas 86649716b8 Merge pull request #252 from brendanzab/fix-tab-rendering
Fix rendering of tabulation columns
2020-06-23 11:29:09 +10:00
Brendan Zabarauskas 10ba35ed98 Fix rendering of tabulation columns 2020-06-23 11:05:23 +10:00
Joshua Nelson 42ed4e629e Allow using codespan without codespan-reporting
This copies the implementation of `line_starts` to `codespan`.
2020-06-21 22:53:51 -04:00
Brendan Zabarauskas 48439cbf16 Bump cargo version to v0.9.4 2020-05-18 16:07:30 +10:00
Brendan Zabarauskas 0f76247b80 Improve single line label rendering
This makes the rendering of carets smarter when there are multiple labels on the same line. Instead of this:

```
   ┌─ one_line.rs:3:5
   │
 3 │     v.push(v.pop().unwrap());
   │     - first borrow later used by call
   │       ---- first mutable borrow occurs here
   │            ^ second mutable borrow occurs here
   │
```
...we now render the following:
```
   ┌─ one_line.rs:3:5
   │
 3 │     v.push(v.pop().unwrap());
   │     - ---- ^ second mutable borrow occurs here
   │     │ │
   │     │ first mutable borrow occurs here
   │     first borrow later used by call
   │
```
2020-05-18 15:21:42 +10:00
Brendan Zabarauskas 7082032a20 Split unicode span test over multiple lines 2020-05-17 11:42:00 +10:00
Brendan Zabarauskas 124b6de617 Remove obsolete comment 2020-05-17 11:42:00 +10:00
Brendan Zabarauskas eeb7486ecc Simplify some methods in renderer 2020-05-17 11:41:44 +10:00
Brendan Zabarauskas ee940bc580 Add more test cases of overlapping ranges 2020-05-15 14:37:10 +10:00
Brendan Zabarauskas 6a3d7e2d48 Avoid panics when printing multiline carets 2020-05-15 11:40:26 +10:00
shika-blyat b99537ed48 Document the fact that Label's range is byte-range 2020-05-13 06:44:21 +02:00
Brendan Zabarauskas f7127299fb Tighten diagnostic spacing when notes are missing
This omits the trailing border on the final snippet if no notes are present.

For example, originally we’d render:
```
error[E0499]: cannot borrow `v` as mutable more than once at a time
  ┌─ one_line.rs:3:5
  │
3 │     v.push(v.pop().unwrap());
  │     - first borrow later used by call
  │       ---- first mutable borrow occurs here
  │            ^ second mutable borrow occurs here
  │

error: aborting due to previous error
 = For more information about this error, try `rustc --explain E0499`.

```
…where as now we’ll render:
```
error[E0499]: cannot borrow `v` as mutable more than once at a time
  ┌─ one_line.rs:3:5
  │
3 │     v.push(v.pop().unwrap());
  │     - first borrow later used by call
  │       ---- first mutable borrow occurs here
  │            ^ second mutable borrow occurs here

error: aborting due to previous error
 = For more information about this error, try `rustc --explain E0499`.

```
2020-04-29 17:11:12 +10:00
Brendan Zabarauskas 6754918296 Bump cargo version to v0.9.3 2020-04-29 13:27:27 +10:00
Brendan Zabarauskas 35877f8198 Tighten up spacing around source snippets
This eliminates the spacing between the title and the locus, and the outer spacing to the left of the source numbers.

Originally we would render this:

```
error: unknown builtin: `NATRAL`

   ┌─ Data/Nat.fun:7:13
   │
 7 │ {-# BUILTIN NATRAL Nat #-}
   │             ^^^^^^ unknown builtin
   │
   = there is a builtin with a similar name: `NATURAL`

```

And now we render this:

```
error: unknown builtin: `NATRAL`
  ┌─ Data/Nat.fun:7:13
  │
7 │ {-# BUILTIN NATRAL Nat #-}
  │             ^^^^^^ unknown builtin
  │
  = there is a builtin with a similar name: `NATURAL`

```
2020-04-28 18:55:45 +10:00
Brendan Zabarauskas 26b44be9d4 Add notes to multifile examples 2020-04-28 18:44:02 +10:00