Repository navigation
Conversation
The Meaning view of the panel starts with one sentence that says what the line does (`LineExplanation.sentence`, when `ExplainOptions.sentence` asks for it; src/linesentence.ts, texts in src/messages-sentence.ts). It is composed from the tree (lists, pipelines, blocks, their heads and closing words), what each command is (`CommandSaid`, the record `Token.summary` is now made from too), the words P4 reads (`argvWords`: values, targets, a loop's words), and the status model (a pipeline's status; `set -e` in a list and where it stops other than the script). Idioms with a sentence of their own live in src/idioms.ts (`idiomSaid`). A clause is left out when a problem of the line cites its section (the host's problems too); no code span is a stretch of the line. Tests: 145 shapes in both languages, the rules over the corpus, the values against bash on the argv capture's runs, and the web page's panel at 390 and 1280 px. A bare `coproc` no longer makes the status model fail. Also: the Japanese HEALTHCHECK note says that 2 is reserved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
|
Web preview removed: the pull request is closed. |
…a whole statement, facts from the models)
- A pipeline over several lines (`cat f | while read l; do`) is said whole on
its first line: each stage named (a compound one by its kind, never by its
first token), what a compound stage does and where it runs (the environment
model: a subshell, or the shell itself with lastpipe), and the pipeline's
status and set -e facts. A closing word says the stages it pipes into.
- A statement started with `&` is said in the background as a whole, read
from the status model (`status(n).kind === 'background'`).
- Whether a statement can fail is the status model's `mayFail`, tested
against bash.
- The redirection kinds come from the dictionary (`RedirectOp.kind`,
`dupTarget` for `>&` and `<&`): one table. A closed or moved descriptor is
said short ("file descriptor 3 closed" / 「ファイルディスクリプタ 3 を閉じて」).
- A declaration builtin's clause has a verb ("… and sets `PATH` to …").
- The panel reads code spans as CommonMark does (`` `date` ``).
- `for x in $e` with `e` empty, and `for x in;`, say the body does not run;
a word that gives no field is left out of a list.
- No "then" before a branch of `case`, `elif` or `else`; the article before
a placeholder that stands alone ("the output of"); `done < input.txt` names
the file once.
- Docs: the follow-up of `problemSections` (fact ids once Token.facts
exists, SB3), and sources.md row 27 corrected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step P5 of docs/design/panel-redesign.md ("In short" on every line).
What users see
The panel's Meaning view (VS Code and the web page) starts with one sentence that says what the line does, labelled "In short" / 「ひとことで」, above the problems. The Reading view has none. Examples (sample.sh):
set -euo pipefail→ "Turns onerrexit,nounsetandpipefail, the usual strict mode."workdir=$(mktemp -d)→ "Setsworkdirto output of$(mktemp -d)."make build > build.log 2>&1 || exit 1→ "Runsmake, with stdout (fd 1) tobuild.log, stderr (fd 2) to where stdout (fd 1) goes; if that fails, runsexitwith status 1; underset -e, a command that fails before the last one does not stop the script."while read -r line; do→ "Readsinput.txtone line at a time, running line 29 for each line."done < input.txt→ "doneends thewhileloop of line 28: readsinput.txt…"grep -i error app.log | sort | uniq -c | sort -rn | head -n 3→ 「grepの出力の各行の出現回数を数え、多い順に回数つきで並べる(上位 3 行)。終了ステータスは最後に失敗したコマンドのもの(なければ 0)。」How
LineExplanation.sentence(marked text), whenExplainOptions.sentenceasks for it; src/linesentence.ts composes it from the tree,CommandSaid(src/explain/commands.ts: the command's names, the summaryToken.summaryalso comes from, the options given), P4'sargvWords(values, targets, a loop's words, with placeholders), and the status model. Texts: src/messages-sentence.ts (ja, en).idiomSaidin src/idioms.ts (strict mode, EXIT trap, quietcommand -v,while read … done < f, endless loop,sort | uniq -c | sort -rn [| head],echo … >&2).problemSections; host problems viaExplainOptions.hostProblems). Code spans name single words only. A variable whose attributes change what is stored (CHANGING, now exported from src/semantics/walk/temporaries.ts) gets "whatxgives".set -eis said only where it does other than stop the script (said on every line it was noise);variableFromwas not needed.coprocmadestatusModel.statusthrow.Explanation changes (test/snapshot.ts)
None: the corpus' explanations are byte-identical (keyed by input; only the 5 new snippets are added). The sentence is only built when asked for.
Tests
set -e/a pipeline status where a problem cites it, no code span is a stretch of more than one word, none is a row's text, Japanese spacing; every snippet and lines cut while typed without failing; assignment values against bash on the argv capture's runs.npm testlocally: 10524 passing.🤖 Generated with Claude Code