Skip to content

Shell: trailing comments after semicolon never submit #148

Description

@dascalescuro

Symptom

In the browser shell, a statement that ends with ; followed by a -- or /* */ comment stays on the continuation prompt (learn->) instead of running.

Examples that fail to submit:

  • SELECT 1; -- done
  • SELECT 1;/* done */
  • SELECT 1;\n-- done

Expected

isStatementComplete (and the shell docstring) treat the last non-comment, non-whitespace character as decisive — so these should submit like psql.

Red loop (already run)

import { isStatementComplete } from './components/shell/sql-complete.ts';
isStatementComplete('SELECT 1; -- x'); // got false, expect true

Where

  • components/shell/sql-complete.ts — final check is /;\s*$/, which does not skip trailing comments
  • Called from components/shell/readline.ts on Enter

Notes

Diagnosed with /diagnosing-bugs. Minimized repro is the three inputs above; plain SELECT 1; still works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingready-for-agentFully specified, ready for an AFK agent

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions