Skip to content

Phantom changes regions boundaries (breaking view.extract_scope method) #1497

@vovkkk

Description

@vovkkk

Expected behavior

view.extract_scope method returns same result.

Actual behavior

view.extract_scope method returns different results depending on phantom presence/absence.

Steps to reproduce

  1. create new view, set Python syntax via palette, type class and autocomplete

    class ClassName(object):
        """docstring for ClassName"""
        def __init__(self, arg):
            super(ClassName, self).__init__()
            self.arg = arg
  2. open console and execute
    a. import pprint
    b. pprint.pprint([[i, view.extract_scope(i)] for i in range(24)])
    c. phantoms = sublime.PhantomSet(view)
    d. phantoms.update([sublime.Phantom(sublime.Region(22), 'yo', sublime.LAYOUT_INLINE)])
    e. pprint.pprint([[i, view.extract_scope(i)] for i in range(24)])

  3. compare results of 2.b and 2.e (0-14 are omitted)

point b e
15 (15, 22) (15, 22)
16 (16, 22) (15, 22)
17 (16, 22) (15, 22)
18 (16, 22) (15, 22)
19 (16, 22) (15, 22)
20 (16, 22) (15, 22)
21 (16, 22) (15, 22)
22 (16, 23) (22, 24)
23 (22, 24) (22, 24)

Note, size and layout of phantom does not affect the results in any manner

Environment

  • Operating system and version:
    • Windows 8.1
    • Mac OS ...
    • Linux ...
  • Sublime Text:
    • Build 3126

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions