Skip to content
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

How to debug Hammerspoon scripts? #989

Closed
krasnovpro opened this issue Sep 14, 2016 · 12 comments
Closed

How to debug Hammerspoon scripts? #989

krasnovpro opened this issue Sep 14, 2016 · 12 comments

Comments

@krasnovpro
Copy link

krasnovpro commented Sep 14, 2016

Will be nice to have debugger like this: https://youtu.be/52SVAMM3V78

@cmsj
Copy link
Member

cmsj commented Sep 27, 2016

Honestly I think a debugger like that is way beyond our development resources at the moment.

I tend to do my debugging with print statements :)

@cmsj cmsj closed this as completed Sep 27, 2016
@krasnovpro
Copy link
Author

Add at least a variable watcher.

@franciscolourenco
Copy link

+1 for variable watcher. print debugging is painful

@cmsj
Copy link
Member

cmsj commented Feb 20, 2017

What sort of functionality would you want from a variable watcher?

@franciscolourenco
Copy link

The simplest implementation I can think of right now would be a debugger statement which, when executed, would pause execution, and make a window open. This window would show a list of variables available in the current scope and their values.

@cmsj
Copy link
Member

cmsj commented Feb 20, 2017

Maybe take a look at https://github.com/pkulchenko/MobDebug

@franciscolourenco
Copy link

Can it be used with Hammerspoon?

@cmsj
Copy link
Member

cmsj commented Feb 20, 2017

@aristidesfl I would expect so, but I've never tried it. Any Lua modules should work.

@franciscolourenco
Copy link

$ cat ~/.hammerspoon/init.lua
require("mobdebug").start()
$ tree ~/.hammerspoon/
/Users/user/.hammerspoon/
├── init.lua
└── mobdebug.lua
2017-02-20 16:12:48: *** ERROR: ...app/Contents/Resources/extensions/hs/_coresetup/init.lua:449: module 'socket' not found:
	no field package.preload['socket']
	no file '/Users/user/.hammerspoon/socket.lua'
	no file '/Users/user/.hammerspoon/socket/init.lua'
	no file '/usr/local/share/lua/5.3/socket.lua'
	no file '/usr/local/share/lua/5.3/socket/init.lua'
	no file '/usr/local/lib/lua/5.3/socket.lua'
	no file '/usr/local/lib/lua/5.3/socket/init.lua'
	no file './socket.lua'
	no file './socket/init.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/socket.lua'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/socket/init.lua'
	no file '/Users/user/.hammerspoon/socket.so'
	no file '/usr/local/lib/lua/5.3/socket.so'
	no file '/usr/local/lib/lua/5.3/loadall.so'
	no file './socket.so'
	no file '/Applications/Hammerspoon.app/Contents/Resources/extensions/socket.so'
stack traceback:
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:449: in function 'require'
	/Users/user/.hammerspoon/mobdebug.lua:102: in main chunk
	[C]: in function 'rawrequire'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:449: in function 'require'
	/Users/user/.hammerspoon/init.lua:177: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:481: in function 'hs._coresetup.setup'
	(...tail calls...)

@franciscolourenco
Copy link

Btw, any thought on #1235 ? Can't move forward on that one.

@asmagill
Copy link
Member

Can this be closed since #1268 is now showing signs of working?

@cmsj
Copy link
Member

cmsj commented Mar 28, 2017

This one is closed ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants