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

Show in Output-Panel #22

Closed pykong closed 2 months ago

pykong commented 6 years ago

@oleg-shilo thank you for creating this awesome plugin, as it is great navigation help.

A minor point I would like you to improve is to allow for showing of the result in an output-panel on the bottom, because many users are accustomed to use that for other navigation info. An example is the new panel the upcoming SublimeLinter4 features to display lint results and provide easy navigation:

https://forum.sublimetext.com/t/sublimelinter-4-beta/34022

oleg-shilo commented 6 years ago

Hi there. Thank you, I am glad you liked the plugin.

During the plugin development rendering CodeMap in the output view was my first intuitive choice. Output view approach eats on breakfast the current "fake view" approach. Everything is much simpler, more reliable and natural. Everything, except one things... user experience.

You see, in all IDEs (that I ever dealt with) the tree view representing the structure of the code (or any content) is rendered in the vertical panel. ALWAYS vertical. Reason for this is that horizontal views are good for just a few items with a long string as an item display text. Example: traces, debug output, build errors, any sort of logging.

However CodeMap exhibits exactly opposite nature: many items with short display text. Thus using CodeMap in output is not possible without constant intense scrolling.

The proper solution would be to allow the output panels to be positioned vertically. But... ST team is incredibly resistant to this sort of functionality. Meaning that plugin developers (like me and others) have to go through an extreme pain of faking vertical view with a text view/tab. Working but nasty technique.

The true solution to the problem is in the ST3 team hands. If they ever allow vertical panels (custom view) I will immediately rework CodeMap and Favorites to benefit from it. This BTW will also shrink these plugins codebase by ~80%.

I am not closing this issue. May be if people upvote it ST team may change their heart and actually consider custom output views.

Acecool commented 6 years ago

I am interested in the idea of better panels, but I'm having trouble viewing the st forum... I'm posting a response to this to show of another way to improve the output panel for CodeMap - Code-Named XCodeMapper: https://bitbucket.org/Acecool/acecooldev_sublimetext3 Notes: ( You only need GMod Lua folder if you want to add the AcecoolDev_Framework for Garry's Mod -- Also, it makes it very easy to set up CodeMap to map what you want it to map for your specific projects... I am working on changing the configuration system, possibly, to make it more dynamic to get rid of the repeated config loader in each vanilla class, etc... )

Here are a few images of what it looks like:

New Addition: Bat file support - https://www.dropbox.com/s/358iwi7y6cp48jf/sublime_text_unregistered__screenshot_20180109050113_329.png?dl=0

JavaScript using my ultimate web-site modding tool ( Adds eBay AJAX Cart, still working on it but the back-end is almost complete and it works but it doesn't currently move the divs around, etc... just text based updates ) and ( BitBucket alter links in /src/ to always point to /master for easier hotlinking, and much more... This shows how to read comment,s or function arguments and output something usable in the output window ): https://www.dropbox.com/s/8pcqdubas5ycrma/sublime_text_unregistered__screenshot_20180109044803_7634.png?dl=0

AutoHotkey ( Alters the special keys of * and ~ to tell you what they're for in the output and also tells you Ctrl, Alt, Shift, Win keys if used in a hotkey - properly maps functions and classes too [ ! ALT ], [ ^ Ctrl ], [ + SHIFT ], [ # WIN ] ) - https://www.dropbox.com/s/ko5ejadvbyvgvcw/sublime_text_unregistered__screenshot_20180109044734_8188.png?dl=0

Another AHK file - this one with functions and class... https://www.dropbox.com/s/4ktx3v9fihjyi84/sublime_text_unregistered__screenshot_20180109044442_429.png?dl=0

Lua - specifically Garry's Mod Lua support along with AcecoolDev_Framework mappings ( You choose which ones to start with and all classes have a _User class you can design for your own projects - mine has support to expand AccessorFuncs to add the functions the AccessorFunc functions add to the entries list to the appropriate category - easy to set up AccessorFuncs! the Garry's Mod Lua variant has one - AccessorFunc ) - https://www.dropbox.com/s/4v1sw803jk65let/sublime_text_unregistered__screenshot_20180109044704_1329.png?dl=0

https://www.dropbox.com/s/avs8lnrkfd3kwxj/sublime_text_unregistered__screenshot_20180105060537_3814.png?dl=0

Python mapper - The default one doesn't have the all upper-case added, but the XCM class does ( XCodeMapper project mappings for the AccessorFuncs created and more ) - I am still working on correcting the nested class output - but it will work for files such as sublime.py as they don't nest classes... https://www.dropbox.com/s/eueih07pdd2qzcn/sublime_text_unregistered__screenshot_20180109044613_960.png?dl=0

https://www.dropbox.com/s/nhvo9n8o1iobtsi/sublime_text_unregistered__screenshot_20180109044602_7773.png?dl=0

sublime.py being mapped - https://www.dropbox.com/s/f9yj00p2jf9tg02/sublime_text_unregistered__screenshot_20180109044555_7884.png?dl=0

https://www.dropbox.com/s/49ubrae8e7bki8a/sublime_text_unregistered__screenshot_20180109044541_1775.png?dl=0

XCodeMapper.py for the XCodeMapperBase - https://www.dropbox.com/s/wu46wj63gebq8u2/sublime_text_unregistered__screenshot_20180109044529_3646.png?dl=0

AcecoolST3_Library.py - https://www.dropbox.com/s/uy43s9u21wq2qbd/sublime_text_unregistered__screenshot_20180109044503_2576.png?dl=0

Code - Map, in its simplicity can be modified to do great things... I'm transforming my XCodeMapper into a live-wiki type system to be used to give the most concise output providing the most information possible in the smallest space... There are a lot of config options and you can add earmarks with 1 line of code. You can expand AccessorFuncs using as few as 2 to 3 ( depending how many functions the AccessorFunc adds ) lines of code ( if pattern == 'AccessorFunc' ): self.AddEntry( CATEGORY_FUNCTION, ...... )

In short, you can customize XCodeMapper for your desires, your specific project goals, etc... and it is easy. I may later on add text file support to add rules that way, but honestly the code required is short... self.AddSyntax( CATEGORY, SEARCH_MODE, 'what to look for', 'and if more needs to be added to the same category and same search mode', 'you can simply use the varargs feature to keep adding', 'the elements to look for in the same function call' )

There are a lot of callbacks too! I use several of them to look for easy to miss syntax errors... In Python I make sure function and class definitions end with : ( or if they're single line with other code in the line, I make sure the : exists ) otherwise the output code is modified by adding [ ERROR ] to it, and a syntax error entry is added ( syntax error category is at the top of the list by default )...

It can be used to increase efficiency and help debug code by looking for syntax errors... I'll be extending support for this soon by using the lexer to check for invalid entries for each language later on... I am also planning, as I said, to use this for education - basically if you load a file called XCodeMapper_TutorialMode.ext it'll list the tutorials you can run - then it acts like a program waiting for you to write code and explaining what each step does... I'll need to write an object to handle this and I may end up turning that into a separate extension - but this is just to show how much you can do with simple panels.... The idea of having advanced panels, though, is welcome because you can do even more... The one issue though, is the more you can do, the greater chance someone makes a mistake and causes a memory leak ( reason I left Notepad++ is because Function List addon had a bad memory leak, not to mention N++ also froze the program, non-threaded, during searches, etc... ) I do prefer simplicity when it comes to ides...

Sorry for the wall of text. but hopefully this adds something to this discussion...

The next update which include the renaming of the files will be out today, shortly...

oleg-shilo commented 2 months ago

Closing as no longer active