sublime-codemap icon indicating copy to clipboard operation
sublime-codemap copied to clipboard

Ruby support

Open dchersey opened this issue 2 years ago • 5 comments

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

dchersey avatar Apr 06 '22 16:04 dchersey

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.

oleg-shilo avatar Apr 07 '22 07:04 oleg-shilo

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

dchersey avatar Apr 07 '22 12:04 dchersey

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

oleg-shilo avatar Apr 07 '22 13:04 oleg-shilo

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.

dchersey avatar Apr 07 '22 13:04 dchersey

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

oleg-shilo avatar Apr 08 '22 04:04 oleg-shilo

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

Unknow0059 avatar Jun 14 '24 07:06 Unknow0059

By mistake :) Closing it now

oleg-shilo avatar Jun 15 '24 06:06 oleg-shilo