Skip to content

Single line comments should generate selection ranges #42735

Closed
@mjbvz

Description

@mjbvz

Bug Report

🔎 Search Terms

  • selectionRange
  • Smart selection
  • expand selection

🕗 Version & Regression Information

Reproduces in 4.3.0-dev.20210210

Not a regression

💻 Code

For the code:

const a = 123 // a b c 

Put the cursor in the comment and run expand selection

🙁 Actual behavior

A single selection range for the entire line is returned:

[Trace  - 09:12:08.176] <syntax> Sending request: selectionRange (53). Response expected: yes. Current queue length: 0
Arguments: {
    "file": "/Users/matb/projects/san/a.js",
    "locations": [
        {
            "line": 1,
            "offset": 19
        }
    ]
}
[Trace  - 09:12:08.177] <syntax> Response received: selectionRange (53). Request took 1 ms. Success: true 
Result: [
    {
        "textSpan": {
            "start": {
                "line": 1,
                "offset": 1
            },
            "end": {
                "line": 1,
                "offset": 25
            }
        }
    }
]

🙂 Expected behavior

There should be a selection range for the single line comment.

Preferably, I think there should actually be two here:

  • One for the comment body: a b c
  • One for the entire comment: // a b c

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: Smart-SelectRange expansion APIs for editorsExperience EnhancementNoncontroversial enhancementsFixedA PR has been merged for this issueVS Code PriorityCritical issues that VS Code needs fixed in the current TypeScript milestone

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions