Commit Graph

1050 Commits

Author SHA1 Message Date
Qi Xiao
dd3950cec0 Use the new testutil.Set in more places. 2022-04-11 21:55:59 +01:00
Qi Xiao
3a3b8f5700 pkg/edit/complete: Change Complete to take an Evaler.
The PureEvaler abstraction made things unnecessarily complex; it's better to
just create a real Evaler for tests is pretty.

The Evaler has a new ReplaceBuiltin method to make it easier to construct the
expected test result.
2022-04-11 21:39:29 +01:00
Qi Xiao
8519085327 clitest: Make failures in TestBuffer and TestNotesBuffer fatal.
If a buffer (or notes buffer) hasn't appeared, it means that the app is not in
some intended state. Subsequent tests are unlikely to be meaningful, and may run
into race conditions.

A lot of existing code already uses TestBuffer to ensure that a certain state is
reached, and making failures fatal also suits this usage better.

This fixes #1507.
2022-04-09 14:40:52 +01:00
Qi Xiao
f8f60953ad Properly deprecate float64.
- Replace its use with "num" in documentation and test code.

- Add a new "inexact-num" for explicitly converting a number to inexact.

This fixes #1513.
2022-04-09 11:45:15 +01:00
Qi Xiao
6ec410753b evaltest: Fix diff output. 2022-04-07 20:46:30 +01:00
Qi Xiao
cfcef9ec51 pkg/buildinfo: Use Go's buildinfo to derive version of development builds.
This allows the build commands in Makefile and tools/buildall.sh to be
simplified.

Official reproducible builds are now handled as a build variant, and the command
in Makefile no longer tries to produce reproducible builds.

Instructions in PACKAGING.md have been completely rewritten.
2022-04-02 18:18:24 +01:00
Qi Xiao
a8c2d165d3 Simplify pkg/edit/complete/node_path.go with generics.
staticcheck@master crashes when checkling code using generics, disable it in CI
for now.
2022-03-20 16:17:19 +00:00
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
f7cb556d9b Require Go 1.18.
- Run "go fix" to remove legacy build tags

- Use staticcheck@master until it has a release that supports Go 1.18

- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00
Qi Xiao
957c8a7521 evaltest: Check that stderr is empty if PrintsStderrWith is not called.
Among other things, this will check for deprecation warnings. Also fix test code
that uses deprecated features.
2022-03-20 09:50:05 +00:00
Qi Xiao
ab699bae87 Remove use of deprecated features in bundled modules. 2022-03-19 10:09:44 +00:00
Qi Xiao
0fa5ebac68 Prepare for 0.18.0 release.
The development is now considered to be targeting 0.19.0.
2022-03-18 22:11:35 +00:00
Qi Xiao
e2901118a5 Simplify terminal setup functions.
Remove SetupGlobal and Sanitize and replace them with a SetupForEval, which is
similar to Setup, but called before evaluating code and returns a function to
call after evaluating code.
2022-03-18 10:54:01 +00:00
Qi Xiao
e85afa2cbe Fixup for PR #1499.
- Use filepath.Ext instead of path.Ext

- Use cmp.Diff to generate test failure messages

- Misc stylistic changes
2022-03-12 23:22:34 +00:00
Kurtis Rader
603aae077d Improve searching PATH on Windows for completions
This was extracted from https://github.com/elves/elvish/pull/1326. It
augments that change by honoring $E:PATHEXT and some other
minor improvements.  This matches the behavior of the Go stdlib
os/exec.LookPath() function that is used to decide if what has been typed
(in a non-completion context) represents an external command.
2022-03-12 22:49:52 +00:00
Qi Xiao
5f1673c6c4 Use go-cmp to report unexpected test results.
cmp.Diff panics when comparing a struct that has unexported fields and no String
or Equal method, so change some structs to either export all their fields or
have an Equal method.

This fixes #1136.
2022-03-11 22:49:32 +00:00
Qi Xiao
7cf4b94c5f pkg/lsp: Add no-op textDocument/hover. 2022-03-07 14:39:19 +00:00
Qi Xiao
92c7e4b303 pkg/lsp: Support textDocument/completion. 2022-03-07 14:27:26 +00:00
Qi Xiao
effa267007 Add comment for the semantics of SIGTERM on Windows. 2022-03-06 23:48:46 +00:00
moko256
e56fad4817 On Windows, handle SIGTERM and exit immediately when conhost window was closed. 2022-03-06 23:46:25 +00:00
moko256
c8f678d2a5 On Windows, implement sanitize in pkg/cli/term/setup_windows to cleanup console modes that external command changed 2022-03-06 23:33:17 +00:00
Qi Xiao
d3a31ae193 Revamp command-line flag doc.
- Document all flags, and remove doc for removed flags.

- Update in-code flag descriptions to be more consistent with the markdown doc.
2022-03-03 00:41:39 +00:00
Kurtis Rader
24cca36d7b Document all elvish CLI flags
There was a recent question for which the answer was to use the
`-compileonly` flag but the user didn't realize that because there was
no mention on https://elv.sh/ref/command.html. Similarly, other flags,
like `-decpreation-level`, would benefit from more verbiage than shown by
`elvish -help`.
2022-03-01 23:25:22 +00:00
Qi Xiao
e894ae5f82 Improve the syntax of "try".
* Require at least one of "except" or "finally" to be present. This fixes #1424.

* Rename "except" to "catch". The former will be deprecated from 0.18.0. This
  addresses #1497.
2022-03-01 13:57:00 +00:00
Qi Xiao
b8f4cb001d pkg/edit/highlight: Fix highlighting when "except" is followed by a lambda.
This fixes #1358.
2022-03-01 00:57:46 +00:00
Qi Xiao
e58e5a4e56 pkg/edit/complete: Refactor how parse tree is matched.
- Introduce nodePath to store the complete path to the leaf node.

- Introduce a nodesMatcher abstraction to do pattern matching on nodePath.

Parse tree matching previously requires deeply nested if statements to walk
multiple levels of the tree and (optionally) check the property of nodes. These
are replaced by a single "if np.match(...)", with a single level of nesting.
2022-02-27 11:56:58 +00:00
Qi Xiao
6efce297b2 Update completer for assignment.
- Offer variable names as arguments of "set" or "tmp".

- Stop offering "varname = " at the command head position.
2022-02-27 00:02:10 +00:00
Qi Xiao
d7a9d38731 pkg/eval: Remove reference to the now-gone local: scope. 2022-02-20 23:30:47 +00:00
Kurtis Rader
8c9414a0ec No-daemon build don't panic starting location mode
Fixes #1487
2022-02-20 23:27:24 +00:00
Qi Xiao
1bf3ea3c1b Add $unix:rlimits for manipulating resource limits.
This fixes #959.
2022-02-20 23:22:33 +00: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
moko256
f4bc35dbd0 Use src.elv.sh/pkg/rpc instead of net/rpc. 2022-01-30 22:49:54 +00:00
Qi Xiao
fda62502ad pkg/edit: Slighly refactor the handling of nil Store. 2022-01-16 21:18:55 +00:00
Christian Walter
f5b645cc2d pkg/edit: Don't call AddDir on storedefs if it is not ready
Signed-off-by: Christian Walter <christian.walter@9elements.com>
2022-01-16 21:18:05 +00:00
Qi Xiao
7d22bb1c28 per/persistent: Update benchmarking results.
Also remove disclaimer about API instability since that is now implied by the
0.x version number of the Go module.
2022-01-05 22:44:12 +00:00
Qi Xiao
b2c6e41cb2 Upgrade the script pkg/persistent/add-slowdown. 2022-01-05 22:37:50 +00:00
Qi Xiao
59459793e3 pkg/persistent: Cons -> Conj.
Cons was a misnomer for the operation of adding an element at the end of a
vector. Follow Clojure's naming here and call this operation Conj.
2022-01-05 22:34:55 +00:00
Qi Xiao
8ed351e386 Add a new "defer" command. 2022-01-05 00:12:35 +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
38d4553833 Update assignment syntax in docs.
- Also remove the section for the legacy assignment syntax.

- Also add a paragraph to "eval" about upvalues.
2022-01-03 19:45:39 +00:00
Qi Xiao
4350ad48b1 Remove highlighting for legacy assignment syntax. 2022-01-03 00:59:48 +00:00
Qi Xiao
003557c22a Remove support for the legacy lambda syntax.
This fixes #664.
2022-01-03 00:47:41 +00:00
Qi Xiao
be1e144b45 Remove support for the "local:", "up:" and ":" special namespaces.
This fixes #1409.
2022-01-03 00:47:41 +00:00
Qi Xiao
3dd3b780b9 Remove legacy assignment syntax.
This fixes #645.
2022-01-03 00:47:41 +00:00
Qi Xiao
4fcffc5671 Remove most uses of the legacy assignment syntax.
The remaining few uses are in some of the tests, which will be removed later.

This addresses #645.
2022-01-03 00:47:41 +00:00
Qi Xiao
653c9f9d0f Remove dir-history, deprecated since 0.17.0. 2022-01-03 00:47:41 +00:00
Qi Xiao
3abf7f5510 Deprecate the legacy temporary assignment syntax from 0.18.0.
This addresses #1114.
2022-01-03 00:47:24 +00:00
Qi Xiao
fb1e807735 Change \xff and \x377 to encode bytes rather than codepoints.
It was an oversight to make them encode codepoints; they were always intended to
be equivalent to their Go counterparts, which encode bytes and can be used to
write arbitrary byte sequences that are not necessarily valid UTF-8 sequences.
2022-01-02 15:44:20 +00:00
Qi Xiao
d9eb0928e3 Bind Alt-Enter to inserting "\n". 2022-01-01 23:52:34 +00:00