Skip to content

Regex not respected in 'getWordRangeAtPosition' #27245

@franciscorubin

Description

@franciscorubin

I am having issues with the method 'getWordRangeAtPostition' of TextDocument. The problem is that the regex added as second argument is not respected.

This is my code:
const wordRange = editor.document.getWordRangeAtPosition(selection.active, /[a-zA-Z0-9_[[:space:]]]*/);

Using this example:

"bla bla bla bla"

To my understanding, the four words should be selected, as the [[:space:]] regex indicates that spaces are part of words. But the behaviour is the same than without the regex (only 1 word is selected).

Metadata

Metadata

Assignees

Labels

*questionIssue represents a question, should be posted to StackOverflow (VS Code)api

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions