-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Extension version
805.1.0
Issue description
The extension's parser appears to fundamentally mishandle identifiers that contain dots (nested namespaces). While simple dotted names (e.g., my_store.var) sometimes work, complex or nested dotted names cause failures.
It appears the parser assumes identifiers are strictly alphanumeric (\w+) or hardcodes support for only a single dot in specific places. This breaks support for Ren'Py project structures that use nested named stores.
I have verified failures in the following constructs:
-
init python in:Statementinit python in my.store:→ Fails (Context leak/Shadowing)init python in my.sub.store:→ Fails
-
define/defaultStatementsdefine my_store.var = 1→ Works (likely unintentional/partial match)define my_store.sub.var = 1→ Fails (Parser cannot handle 2+ dots)
-
TransformStatement:transform my_store.trans():→ Fails (Not recognized even with a single dot)
Steps to reproduce:
init python in main_store:
def func(): ...
class MyClass:
def method(): ...
init python in main_store.substore:
def func(): ...
class MyClass:
def method(): ...
define variable = 1
define my_store.variable = 1
define my_store.substore.variable = 1
transform my_transform():
pass
transform my_store.my_transform():
pass
label test:
# --- Function Tests ---
$ main_store.func() # ✅ Works
$ main_store.substore.func() # ❌ Definition not found (Extension doesn't see the dotted namespace)
# --- Class Tests ---
$ main_store.MyClass # ❌ Definition not found (Likely overwritten/corrupted index)
$ main_store.substore.MyClass # ❌ Definition not found
# --- Method Tests ---
$ main_store.MyClass.method() # ❌ Fails (jumps to main_store.substore.MyClass.method)
# The second class shadowed the first one in the index.
$ main_store.substore.MyClass.method() # ✅ Works (Oddly, the method is indexed even if the class lookup fails)
# --- Definition Tests ---
$ variable # ✅ Definition found
$ my_store.variable # ✅ Definition found
$ my_store.substore.variable # ❌ Definition not found
# NOTE: define and default, both have same results
# --- Transform Tests ---
$ my_transform() # ✅ Definition found
$ my_store.my_transform() # ❌ Definition not foundImpact:
- Shadowing/Context Leaks: Classes in nested stores overwrite classes in parent stores.
- Broken Navigation: "Go to Definition" fails for symbols with 2+ dots.
- No argument suggestions or auto-complete for functions in nested stores.
Possible Cause:
It appears that the extension's tokenizer or regex patterns stop reading identifiers when they encounter a dot (or a second dot). Updating the parser logic to treat the dot character (.) as a valid part of a namespace identifier—for both scope detection and symbol indexing—would likely resolve these issues (\w+ to [\w.]+).