Allow Tab to enumerate scopes in `syntax_test` files

Open
#383 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
testing, tooling

Research direction

Start by locating the existing syntax_test Tab auto-assertion behavior and the handling of repeated Tab and Shift+Tab; the issue provides the expected scope sequence and caret movement. Done means generated assertions enumerate available non-space scopes forward and backward after initial generation, while empty-line Shift+Tab still inserts alignment spaces.

Written by the indexing model from the issue text.

Description

enhancement

This is a proposal to change Tab to enumerate the available scopes in syntax_test files. It would work like repeatedly pressing ^ does for meta scopes, but instead of selecting successively larger scopes, it would move the auto-generated assertion to the next available substring.

Consider this example, with the cursor at |:

a = myfunc("str", var) + "aa"
#         ^^^^^^^^^^^^ meta.function-call.arguments.python
#|                   @ % $$$$

With Tab working as it does today, pressing Tab in this circumstance would create a single-character assertion at %. The scopes are selected. If you press Tab again, the scopes are replaced with some number of spaces, which is useless. You'd never want spaces after the set of carets.

In this proposal, pressing Tab in this situation would move the assertion to $$$$. The carets would be moved and resized, and the scopes would be rewritten. Also, pressing Shift+Tab would move the assertion BACK to the close paren (@).

This behavior would only happen AFTER Tab was first used to auto-generate an assertion. That means that Shift+Tab would still be available to insert spaces on an empty line for manually aligning an assertion.

Dominant language
Python
Stars
455
Forks
86
Avg merge
7d 10h
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SublimeText/PackageDev

All issues in SublimeText/PackageDev

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.