Skip to content

feat: Tab/автоотступ в редакторе + русский словарь ошибок (P1.4+P1.2) - #15

Merged
gon7187 merged 1 commit into
mainfrom
feat/editor-tab-ru-errors
Jul 28, 2026
Merged

feat: Tab/автоотступ в редакторе + русский словарь ошибок (P1.4+P1.2)#15
gon7187 merged 1 commit into
mainfrom
feat/editor-tab-ru-errors

Conversation

@gon7187

@gon7187 gon7187 commented Jul 28, 2026

Copy link
Copy Markdown
Owner

P1.4: Tab вставляет 4 пробела, Shift+Tab убирает отступ (в т.ч. по выделенным строкам), Enter наследует отступ и добавляет уровень после ':'. P1.2: app/error_hints.py переводит типовые ошибки Python (Syntax/Indent/Name/Type/Value/Index/Key/Attribute/ZeroDiv/Import/timeout) на дружелюбный русский с подсказкой; backend отдаёт error_hint, UI показывает его над сырой ошибкой. Тесты: 29 passed.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 96afe48d22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app/static/app.js
Comment on lines +272 to +273
if (!event.shiftKey && !selected.includes('\n')) {
editor.setRangeText(' ', start, end, 'end');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve one-line selections when Tab-indenting

When a user selects code within a single line and presses Tab, selected contains the whole line and therefore has no newline, so this branch replaces the actual selection with four spaces. For example, selecting print('hello') to indent it deletes the statement instead of indenting the selected line; distinguish a collapsed selection (start === end) from a nonempty one-line selection.

Useful? React with 👍 / 👎.

Comment thread app/static/app.js
const unindented = selected.replace(/^ {1,4}/gm, '');
const removedBeforeCursor = Math.min(4, (value.slice(lineStart, start).match(/^ */) || [''])[0].length);
editor.value = value.slice(0, lineStart) + unindented + value.slice(lineEnd);
editor.setSelectionRange(start - removedBeforeCursor, end - (selected.length - unindented.length));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep Shift+Tab selection endpoints aligned

When a multi-line selection ends inside the leading 1–3 spaces of its final line, this subtracts every space removed from that line even though some were after selectionEnd. For example, dedenting a selection from the first line's start through column 2 of the next four-space-indented line moves the endpoint two characters into the preceding line rather than to the next line's start, so subsequent typing operates on the wrong range.

Useful? React with 👍 / 👎.

Comment thread app/evaluator.py Outdated
except (SyntaxError, ValueError) as error:
return {"correct": False, "message": str(error)}
error_text = f"{type(error).__name__}: {error}"
return {"correct": False, "message": str(error), "error": error_text}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve sandbox-specific rejection guidance

When SafetyVisitor rejects an import, open, or another forbidden construct, it raises ValueError; exposing every caught ValueError through error now routes these policy rejections into translate_error's generic value-error category. Because the UI prioritizes error_hint over message, users are told to check a value's format instead of being clearly told that the operation is unsupported, so these safety errors need a distinct category or should retain their original guidance.

Useful? React with 👍 / 👎.

@gon7187
gon7187 force-pushed the feat/editor-tab-ru-errors branch from 96afe48 to a91df82 Compare July 28, 2026 13:51
@gon7187
gon7187 merged commit 7a4e1ab into main Jul 28, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant