Now that pipe is a structmap and structmaps are considered indistinguishable to
normal maps, IO redirection should support arbitrary maps too.
Update the relevant section in the language spec and rewrite it a bit.
Struct map is a mechanism to let Go code expose simple structs to Elvish code.
The difference between struct maps and maps is convenience for Go code; they
also have different performance characteristics, but since struct maps are
always quite small, the difference is not meaningful for Elvish's use cases.
As a result, there is no good reason that Elvish code needs to be aware of the
difference between struct maps and normal maps. Making them indistinguishable to
Elvish code simplifies the language.
This commit does the following:
- Change Equal, Hash, Kind and Repr to treat struct maps like maps.
- Change Assoc and Dissoc to "promote" struct maps to maps.
- Remove the custom Repr method of parse.Source.
- Update documentation to reflect this change.
Previously Go's == was used to test for equality when the container is not a
map, which is more strict when Elvish's normal equality test. For example,
"has-value [[foo]] [foo]" used to output false, rather than the expected true.
As can be seen in the screenshot in
https://github.com/elves/elvish/pull/1684#issuecomment-1493016037, the on-hover
doc shows "```elvish" for the code block that contains the usage of the command,
which shouldn't appear in the rendered Markdown.
This is because the response uses the deprecated MarkedString format, where
> The pair of a language and a value is an equivalent to markdown:
> ```${language}
> ${value}
> ```
When this format is used, the "```elvish" code block is embedded inside another
"```markdown" codeblock, which leads to this weird rendering artifact.
Switching to the new MarkupContent format fixes this issue. However, the
github.com/sourcegraph/go-lsp is outdated and doesn't have this type defined, so
define it ourselves for now. In future we should switch to a more up-to-date Go
package that contains the LSP types.
Also remove the superfluous MarkdownShowMaybe function, and just export
doc.Source. The former did nothing useful other than prepending "# symbol". I
tested the on-hover docs of both Go and JavaScript in VS Code, both start with
the declaration of the symbol, not a heading.
The `epm` module depends unnecessarily on several external commands;
e.g., `cat` and `test`. Remove those dependencies. It also has a bug in
its `-first-upper` function due to using the obsolete colon slice index
syntax rather than the double period (`..`) syntax. Replace that
function with the `str:title` builtin.
Related: 1661
When encountering files that can't be lstat'ed, simply ignore them instead of
terminating the entire globbing process. This is consistent with how directories
that can't be read are already silently ignored.
This fixes#1674.
This fixes#1668, because the crashing listbox rendering code uses "len(line) >
0" (where line is a ui.Text) to test whether it is non-empty. This test doesn't
work with the ui.Text constructed using "styled ''", which creates a ui.Text
with one empty segment.
The functions from the ui package are guaranteed to never return such ui.Text
instances, so switching the implementation of the styled builtin to functions
from the ui package fixes this.