Commit Graph

315 Commits

Author SHA1 Message Date
Qi Xiao
a1b30deb86 pkg/eval/evaltest: Rename TestWithFullSetup -> TestWithSetup.
The old TestWithSetup is now more accurately called TestWithEvalerSetup.
2023-07-22 23:04:18 +01:00
Qi Xiao
aa24cd2851 pkg/edit/complete: Use default arg generator for RHS of "set" and "tmp".
This fixes #1704.
2023-05-27 10:53:06 +01:00
Qi Xiao
da576e221c pkg/eval: Use a Context inside Frame to pass interrupts. 2023-05-07 21:44:28 +01:00
Qi Xiao
27f34b8044 pkg/lsp: Return doc when hovering on the first character of a symbol. 2023-04-23 00:27:41 +01:00
Qi Xiao
70d77ce849 Move pkg/edit/complete/node_path.go into new package pkg/parse/np. 2023-04-22 22:25:01 +01:00
Qi Xiao
059a84905f pkg/edit/highlight: Highlight arguments to "del". 2023-03-10 10:11:44 +00:00
Qi Xiao
531ea80d11 Bump version of staticcheck, fix issues found by new version. 2023-02-26 20:47:25 +00:00
Qi Xiao
eea5312e22 Fixup for #1638. 2023-02-26 20:42:10 +00:00
rok
df8642ee69 pkg/edit: implement edit:history:accept
It's api to and update codebuffer with current entry in histwalk mode.

Resolves #1636
2023-02-14 15:53:06 +00:00
Qi Xiao
97a73e2d95 evaltest.capturePort -> eval.CapturePort.
Also rename the original eval.CapturePort to ValueCapturePort.
2023-01-15 16:44:25 +00:00
Qi Xiao
de3a7fd1b3 Standardize spelling: UNIX -> Unix.
https://en.wikipedia.org/wiki/Unix#Branding contains a history of the spelling.
Follow Wikipedia in using Unix instead of UNIX.
2023-01-04 18:09:11 +00:00
Qi Xiao
0dae5638ba Add tab completion for doc:show and doc:source. 2023-01-02 18:37:56 +00:00
Qi Xiao
08007a52ce website/cmd/md2html: Support implicit link targets to elvdoc sections.
For example, [`put`]() links to the elvdoc for "put".

Also remove the @cf macro now that implicit targets make it easier to link to
other elvdoc sections.
2023-01-02 02:36:58 +00:00
Qi Xiao
635648ee10 pkg/mods/doc: Add doc for edit:. 2022-12-31 22:14:19 +00:00
Qi Xiao
833569303c Fixups for #1629. 2022-12-28 12:42:31 +00:00
Manuel Mendez
ebe5a3d413 edit: add del-vars support 2022-12-28 12:27:17 +00:00
Manuel Mendez
0cefdb74c3 edit: add del-var support 2022-12-28 12:27:17 +00:00
Qi Xiao
cc6e02d206 pkg/edit: Make smart-enter and completion:smart-start apply autofix. 2022-12-25 13:50:17 +00:00
Qi Xiao
5e593ce8f0 pkg/edit: Simplify bindingHelp.
Use Elvish qnames to refer to the binding map too. This is consistent with how
functions are passed, and removes the need to pass around the binding map var,
which is quite awkward in initHighlighter where the binding map is created in a
different place.
2022-12-25 11:51:46 +00:00
Qi Xiao
a3c9c62700 pkg/edit: Simplify the internal autofix tip API. 2022-12-25 11:19:12 +00:00
Qi Xiao
b09c05b8cc pkg/edit: Show autofix commands, and support applying it. 2022-12-11 21:25:13 +00:00
Qi Xiao
5a237d7888 pkg/eval: When compiling, emit autofixes for using unimported builtin modules. 2022-12-11 14:21:09 +00:00
Qi Xiao
49b7c0c464 pkg/cli: Change highlighter API to return general "tips" rather than errors.
This is to prepare for displaying autofix code snippets in the REPL.
2022-12-11 12:47:48 +00:00
Qi Xiao
584ece1c52 pkg/edit/highlight: Handle multiple compilation errors.
Also document the change in the release notes.
2022-12-09 00:58:21 +00:00
Qi Xiao
78862465a4 pkg/diag: Include line:col of start position in Error and Show methods.
The Error methods used to show the start and end indices, while the Show methods
used to show line ranges.

Showing line:col of the start position seems to be pretty standard; both Go and
Rust do that.

I tried including the line:col of the end position too, but can't find a good
enough format.
2022-12-08 19:07:18 +00:00
Qi Xiao
1acc45cfc2 pkg/edit: Show dedup binding in history listing mode.
Also fix a lot of elvdoc.
2022-12-06 22:51:15 +00:00
Qi Xiao
94ab1b5390 Generalize parse.Errors and move it to diag.
This generalized type will be used to pack multiple compilation errors.
2022-11-30 01:05:16 +00:00
Qi Xiao
3847235a14 pkg/diag: Split Errors into another package.
The Errors function is not related to diag.Error, so keeping it in the same
package is confusing.

Also unexport the MultiError type. This allows its Error method to be
simplified, as it can assume that it always contains at least 2 errors.
2022-11-29 22:13:02 +00:00
Qi Xiao
b5438db132 pkg/eval: Document which keys are shown in navigation mode's UI. 2022-11-26 17:03:42 +00:00
Qi Xiao
1c4052f83e pkg/edit: Show bindings for toggling filter and hidden files in nav mode.
This fixes #1529.
2022-11-26 16:57:53 +00:00
Qi Xiao
dc523d45be website: Preserve $ in the HTML ID of docs for variables.
We are no longer using Pandoc, so this limitation can be lifted.

Also make @cf generate internal links where applicable in non-builtin modules:
"@cf mod:fn" in the doc of "mod" now links to just "#mod:fn" instead of
"mod.html#mod:fn".
2022-11-22 23:42:19 +00:00
Qi Xiao
980cf009ca Parse comment blocks preceding var and fn declarations as doc comments.
Convert all .elv files (including .d.elv files) to use this new format.
2022-11-22 22:59:31 +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
241f15de42 Clean up tests introduced in #1604 slightly. 2022-09-11 15:58:58 +01:00
kas
93c9f86555 Add support for completing invocations of local executables 2022-09-11 15:54:13 +01:00
rok
f4f96b47b8 vi append command binding 2022-09-11 15:36:53 +01:00
Qi Xiao
27e2df9394 Remove edit:-dump-buf.
This used to be used for taking ttyshots but is now obsolete.
2022-09-11 15:33:59 +01:00
Kurtis Rader
2f21892e0c
Documentation fixups (#1584)
I noticed these functions didn't have a "usage" while working on a `help` command.

Co-authored-by: Qi Xiao <xiaq@users.noreply.github.com>
2022-09-11 15:28:32 +01:00
Kurtis Rader
c6e10f12a2 Some minor documentation fixes
Mostly elimination of duplicated words but also a few other fixes such
as the output of commands such as `%`.
2022-08-29 12:04:59 +01:00
Qi Xiao
21e951427f pkg/edit/highlight: Highlight the catch keyword. 2022-08-29 11:18:57 +01:00
Qi Xiao
afc3c140d9 Improve doc on conditionally importing a module.
- Expand the example in edit:add-var, and give it a h3.

- Add a link from the language reference to the section in edit:add-var.

This fixes #1116.
2022-08-13 11:26:13 +01:00
Qi Xiao
551e246d96 webiste/cmd/macros: Strip leading $ from anchor targets of @cf.
Also add previously missing $'s in @cf arguments. This doesn't matter for the
anchor target, but matters for the link text.
2022-08-08 00:09:17 +01:00
Qi Xiao
2e788c846d Run gofmt.
https://tip.golang.org/doc/go1.19#go-doc
2022-08-07 22:30:11 +01:00
Qi Xiao
41fc578002 Merge branch 'ttyshot' 2022-08-04 23:41:11 +01:00
Qi Xiao
4afbb71c07 Move pkg/testutil/must.go to a new pkg/must. 2022-06-20 20:29:14 +01:00
Qi Xiao
6723b9a226 Use consistent pattern for mutating variables in tests.
- Use testutil.Set.

- Only export such variables to tests.
2022-06-19 23:56:18 +01:00
Kurtis Rader
4b4726b9a6 Make ttyshots scripted and reproducible
The main benefits of this change are:

1) It uses a hermetic "home" directory with a known command and location
   history. Which means it no longer depends on the interactive history
   and directory layout of the person creating the ttyshot. Which also
   means it no longer leaks the private history of anyone creating a
   ttyshot. This produces reproducible results when updating ttyshots.

2) The user no longer has to augment the ttyshot by manually adding the
   output of the commands to the generated HTML file. A process that is
   error prone. The output of the commands that generate the ttyshot is
   now captured and automatically included in the resulting HTML.

3) It makes it trivial to recreate every ttyshot. Simply execute these
   commands:

   ```
   make ttyshot
   for f [website/ttyshot/**.spec] { put $f; ./ttyshot $f }
   ```

4) It makes it easy to introduce new "ttyshot" images by creating a
   shell session "spec" file. This makes it easy to replace the existing
   "```elvish-transcript...```" examples with ttyshots in order to
   ensure a consistent representation and visual consistency with the
   transcripts that are currently generated as ttyshots.

The downside of this change is the introduction of a dependency on the
Tmux application. But that seems reasonable since Tmux is a mature
application available on Linux, macOS, BSD, and probably every other
UNIX like OS we care about. Note that generating the Elvish
documentation already depends on similar apps such as Pandoc.

Related #1459
2022-06-19 10:51:29 +01:00
Qi Xiao
75ee261fcb pkg/eval: Remove access methods for exported fields.
The exported fields are intended to be mutated directly.
2022-06-18 19:01:59 +01:00
Qi Xiao
4a6405eeb4 pkg/edit/complete: Improve analysis of variable definitions.
- Remove the sigil from the variable name.

- Recognize function parameters too.
2022-06-14 20:50:57 +01:00
Qi Xiao
e0ee14ad68 Support completing variables defined in the code being completed. 2022-06-13 23:00:06 +01:00