alehandrof / BetterGoTo

9 stars 2 forks source link

Add to Package Control #1

Open dangelov opened 10 years ago

dangelov commented 10 years ago

Thanks for writing this, I find it really useful. Perhaps you could consider adding this to Package Control for Sublime Text.

https://sublime.wbond.net/

alehandrof commented 10 years ago

Hey, thanks! I'm assuming you found Comment Bang useful, rather than the LaTeX stuff, right?

I began this package with the intention of improving the way the Symbol List was populated, especially in HTML, CSS, etc. -- but I lost interest after I realized that the limitations were quite significant.

I still use Comment Bang daily, but because it's such a small tweak I thought it would be a little foolish to bundle it for Package Control.

dangelov commented 10 years ago

Yeah, just Comment Bang, I don't work with LaTeX. I was actually looking for a way to have #pragma mark show, so I can keep the same syntax, but // ! also works.

Might be a small change, but it is kinda handy, and without looking too much into it, I wouldn't know what/where to make the changes, so it might be useful for other people like me. Just my 2¢.

And yeah, downloading the file and copying it into the packages folder is not too much work either :)

alehandrof commented 10 years ago

The best way to install a package that's not in Package Control is use Package Control. There's a command to add a repository (in this case: https://github.com/alehandrof/BetterGoTo/). You will then be able to install the package (BetterGoTo) from Package Control. This will make sure that your package remains up-to-date.

The original impetus for Comment Bang was a discussion about #pragma mark on the Sublime Text forums. It's not something I have come across, but if you patiently explain, I might be able to help :)

Is what you're looking as follows?:

code
code

#pragma mark Lorem Ipsum

code
code

The object here would be that "Lorem Ipsum" would be displayed in the Symbol List. (There's also a #pragma mark - which creates a line from what I can tell.)

Anything else?

alehandrof commented 10 years ago

Meh. The following does what I described above: https://github.com/alehandrof/BetterGoTo/blob/master/Pragma%20Mark.tmPreferences

Let me know if it makes sense.

If useful, it should really go under some Objective-C package -- if it doesn't exist already...

dangelov commented 10 years ago

Thanks for that Package Control tip.

#pragma mark actually works if you set the syntax to Obj-C, but I was just looking for a way to use the same thing globally, for any file type, say even with JS and PHP.

Pragma Mark.tmPreferences doesn't seem to do the trick. From what little I understand, seems like it's only targeting Obj-C files? http://dew.dangelov.com/dewdrops/DEW-53236f7c8f7a33.03559656.png

alehandrof commented 10 years ago

You're correct. I had limited it to Objective-C, because that's what I guessed you wanted. I switched it to be syntax agnostic, but it's kind of a kludge at the moment. It doesn't support any syntax other than #pragma mark lorem ipsum. There are other things wrong with it, I'm sure.

Have a look and let me know what you think. I am stripping the #pragma mark from the Symbol List entry. You can turn that off by removing the appropriate line.

BTW, if we're going to have more discussion and tweaking, do you mind opening a separate issue?

Also, the new preference file will conflict with Comment Bang. You can only use one of these at a time, because they both swallow all the comment scopes. (Though if you have both Comment Bang will kick in first because it's prior in alphabetical order. I think, at least.)

dangelov commented 10 years ago

I am using your Pragma Mark.tmPreferences file and couldn't be happier :) Thanks for the help.

Please close/keep open the issue as you see fit. With your tip for custom adding a repo to Package Control, things are easy enough I think.

alehandrof commented 10 years ago

I just pushed an improved version of the tmPreferences file. It now supports all comment syntaxes -- not just hashes -- so you can use //pragma mark, among other things.

I've also made it a little looser:

Both of these seem to me to good (since pragma mark is designed for human consumption), but I can revert them if you think that it might cause problems.

One more question: I had stylized comment bang a little bit, removing the comment punctuation but maintaining the exclamation mark. In this case, I've removed the pragma mark markup because that's how it seems to be handled, based on screenshots of other editors. Any ideas on the matter? Because I'm re-writing the comment entry, we can adapt it to whatever makes more sense.

dangelov commented 10 years ago

Both of those changes look good to me. I'll continue using Pragma Mark for the sake of consistency, but I like how Comment Bang puts ! and a few spaces before the comment contents - helps separate it in the symbols list.

I just noticed that Comment Bang and Pragma Mark can't run together - might want to add a note somewhere in the project description.

alehandrof commented 10 years ago

I like how Comment Bang puts ! and a few spaces before the comment contents - helps separate it in the symbols list.

Yup. That's the idea.

How would you format the Pragma Mark to stand out in the list? I'm re-writing the comments anyway; it's only a matter of deciding what makes sense/looks good and I'll put it in.

I just noticed that Comment Bang and Pragma Mark can't run together - might want to add a note somewhere in the project description.

I know. I haven't updated the docs. I would much prefer to fix this than to document the limitation. But I think it can't be helped because both Comment Bang and Pragma Mark work by swallowing all comment scopes. The only way I can think of making this work is by limiting one or both of them to specific syntaxes.

Any ideas? What languages are using Pragma Mark in? Does it make sense not to use Comment Bang in those languages? If you can list them I can exclude them. (If any of this makes sense. The way ST handles Symbol Lists is... frustrating :)

ldm1417 commented 4 years ago

Hi Alex, I'm trying to change your BetterGoTo Pragma Mark.tmPreferences file, so that it will be compatible with SystemVerilog language, but without any success... Actually I've added the BetterGoTo to the Package Control repository and installed it. In order to edit the BetterGoTo's Pragma Mark.tmPreferences file, I'm using the PackageResourceViewer. The SystemVerilog comments start with double forward slashes: // So, I'd like to add to the Outline all the comments starting with //- (double slashes and dash) or with //-- (double slashes and double dash). How can I do so with your BetterGoTo? Is it possible to align items with //- and //-- separately (items with //-- will be inside of //- items)? E.g.: Code: | Outline: //- ABC | ABC //-- abc | abc

Thank you!