oleg-shilo / sublime-codemap

CodeMap - is a ST3 plugin for showing the code tree representing the code structure of the active view/document
MIT License
41 stars 4 forks source link

Ruby support #40

Closed dchersey closed 2 months ago

dchersey commented 2 years ago

Hi all, thanks for this great plugin! It was a little hard to find but I really appreciate it.

For those looking to add Ruby support, all I needed to do was copy the default settings to user settings and modify the syntaxes key as follows:

    "syntaxes":     [
                        ["universal",     ""],
                        ["text",          "txt"],
                        ["python",        "py"],
                        ["ruby",          "rb"],
                        ["Settings",      "sublime-settings"],
                        ["Syntax",        "sublime-syntax"],
                        ["Ini",           "ini"],
                ],

then duplicate the python section and rename to ruby, modifying as follows:

    "ruby": {
                "regex":
                [
                    [
                        "^(class |def ).*$",
                        "[(:].*$",
                        "",
                        false
                    ]
                ],
                "indent": 2,
                "obligatory indent": false,
                "empty line in map before": "class",
                "line numbers before": false,
                "prefix": "",
                "suffix": "()",
                "syntax": "Packages/Ruby/Ruby.tmLanguage"
            },  

And presto, it works! Ruby and python have very similar class/method syntax

oleg-shilo commented 2 years ago

Great. Thank you. I have reopened this as an enhancement. I will put it in the very next release so it comes out of the box.

dchersey commented 2 years ago

Great! Also, any tips on regexp to use with JavaScript? A bit tricky since there are multiple patterns for declaring functions.

oleg-shilo commented 2 years ago

Done. The release is published. Probably not indexed yet. But since you are using User settings your environment will function exactly as it is rights now.

...any tips on regexp to use with JavaScript?

Sorry. Not really. I am always struggling with it 😄 I normally find the first online Regex tester and use it as a playground

dchersey commented 2 years ago

Ah, ok. I'll post a new issue if I come up with something workable.
And thanks for the great plugin by the way! Surprising that there's nothing else that does this; code mapping is the main thing I miss from IDEs.

oleg-shilo commented 2 years ago

I know :) That's why I implemented the same functionality for VSCode.
https://marketplace.visualstudio.com/items?itemName=oleg-shilo.codemap

Unknow0059 commented 2 months ago

is this fixed...? why is the issue open

oleg-shilo commented 2 months ago

By mistake :) Closing it now