Skip to content

Range.contains() returns true for positions not in range with editor.visibleRanges #250133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fengzhou-sg opened this issue May 30, 2025 · 0 comments
Assignees

Comments

@fengzhou-sg
Copy link

  • VS Code Version:
    Version: 1.100.2 (Universal)
    Commit: 848b80aeb52026648a8ff9f7c45a9b0a80641e2e
    Date: 2025-05-14T21:47:40.416Z
    Electron: 34.5.1
    ElectronBuildId: 11369351
    Chromium: 132.0.6834.210
    Node.js: 20.19.0
    V8: 13.2.152.41-electron.0
    OS: Darwin arm64 24.5.0
    
  • OS Version: MacOS Sequoia 15.5 (24F74)

Steps to Reproduce:

  1. Noticed editor.visibleRanges.some((range) => (range.contains(position)) returns true where there is only 1 visibleRanges with value of [33:0 -> 67:1) and position is of line: 78, character: 35. In the debugger, range.end.isAfter(position) returns true, but so is position.isAfter(range.end) (the later is expected)
  2. This seems to happen only with visibleRanges, tried to re-produce with following, but failed
    const range = new vscode.Range(33, 0, 67, 1)
    const position = new vscode.Position(78, 35)

    // returns false as expected
    console.log(range.contains(position))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants