Sublime Forum

Sublime Text 4 Symbol Error

#1

When trying to use “Go to definition” for a PHP project, I get the following error:
Traceback (most recent call last):
File “/Applications/Sublime Text.app/Contents/MacOS/Lib/python38/sublime_plugin.py”, line 1480, in run_
return self.run(**args)
File “/Applications/Sublime Text.app/Contents/MacOS/Packages/Default.sublime-package/symbol.py”, line 256, in run
KeyError: ‘x’

0 Likes

#2

Does it happen in safe mode?

0 Likes

#3

It appears to, it works if I downgrade to Sublime Text 3. I removed a the babel and JSON Pretty print packages, cleared ~/Library/Caches/Sublime Text 3.

Works in v3, but not in v4

0 Likes

#4

Do you have an override for the default package? Check if there’s a folder called default in the Preferences > Browser Packages… menu.

0 Likes

#5

Not sure if you tried this as “safe mode” (sry if you did, just to ensure): https://www.sublimetext.com/docs/safe_mode.html

0 Likes

#6

This is reproducible in Safe Mode, but note that it only triggers when you invoke the Goto command from the main menu; if you use the key binding or the hover popup, it doesn’t.

The easiest reproduction is to start in Safe Mode, and then pick Goto > Goto Definition from the main menu (you don’t even need to type anything into the tab or load a file).

The line in question is the window_to_text call here:

        if not symbol:
            if event:
                pt = v.window_to_text((event["x"], event["y"]))
            else:
                pt = v.sel()[0]

GotoDefinition doesn’t get passed an event when it’s invoked from the Main menu (though it does from the key binding and the hover popup), so event["x"] bombs it.

1 Like

#7

Thanks, I’ve put in a fix for the next build.

3 Likes

#8

There is an issue for it in the tracker

1 Like

#9

Appears to still be an issue with 4113
Traceback (most recent call last):
File “/Applications/Sublime Text 4.app/Contents/MacOS/Lib/python38/sublime_plugin.py”, line 1480, in run_
return self.run(**args)
File “/Applications/Sublime Text 4.app/Contents/MacOS/Packages/Default.sublime-package/symbol.py”, line 256, in run
KeyError: ‘x’

0 Likes

#10

The fix didn’t make it into the current stable build unfortunately.

0 Likes

#11

Could you push the fix for this issue. Go To Definition is broken on ST4 (4113) which makes it close to unusable.

Traceback (most recent call last):
  File "/opt/sublime_text/Lib/python38/sublime_plugin.py", line 1480, in run_
    return self.run(**args)
  File "/opt/sublime_text/Packages/Default.sublime-package/symbol.py", line 256, in run
KeyError: 'x'
0 Likes

#12

It should be fixed in the dev build 4114.

0 Likes

#13

I can still reproduce in ST 4114. Looks like it’s not fixed.

0 Likes