Commit Graph

324 Commits

Author SHA1 Message Date
lubinglun
9f49b7f750 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
03d8b32042 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
64c36d5c2b Implement Eq and PartialEq for diagnostic types 2020-11-30 10:38:02 +11:00
Johann150
225d8d1c44
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
3afba8d7ae 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]
a6f93e41f1
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
b8e7f10be1 implement clippy recommendations 2020-09-20 20:27:46 +02:00
Johann150
47ea29c330
improve documentation in the files module 2020-09-19 15:53:54 +02:00
Johann150
6519a732d8
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
18f8237c88 simplify range to usize
added comments instead
2020-09-16 07:53:17 +02:00
Johann150
56b3f2f7e2 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
0a06f4a671
Merge pull request #286 from Johann150/285-docs
add label rendering order to documentation
2020-09-14 20:23:09 +02:00
Johann150
bd572d782f add label order to documentation
resolves #285
2020-09-14 19:47:00 +02:00
Brendan Zabarauskas
1d7a556789
Merge pull request #266 from Johann150/patch-3
medium rendering mode
2020-09-07 20:22:50 +10:00
Johann150
5acc81e717 add errorcode tests 2020-09-06 21:45:38 +02:00
RDambrosio
b72f4c5ab0
Fix: boolean logic is hard 2020-09-06 13:25:43 -04:00
RDambrosio
65e9dca4d4
Fix: do not render code if it is an empty string 2020-09-06 13:21:32 -04:00
Brendan Zabarauskas
3f8907ce36
Merge pull request #282 from Johann150/patch-6
fix locus calculation
2020-09-04 21:46:28 +10:00
Johann150
df2784c96e
Merge branch 'master' into patch-3 2020-09-04 13:36:35 +02:00
Johann150
4e2a77dc8c 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
6178df779f remove indirection for configuration access 2020-08-31 15:44:41 +02:00
Johann150
593ed5372b
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
190381c33d remove empty line
also adjusted tests
2020-08-23 11:42:58 +02:00
Johann150
a9f048cec1 add remaining tests 2020-07-15 20:19:22 +02:00
Johann150
d246e0aa86 forgot something & add test macros
also added two small test to see that it works
2020-07-15 20:07:57 +02:00
Johann150
2ba1956802 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
6b06e5f69a
Make diagnostic locus point to the first primary label (#260) 2020-07-13 08:13:16 +10:00
Johann150
98964e07c6
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
0a152fd72b Remove codespan dev dependency from codespan-lsp 2020-07-06 08:57:48 +02:00
Brendan Zabarauskas
801629ad2d Mention tab stop changes in changelog
We forgot to mention this in #254!
2020-06-24 13:55:05 +10:00
Brendan Zabarauskas
bc9d399134 Bump cargo version to v0.9.5 2020-06-24 13:34:09 +10:00
Brendan Zabarauskas
a3fa8cfc74 Tweak multilabel enum to clean up patterns 2020-06-23 19:44:10 +10:00
Brendan Zabarauskas
9fc0b04ef1 Clean up source coloring logic 2020-06-23 19:36:15 +10:00
Brendan Zabarauskas
753607ea5e Colour source code within primary label ranges 2020-06-23 16:27:10 +10:00
Brendan Zabarauskas
0eb19865cf Use try_for_each more consistently 2020-06-23 12:55:24 +10:00
Brendan Zabarauskas
ba872981b8
Merge pull request #252 from brendanzab/fix-tab-rendering
Fix rendering of tabulation columns
2020-06-23 11:29:09 +10:00
Brendan Zabarauskas
4540645abd Fix rendering of tabulation columns 2020-06-23 11:05:23 +10:00
Joshua Nelson
54c762a25b 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
ec2135ca9c Bump cargo version to v0.9.4 2020-05-18 16:07:30 +10:00
Brendan Zabarauskas
1580d08007 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
0c4920624c Split unicode span test over multiple lines 2020-05-17 11:42:00 +10:00
Brendan Zabarauskas
0261543c33 Remove obsolete comment 2020-05-17 11:42:00 +10:00
Brendan Zabarauskas
13b4df9a2f Simplify some methods in renderer 2020-05-17 11:41:44 +10:00
Brendan Zabarauskas
0318b0ee50 Add more test cases of overlapping ranges 2020-05-15 14:37:10 +10:00
Brendan Zabarauskas
5611cbaef8 Avoid panics when printing multiline carets 2020-05-15 11:40:26 +10:00
shika-blyat
8f5c4fb604 Document the fact that Label's range is byte-range 2020-05-13 06:44:21 +02:00
Brendan Zabarauskas
b75747200b 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
17ab90736e Bump cargo version to v0.9.3 2020-04-29 13:27:27 +10:00
Brendan Zabarauskas
8f23d0e975 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
713290ab1a Add notes to multifile examples 2020-04-28 18:44:02 +10:00