renpy / language-renpy

:bookmark_tabs: :electric_plug: Ren'Py package for Atom and Linguist Grammars
https://atom.io/packages/language-renpy
Other
48 stars 6 forks source link

Symbols? #20

Closed ghost closed 2 years ago

ghost commented 2 years ago

Is there any way to get labels into the symbols view for quickly jumping around a file/project? It looks like Atom uses ctags but I'm not sure how that would work on Windows, or even if language-renpy would benefit from it.

ghost commented 2 years ago

Ok nvm, I have it working.

Install the https://atom.io/packages/symbol-gen package.

In the package settings, click the View Code button and add the following lines to lib/.ctags (from https://lemmasoft.renai.us/forums/viewtopic.php?t=21622):

--langdef=Renpy
--langmap=Renpy:.rpy
--regex-renpy=/^label[ \t]*([a-zA-Z0-9_]+):/\1/l,label/
--regex-renpy=/^define[ \t]*([a-zA-Z0-9_.]+)/\1/d,definition/
--regex-renpy=/^[ \t]*\$?[ \t]*([a-zA-Z0-9_]+)[ \t]*=/\1/v,variable/
--regex-renpy=/^screen[ \t]*([a-zA-Z0-9_]+)/\1/s,screen/
--regex-renpy=/^style[ \t]*([a-zA-Z0-9_]+)/\1/S,style/

Go back to your project and press ctrl-alt-g (or use Symbol Gen: Generate in the Command Palette. It will generate a .tags file in your project root.

And that's it! You can now press ctrl-shift-r and fuzzy search your game labels, as well as right click on something like jump start and Go To Declaration.

image