Commit Graph

16512 Commits

Author SHA1 Message Date
Greg Pfeil
0031542faf
Add a space before code block info strings
This is for consistency with the `cmark` style. Now the blocks we still
pretty-print ourselves will match the bulk of them that `cmark`
produces.
2024-07-10 13:56:07 -06:00
Greg Pfeil
1dc181b99a
Update the transcripts with cmark
`cmark`’s pretty-printer matches our output pretty well, with a few differences:
- it puts a space between the fence and the info string for in code blocks;
- it prefers `-` over `*` for bulleted lists (as do I) and it indents them;
- it `\`-escapes certain chars very conservatively;
- it prefers indented/unfenced code blocks if there is no info string; and
- it prefers `*` over `_` (unlike any sane person).

This also shows how the change fixes a number of issues:
- fix2158-1.output.md also illustrates how this change fixes #1809;
- alias-many.output.md and input-parse-errors.output.md show how fenced
  code blocks without an info string would use the beginning of the
  content as the info string;
- transcripts-round-trip/main.output.md shows how output blocks for
  generated `unison` stanzas (which could contain nested fenced blocks)
  might not have long-enough fences; and
- error-messages.output.md and generic-parse-errors.output.md show how
  Unison errors were reported on the wrong line number (and thus the
  printed error lines were also incorrect).
2024-07-10 13:37:51 -06:00
Greg Pfeil
9e2fa2bbe7
Replace transcript parser with cmark
We don’t need a very rich parser for transcripts, but we _do_ need to
reliably identify fenced code blocks, and that implies a number of
subtle cases. Using a polished CommonMark parser/printer handles those
subtleties for us.

I chose `cmark` for a few reasons:
- it’s a wrapper around `libcmark`, which is the reference
  implementation of CommonMark, so it should be correct;
- it provides both a parser and a printer (unlike MMark); and
- it is extremely fast (about 20x faster than MMark), so the fact that
  our home-rolled parser got to skip over everything that’s not a block
  isn’t an issue.).

This only _partially_ uses the `cmark` printer. I think it should use it
entirely, but for the cases where we do streaming output (processing UCM
commands, etc.) it’s a more involved change. So I think it should be
handled separately.
2024-07-10 13:26:19 -06:00
Paul Chiusano
2591ade890
Merge pull request #5195 from unisonweb/force-highlighting
Use `SyntaxText.Unit` as style for `foo()`
2024-07-09 17:20:33 -04:00
Paul Chiusano
2c1a0485f7 Don't use DelayForceChar as syntax style for blah.default() 2024-07-09 15:17:46 -04:00
Arya Irani
615887fcf4
Merge pull request #5194 from unisonweb/synhash-bugfix 2024-07-09 14:25:25 -04:00
Arya Irani
223df40237
Merge pull request #5192 from unisonweb/topic/numerals 2024-07-09 14:24:13 -04:00
Mitchell Rosen
94c6bfca62 add transcript 2024-07-09 14:10:53 -04:00
Arya Irani
22d4b26f02
Update unison-cli/src/Unison/CommandLine/InputPatterns.hs
Co-authored-by: Greg Pfeil <greg@technomadic.org>
2024-07-09 12:12:57 -04:00
Mitchell Rosen
701f308ab5 delete unused import 2024-07-09 11:58:41 -04:00
mitchellwrosen
d70b219058 automatically run ormolu 2024-07-09 15:48:21 +00:00
Mitchell Rosen
9cc6c2bd8a synhash var bugfix: hash debruijn indexes, not var names
also adds a debug.synhash.term command for debugging
2024-07-09 11:47:27 -04:00
Arya Irani
b14931f7b4 avoid numeric vs textual clash in args length error
`numerals` doesn't seem to be maintained anymore, however
2024-07-06 14:37:55 -04:00
Chris Penner
60bb91a50a
Merge pull request #5188 from unisonweb/lsp/unused-binding-detection
Unused binding detection cleanup
2024-07-05 22:26:11 -07:00
Chris Penner
dd17539f98 Fix diagnostic still reporting when no unused bindings 2024-07-05 16:35:11 -07:00
Chris Penner
0587ddec23 Compress unused bindings into a single diagnostic 2024-07-05 16:32:43 -07:00
Arya Irani
0331d2287c
Merge pull request #5186 from unisonweb/lsp/unused-binding-detection 2024-07-05 19:25:39 -04:00
Arya Irani
222bd48515
Merge pull request #5185 from unisonweb/arya/commandline-helpers 2024-07-05 16:54:39 -04:00
ChrisPenner
a6b8af1ede automatically run ormolu 2024-07-05 20:51:54 +00:00
Chris Penner
61287bdce5 Move warnings to the top of the term 2024-07-05 13:51:17 -07:00
Arya Irani
e102b0d5c6 fix compile error and use makeExample more 2024-07-05 16:27:41 -04:00
Chris Penner
25db6fbf05 Revert back to simple cata 2024-07-05 13:19:13 -07:00
Chris Penner
6a6c4d6004 Swap to using para instead of cata 2024-07-05 13:18:44 -07:00
Arya Irani
293b4a2948
Merge pull request #5182 from unisonweb/cp/improve-lsp-completion 2024-07-05 15:59:13 -04:00
Chris Penner
b9f4bfe198 Add unused binding detection to LSP 2024-07-05 12:47:43 -07:00
Arya Irani
c773017b0b
Merge pull request #5180 from unisonweb/arya/commandline-helpers 2024-07-05 15:29:20 -04:00
Arya Irani
2b603447c5
Merge pull request #5054 from sellout/better-CLI-error-messages 2024-07-05 15:21:31 -04:00
Arya Irani
8be432be1b change a punctuation 2024-07-05 15:10:28 -04:00
Chris Penner
deaf355f83 Improve LSP completion sorting 2024-07-05 11:56:31 -07:00
Greg Pfeil
ddbfb35d4b
Remove another warning flag from a message
Another one missed in the merge.
2024-07-05 12:25:32 -06:00
Greg Pfeil
81f9458ba7
Remove a help message from an error
This silpped by in the merge.
2024-07-05 12:14:40 -06:00
Greg Pfeil
0e76597e51
Merge remote-tracking branch 'upstream/trunk' into better-CLI-error-messages 2024-07-05 11:43:33 -06:00
Greg Pfeil
a7f1c24b57
Update transcript outputs 2024-07-05 11:28:27 -06:00
Greg Pfeil
41a0da8477
Fix formatting of an error message
It was leaving out spaces between literal text and generated text.
2024-07-05 11:27:53 -06:00
Greg Pfeil
67399e9193
Make CLI error messages more consistent
- remove `warnCallout` and `warn` from individual messages
- make sure no error messages return their `help` content
- add some documentation about how to write failure messages
2024-07-05 11:01:49 -06:00
Greg Pfeil
111fc5e3f4
Fix shared CLI error message
- don’t add an extra indent level to the entire output
- do add a `warnCallout` to the message
- don’t re-wrap formatted error output
- remove the accidentally-included entire `help <command>` output
2024-07-05 11:01:44 -06:00
Arya Irani
4bbbc8ce60 move pretty-print helpers out of CommandLine.hs
to avoid a potential cycle between CommandLine.hs and InputPatterns.hs
that otherwise came up on another branch.

InputPatterns.hs also has formatting helpers that could be used in CommandLine.hs.
Maybe they should be moved too, but I haven't thought about it.
2024-07-05 12:24:55 -04:00
Greg Pfeil
39179a31c0
switch Left to Right on help outputs; add draft transcripts (#1)
Maybe some duplication/conflicts here unintentionally.

The big transcript is just a WIP, we could make it prettier.
2024-07-05 09:55:51 -06:00
Arya Irani
38a73da600 switch Left to Right on help outputs; add draft transcripts 2024-07-05 11:33:11 -04:00
Arya Irani
a74d4e8cb9
Merge pull request #5172 from unisonweb/cp/more-project-transcripts 2024-07-02 19:45:30 -04:00
Arya Irani
54e17f2746
Merge pull request #5175 from unisonweb/cp/trailing-bang-lsp 2024-07-02 19:43:23 -04:00
ChrisPenner
92a74df8f8 automatically run ormolu 2024-07-02 22:50:40 +00:00
Chris Penner
1d5ae816de Include trailing '!' in identifier names for hover 2024-07-02 15:49:30 -07:00
Arya Irani
e99fb07d38
Merge pull request #5174 from unisonweb/move-nametree 2024-07-02 13:41:18 -04:00
Mitchell Rosen
eb1ee64cf2 merge unison-util-nametree into unison-core1 2024-07-02 12:23:34 -04:00
Chris Penner
d98b4aebc1 Port more transcripts to projects 2024-07-01 11:14:31 -07:00
Arya Irani
71eed210ce
Merge pull request #5146 from unisonweb/24-06-26-port-old-merge-transcripts 2024-06-28 03:45:57 -04:00
Arya Irani
05585090c3
Merge pull request #5147 from unisonweb/todo-empty 2024-06-28 00:48:44 -04:00
Arya Irani
570db9b408
Merge pull request #5152 from unisonweb/topic/jit-cont 2024-06-28 00:48:04 -04:00
Dan Doel
907aba9550 Rerun jit tests with regenerated file 2024-06-27 17:21:42 -04:00