Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show compiler diagnostics in literate output #948

Merged
merged 39 commits into from
Apr 1, 2023
Merged

Show compiler diagnostics in literate output #948

merged 39 commits into from
Apr 1, 2023

Conversation

imkiva
Copy link
Member

@imkiva imkiva commented Mar 31, 2023

This is the best feature I've ever implemented! The JavaScript code used to show the popup is copied from 1lab (thanks!!!!).

image

@codecov
Copy link

codecov bot commented Mar 31, 2023

Codecov Report

Merging #948 (e6acc46) into main (e492b24) will increase coverage by 0.15%.
The diff coverage is 86.41%.

@@             Coverage Diff              @@
##               main     #948      +/-   ##
============================================
+ Coverage     82.89%   83.04%   +0.15%     
- Complexity     3452     3491      +39     
============================================
  Files           283      284       +1     
  Lines         10638    10734      +96     
  Branches       1295     1300       +5     
============================================
+ Hits           8818     8914      +96     
+ Misses         1100     1099       -1     
- Partials        720      721       +1     
Impacted Files Coverage Δ
...src/main/java/org/aya/tyck/pat/ClausesProblem.java 98.07% <0.00%> (ø)
...main/java/org/aya/pretty/backend/md/MdStylist.java 61.11% <0.00%> (+4.86%) ⬆️
...g/aya/pretty/backend/terminal/UnixTermStylist.java 75.00% <25.00%> (-5.77%) ⬇️
.../java/org/aya/pretty/backend/latex/TeXStylist.java 78.04% <33.33%> (-0.33%) ⬇️
...n/java/org/aya/pretty/backend/md/DocMdPrinter.java 95.83% <66.66%> (ø)
...java/org/aya/pretty/backend/html/Html5Stylist.java 77.35% <73.68%> (+8.12%) ⬆️
...a/org/aya/pretty/backend/string/StringPrinter.java 87.66% <75.00%> (-0.34%) ⬇️
...ava/org/aya/pretty/backend/html/HtmlConstants.java 81.81% <81.81%> (ø)
pretty/src/main/java/org/aya/pretty/doc/Style.java 90.00% <85.71%> (+5.78%) ⬆️
...va/org/aya/pretty/backend/html/DocHtmlPrinter.java 93.68% <94.11%> (+0.74%) ⬆️
... and 13 more

... and 1 file with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@imkiva imkiva changed the title Render compiler diagnostics to literate output Show compiler diagnostics in literate output Mar 31, 2023
@ice1000
Copy link
Member

ice1000 commented Mar 31, 2023

In the docs, we should make the hover window less dark (or maybe make it white-ish).

@ice1000
Copy link
Member

ice1000 commented Mar 31, 2023

merge?

@imkiva
Copy link
Member Author

imkiva commented Apr 1, 2023

merge?

wait a sec, lots of tweaks are coming ~

@ice1000
Copy link
Member

ice1000 commented Apr 1, 2023

Merge?

@ice1000
Copy link
Member

ice1000 commented Apr 1, 2023

JavaScript master....

@imkiva imkiva marked this pull request as ready for review April 1, 2023 13:04
@imkiva
Copy link
Member Author

imkiva commented Apr 1, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 1, 2023

Build succeeded:

@bors bors bot merged commit eb653c2 into main Apr 1, 2023
5 checks passed
@bors bors bot deleted the hover-error branch April 1, 2023 13:06
@imkiva imkiva mentioned this pull request Apr 16, 2023
2 tasks
bors bot added a commit that referenced this pull request Apr 19, 2023
959: Literate library r=ice1000 a=imkiva

# Summary

This PR adds support for pretty printing a library in our literate way. To customize the generation, new fields were added to `aya.json`:

```json
"literate": {
  "linkPrefix": "/aya-prover/base/src/test/resources/success/build/pretty/",
  "pretty": {
    "prettierOptions": {
      "map": {
        "InlineMetas": true,
        "ShowImplicitArgs": false,
        "ShowImplicitPats": true,
        "ShowLambdaTypes": false
      }
    },
    "renderOptions": {
      "colorScheme": "Emacs",
      "styleFamily": "Default"
    }
  }
},
```

- `linkPrefix`: the prefix to the link of "go to definition". This is useful when the generated page is not in the root folder of the HTTP server. The default value is "/" if unspecified.
- `pretty`: same as the `prettierOptions` and `renderOptions` in `~/.aya/repl_config.json`. The default value comes from `repl_config.json` if unspecified.

# How to build a literate library?

Take the library `base/src/test/resources/success/` for example:
```shell
aya --make base/src/test/resources/success --pretty-stage literate --pretty-format html
```


The above command outputs HTML files which are always located in `<library-root>/build/pretty`. Much like how we compile a single literate file.
(Remember the `"linkPrefix": "/aya-prover/base/src/test/resources/success/build/pretty/"` above?)

Note that the command line options `--prettyDir` and `--output` has no effect on libraries.

## For developers
[LibraryTest.testLiterate](https://github.com/aya-prover/aya-dev/blob/6ce530cddf2256901b02edfc5fb460975d393fc9/base/src/test/java/org/aya/test/LibraryTest.java#L46)

# TODO

- [ ] Collect compiler diagnostics for libraries, see #948 
- [ ] Build highlights for `import`, `open`

Co-authored-by: imkiva <imkiva@islovely.icu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants