Commit Graph

71 Commits

Author SHA1 Message Date
Qi Xiao
27c3a40236 pkg/diff: Take string inputs, and add DiffNoHeader. 2024-01-30 20:15:58 +00:00
Qi Xiao
a3f4384495 Move all elvdocs into .d.elv files.
The elvdocs still use the old format (#elvdoc:fn or #elvdoc:var) for now, but
will be changed to "fn" and "var" forms soon.

Also remove the accidentally committed cmd/mvelvdoc. It has been used to perform
the conversion automatically but is not supposed to be committed.
2022-11-20 21:59:45 +00:00
Qi Xiao
1a84c6f71e Merge branch 'integrate-pr' 2022-11-20 15:13:29 +00:00
Qi Xiao
3a0b1242ac Fixup for #1591.
- Keep more metrics than just the minimal duration.

- Change default &min-time to 1s.

- Don't allow unitless value as &min-time.

- Rename &on-run to &on-run-end, and &min-iters to &min-runs.
2022-11-20 15:13:25 +00:00
Qi Xiao
464c555038 Move cmd/examples into pkg/cli. 2022-11-12 22:49:44 +00:00
Qi Xiao
1fba4b325f Replace cmd/elvmd with a simpler pkg/md/mdrun.
The new command is put in pkg/md to make it clear that it is used for debugging
pkg/md and not intended for general use.
2022-11-12 22:15:35 +00:00
Qi Xiao
810b3486d8 Expand the godoc of pkg/md to include a lot more context.
Also link to it from the godoc of the commands that use it.
2022-11-11 20:25:33 +00:00
Qi Xiao
0853835081 cmd/elvmdfmt: Fail when input uses unsupported features. 2022-11-06 12:12:34 +00:00
Qi Xiao
03beb029ce pkg/md/fmt.go: Support reflowing to fit a certain width. 2022-11-05 23:20:08 +00:00
Qi Xiao
a4589bcdf0 pkg/md: Refine formatting style.
- Try to avoid escaping & and < when they are not problematic.

- Escape non-breaking space.

- Format lists as loose lists.

- Only indent inline raw HTML when it can actually be parsed as a
  paragraph-interrupting HTML block.
2022-11-04 18:09:17 +00:00
Qi Xiao
b901b49f12 cmd/elvmdfmt: Split Markdown formatting into own command, supporting -w and -d.
Also change the behavior of the rendering command (elvmd) to still output HTML
when given -trace.
2022-11-04 16:37:47 +00:00
Qi Xiao
6cb2a1f50d cmd/elvmd: Consolidate mdfmt and mdtrace into elvmd.
Also export pkg/md.HTMLCodec, and make it the default in elvmd.
2022-11-02 13:22:44 +00:00
Qi Xiao
96e4f75e43 Add a new "mdtrace" for debugging the md package with the trace codec. 2022-11-02 02:20:28 +00:00
Qi Xiao
f584434735 Add md.FmtCodec and a mdfmt command.
A lot of tests are skipped for now.
2022-10-15 12:21:11 +01:00
Qi Xiao
33a04f8dc1 Revamp flag handling in pkg/prog.
Instead of putting all possible flags in prog.Flags, flags are now registered by
the individual subprograms. The 3 flags -sock, -db and -json are shared by
multiple subprograms and still handled by the prog package.

This new design allows separating the support for -cpuprofile into a separate
subprogram, which is no longer included by the default entry point, making the
binary slightly smaller. A new entrypoint "withpprof" is created.

Also include the LSP subprogram in the nodaemon entry point.
2022-02-05 14:52:29 +00:00
Qi Xiao
ffeb3ab963 Make the LSP server part of the Elvish binary.
Also add tests.
2022-02-05 11:34:14 +00:00
Qi Xiao
c54f13a27a Fixup for #1466. 2022-02-05 00:09:08 +00:00
Jan Blackquill
e901919a40 LSP that only supports parsing errors 2022-02-04 22:56:20 +00:00
Qi Xiao
89a5df6bc1 Fix cmd/nodaemon/elvish.
The Program API was changed, but the daemonStub was not updated accordingly.
2022-01-07 13:50:46 +00:00
Qi Xiao
84b72af4ca Support using styled text in &display to edit:complex-candidate.
This fixes #1011.
2022-01-03 20:30:00 +00:00
Qi Xiao
3172a259b9 Fix cmd/examples/win_tty 2021-10-02 22:44:54 +01:00
Qi Xiao
7a72b6346a Reorganize pkg/sys into portable and non-portable system utilities.
Non-portable ones are moved into new packages pkg/sys/e{unix windows}. The "e"
prefix is needed to avoid conflict with packages under golang.org/x/sys/ and can
mean "extra".
2021-10-02 13:14:00 +01:00
Qi Xiao
8e117a2875 Merge pkg/daemon/client into pkg/daemon.
Also merge and rename files to make the client/server separation clearer.
2021-09-30 23:37:36 +01:00
Qi Xiao
ccc2750037 Remove the experimental web UI.
It has not been actively developed for a long time and has a vulnerability:
https://github.com/elves/elvish/security/advisories/GHSA-fpv6-f8jw-rc3r
2021-09-21 23:45:09 +01:00
Qi Xiao
46276d6b70 Update godoc of cmd/nodaemon/elvish. 2021-09-12 00:41:27 +01:00
Qi Xiao
be3431bbbf pkg/prog: Simplify the Program interface.
Instead of a separate ShouldRun method, use a special error value to signify
that a Program should not be run.
2021-09-12 00:40:35 +01:00
Qi Xiao
f011034c06 pkg/cli: Simplify the API for dismissing a widget.
- Rename the method from "Close" to "Dimiss" to avoid any conflict with the
  standard interface{ Close() error }

- Remove the "accept" parameter from the Dismiss method and App.PopAddon - it is
  false in most places, and the few places that pass accept=true has knowledge
  of how to accept the state in the particular widget.

- edit:history:accept has been removed as a consequence - it is never
  documented, and is not currently used by any Elvish code published on GitHub
  (https://github.com/search?q=%22edit%3Ahistory%3Aaccept%22+extension%3Aelv&type=Code)
2021-09-07 23:16:01 +01:00
Qi Xiao
db0b88f664 Rename pkg/cli/mode -> pkg/cli/modes. 2021-09-03 20:44:04 +01:00
Qi Xiao
293704ef03 All modes that rely on a code area now use the active code area dynamically.
This will enabling using any of such modes from a minibuf (e.g. completion from
a minibuf).
2021-08-30 23:59:28 +01:00
Qi Xiao
1bfcaeb218 Support a stack of addons in cli.App.
This is motivated by supporting a minibuf from any mode (even in minibuf mode
itself), but could have other applications too.
2021-08-30 00:55:09 +01:00
Qi Xiao
d6464280f2 Remove direct dependency of pkg/shell on the daemon implementation.
The dependency is injected via a field in shell.Program.

Also add an alternative entrypoint, cmd/nodaemon/elvish, which does not include
the daemon server or client.
2021-06-19 01:43:30 +01:00
Qi Xiao
f3c08d78b2 cmd/examples/win_tty: Only show keyboard events and in a nicer format. 2021-06-18 00:29:24 +01:00
Qi Xiao
4ecdb7f278 pkg/cli: Simplify the TTY interface by making it embed term.Writer. 2021-03-19 21:40:32 +00:00
Qi Xiao
f8ace8fa90 cmd/examples: cliaddon -> nav. 2021-02-14 06:49:09 +00:00
Qi Xiao
5e202ebe5f cmd/examples/e3bc: Add completion. 2021-02-14 06:46:22 +00:00
Qi Xiao
9f13c3cc6e pkg/cli: Support global bindings.
Global bindings are consulted when an event is not handled by the active widget.
2021-02-14 01:38:34 +00:00
Qi Xiao
62f0f4b580 pkg/cli/mode: Expose the navigation mode as a widget. 2021-02-13 23:21:39 +00:00
Qi Xiao
7f0463a156 pkg/cli: Pass the widget to binding bodies.
A new type, tk.Bindings is defined for bindings. It is always called with the
widget currently handling the event, in addition to the event being handled.
2021-02-12 21:34:47 +00:00
Qi Xiao
0427c536d0 Simplify the API of pkg/cli.
* Move all widget types to a new pkg/cli/tk.

* Move Mode{Line Prompt} to a new pkg/cli/mode.

* Move all packages in pkg/cli/addons to pkg/cli/mode.

* Remove WriteListing.

* Remove StdTTY.

* Rename GetCodeBuffer to CodeBuffer.
2021-02-11 19:24:37 +00:00
Qi Xiao
414cea19d8 cmd/examples: Replace the cli example with a realistic bc wrapper. 2021-02-10 23:32:44 +00:00
Qi Xiao
22e4315eb1 Move the main package to cmd/elvish.
Now that the module path is "src.elv.sh", doing a "go get" will install the
Elvish binary as "src.elv.sh"; this is not what we want, so move the main
package into a package called "elvish".

Also update "go get" and "go build" commands accordingly.
2021-01-27 01:35:01 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
9169f803ea pkg/ui: Add a Concat function for concatenating multiple Text's. 2020-08-25 22:34:19 +01:00
Qi Xiao
88c1d1514f website: Restructure directory.
* Remove the _ prefix from directories.

* Move cmd/website -> website/cmd.
2020-06-14 13:56:58 +01:00
Qi Xiao
03cb64ea2f genblog: Further simplify code. 2020-06-14 13:40:09 +01:00
Qi Xiao
fa77792ad5 genblog: Further simplify the code. 2020-06-14 13:14:51 +01:00
Qi Xiao
48145ded88 genblog: Remove default template and CSS. 2020-06-14 12:55:09 +01:00
Qi Xiao
f5bf45ed5c Vendor the genblog command.
This simplifies the website toolchain to no longer depend on an external
repository, and allows developing the genblog command in lockstep with the needs
of the website.
2020-06-14 12:45:17 +01:00
Qi Xiao
620415c87f cmd/website/macros: Small refactors. 2020-04-27 10:49:19 +01:00
Kurtis Rader
eef7aa168c Augment @cf expansion to work outside builtin: NS
The @cf documentation command currently only works correctly for the
builtin namespace. This augments the expansion of @cf arguments so
that an explicit namespace can be included. This makes it possible to
cross-reference between namespaces. For example, `@cf builtin:splits`
and `@cf str:split`.
2020-04-27 10:35:28 +01:00