Sublime Text Addon to map code ( Python, Sublime Text ) What do you use to code? - - An Overclocking Community

Forum Jump: 

Sublime Text Addon to map code ( Python, Sublime Text ) What do you use to code?

Thread Tools
post #1 of 2 (permalink) Old 07-01-2018, 11:21 PM - Thread Starter
New to
Join Date: Jun 2018
Location: Hendersonville, NC
Posts: 100
Rep: 0
Sublime Text Addon to map code ( Python, Sublime Text ) What do you use to code?

What do you use to code? I prefer simplistic ui and have for the past almost 30 years of coding. I hate anything which adds code or junk in markup, etc... I'm also all about efficiency and I love how Sublime Text uses multiple threads and doesn't lock the UI during searches like Notepad++ and other editors ( also Sublime Text maps your project files making searches instant or close to it )... I have tried Visual Studio Code and Atom but both are slow and Notepad++ has so many issues and memory leaks with addons I need to to make it viable for use...

As of now, I have been using Sublime Text 3.* latest and a range of addons including one I am building ( Similar to CodeMap but with a category system, and callback systems with multilingual support ( soon ) so file extensions which support multiple languages can be mapped simultaneously such as .php which has 6 or so ( PHP, HTML, JavaScript, CSS, SQL, RegEx [ for JS and PHP implementations ] ).... I'm also working on a ton of features for it - basically it maps your code and provides an output similar to what IDEs provide where you can easily jump between classes, functions and the like. Since I originally made the system for CodeMap ( which is a plugin for Sublime Text which does something similar on a VERY basic level without proper category support and a few bugs to boot.... My system plugged into it and returned the data to it so it could output - I hated the circular import system, that other naming of files wasn't supported and much more so I decided to make my own system )....

In case anyone is interested in my addon: Add Repo: -- then Install AcecoolCodeMappingSystem -- then right click code > Acecool's Code Mapping System > Toggle ACMS Panel -- also in the menu use [ ACMS ] Settings: Plugin which uses my edit_settings_plus system to open all of the relevant settings files in its own window and even adds quick switching so if you click on one file in one side ( left is base / default, right is user config ) then the other opens the same....

The whole goal of this system is to improve coding efficiency by making everything you want to track in your code easy to find and a double-click away to jump there ( I may change it to a single-click soon ).

It has some error checking capability ( I coded a few typical typos to look for in some languages, and more, which are easy to glance over and miss especially if you work with dozens of languages )... I am building a tutorial type system into it to output what the code should look like for the error which was discovered, and much more...

I listen to users so if there are features you want, ask and I'll see what I can do for you!

If there are bugs, I listen so let me know and I'll fix them. - Note: I am working on a large number of features while simultaneously optimizing, getting rid of old code, etc.. but if there is an issue I don't mind jumping straight to that - so let me know!!!

If there is a language you want supported by default, let me know! Note: Some of the files I added aren't populated with data - here is the current list of languages which are supported following by the list I am planning on adding my default ( Additionally, because Sublime Text has a symbol system, if the language is mapped for highlighting, etc.. then I can pull data from there to provide default mapping for all languages regardless of whether there is a mapper for it or not but I need to change a few things around for it - also it means the maps linking some of the files need to be removed as of right now if a map is set up and there is an issue loading I output an error message with debugging steps to correct the issue - I may add the symbols system above it by default though in that case or display a shorter message and refer to a help file with an error code to use )...

Languages currently populated:
  • AutoHotkey
  • BatchFile
  • C++
  • Lua
  • Garry's Mod Lua
  • JavaScript
  • JSON ( Basic Support for Sublime Text Config Files )
  • MarkDown
  • PHP ( Basic Support)
  • PlainText ( Numbered Line Output )
  • Python
  • TypeScript

Languages added with limited support:
  • JSON ( Basic Support for Sublime Text Config Files )
  • PHP ( Basic Support)
  • PlainText ( Numbered Line Output )
  • SublimeKeyMap ( Uses JSON )
  • SublimeLanguage ( Uses JSON )
  • SublimeMouseMap ( Uses JSON )
  • SublimeSettings ( Uses JSON )
  • SublimeSyntax ( Uses JSON )

Planned Languages:
  • ASP
  • C
  • C#
  • CSS
  • HTML
  • Java
  • JSON
  • PHP
  • SQF ( Arma / OFP Scripting Language - Functions )
  • SQS ( Arma / OFP Scripting Language - Scripts )
  • XML

Note: All languages, by default, have a 'User' mapper file so Python has: - these files are meant for you to create custom mappers for your projects, or to simply extend or modify the language in question...

By DEFAULT, all languages load the User map... Copy these to the %AppData%\Sublime Text 3\Packages\User\AcecoolCodeMappingSystem\maps\*.py file / location to have the system load the files from there... The system always checks the user folder first! ( Note: The main files are in the same path if you remove User\ from it )

They are EMPTY barring 2 task lists ( one empty, one with basic instructions ), a header listing the language and listing user mapping file and a blank <author_name> place-holder, the class-name for the file which is looked for ( Note it is essentially the file-name with ACMS_ added as a prefix - but you can also change the class-name by using the active_class key in your configuration files for the acms_language_map - DO NOT SET THIS OUTSIDE OF A LANGUAGE MAP otherwise every file will look for it by default - although I do look for the default naming schemes so it won't cause an issue loading the class, but it will add additional logic to process which isn't necessary ) and the class __name__..... To create your own either edit the User file after copying it to the User folder by adding callbacks... Or rename the file and the class within to what you want using the format: case sensitive for now....

I am working on on many updates, for instance I am getting rid of the arguments for all callbacks and simplifying them to ( self, _object ) with the return being simplified also to _object if any updates have occurred.... This makes it future proof... It has a caching feature so when a file is mapped and hasn't changed it won't reprocess the file ( if config files have changed, main mapper files, core files, etc... then it will )...

Here are some screenshots:

Shows the GMod Lua language / mapper language being used with the AcecoolDev_Framework Project Mapper loaded... ie which includes which includes ( Vanilla Lua ) with inheritance all the way through.
The top of the file shows some of my AccessorFuncs being called along with a normal function and console command - the right side is the mod itself which maps all of the functions and anything else I want mapped.

You can change how the data is displayed - so by default I have it split up the meta-tables / classes / objects, libraries, etc.. into nested categories to save space... so instead of Acecool.C.timekeeper:FuncName( args ) you see FuncName( args ) in the Acecool.C.timekeeper category ( and this is showing a build I'm working on so I don't have the tabs added for this nested category which will be fixed soon )... This system is also in the Python language...

This is Python with the ACMS Mapper loaded with the categories split up...

This is Python with the ACMS Mapper loaded with class-names combined and not put into separate categories! - This is a HUGE difference in how much data is shown per line and it is harder to find the function name in this mess... Also I see a bug ( Shouldn't be in current uploaded version where the math function symbol I use to denote functions or [def] in Python, function in Lua, etc... is shown twice instead of once...

Here are some of the mappers used in the above screenshots...

These are the mappers so you can see how mappers can easily be set up ( You really only need the OnSetupSyntax callback to map your projects, although if you want to map AccessorFuncs to functions you'll need to add them, soon it'll be much easier to create them by just assigning rules and replacers will be available for the args used so "{0efault}:{1:Get}{2:FuncName}( {3:GetterArgs} );\n{0efault}:Set{2:FuncName}( {4:SetterArgs} );" as a quick example could be how easy it'll be as I already have helper funcs to grab the args in code, and there are callbacks called for each function arg in code, and class args too, and right now it's a bit more work as you call the func for each arg and then set up the AddEntry lines to add the functions )...

Shows the vanilla Lua definitions such as comments, functions, and I also have entries for constants, enumeration, etc.. ( I use all uppercase for these )... Also a few optimization finders so it looks for print( and debug. as print statements are costly especially in games..

Garry's Mod Lua additions, so these would be checked for first before Vanilla Lua and it adds C style operators which are reflected here with the comments, block comments, and it also adds support for Garry's Mod Lua AccessorFunc calls, networking calls, realms, and more..

This is for my framework in Garry's Mod and it adds support for all of my AccessorFuncs, and other things within my framework / project I want to be mapped...

This is the Python mapper

This is the AcecoolCodeMappingSystem Mapper which adds support for AccessorFuncs in my project, adds const definitions if configured to do so, print notify and other info, and also various ACMS Mapping calls such as self.AddEntry which adds an entry to the output...

The active_mapper is AcecoolDev_Framework, and the active_language is GMod_Lua with the name being <ActiveLanguage>.py if the active mapper is Default, and <ActiveLanguage>_<ActiveMapper>.py if not... I may convert these to all lowercase soon...

Note: I am working on version 1.0.0 and I've had to change quite a lot because of the previous system working around CodeMap, circular imports, etc... so I am streamlining everything...

Some of the features I am adding are:
  • Per Character Mapping for Output Panel - this means you can map Acecool to the Acecool definition, .C to that definition, .timekeeper to that :FuncName to that, and each argument can be hovered over for information, for instance... Or completely different.. The system lets you decide and by default double-clicking the line will jump to the line where the entry was found... Some languages will have default wiki-like on_hover windows added to the entries... Tasks, Notes, etc.. will by default have the entire line shown so if you cut off the line early because of space then you'll be able to easily see it in the popup for those with smaller monitors...
  • Self contained window - Right now you can only have one mapper open on one window and it'll only map that window - I am adding a system which lets you open the system in its own window so it can map ANY file which is focused and this also lets you side the system however you want and move it into other monitors, and more... This will be sooner than 1.0.0 likely in one of the next updates..
  • Dynamic Output System - This will allow the output to be live filtered / masked / sorted / etc... depending on options from the next feature....
  • IDE-Like Selection System - This will add a toolbox panel which operates like an IDE panel header from a similar styled code mapping system to display everything you want and nothing more - ie you'll be able to choose to show all tasks, nothing else, or hide tasks and show everything else... You'll be able to choose classes ( which will be output either this panel or the main panel as it currently is with a search icon next to it to quickly show or hide results based on your previous show / hide selected option in the toolbox ) to show all results from or hide.... Additionally, the toolbox will have other links such as a text link to open a search bar to do a live manually typed search to update the output panel as you type... and more...
  • Background Preprocessing / threads - To further reduce lag when processing files, if the caching system is enabled and the threading system is enabled, the system will pre-process files in the background in worker threads so when you click on a file it only needs to load the cached file... Right now on my 10 year old system it takes 0.4 seconds to process a file but only 0.02 seconds to load the cached file from an SSD....
  • Backup system - I am adding a backup system which can be enabled or disabled which will allow you to backup x number of files of each file you edit each sublime text session and keep x sessions backwards, and a max of x files per session, etc... there will be other settings to delete backups based on date, etc... and the reason I am making this ( I may make it into its own addon ) is because I do HUGE changes in code during updates and sometimes I mess up or sometimes I want to look at an old version ( which wasn't uploaded ) and no longer have it, or they're in zip files and I have to dig - this will be much much easier to navigate.... It can be disabled, as said, and by default it will most likely be disabled...
  • Adding commands to allow files to be changed - ie a command ( needs to be activated in config ) which you must also run manually which will edit the file you're working on by adding Parameter comments to each class, function, etc.. in your file... Others to sort functions in classes, out of classes alphabetically, and more... You'll need to enable these in the config files, and you'll have to call them manually if you want to use and there will be safeties in place to ensure you won't be destroying data
  • also there will be a template system in place as to how the parameters are added so you can use my style which is 3 comments with the center being the main description and the other 2 empty, and 2 more added for params with the bottom empty and the top being @arg, return, or whatever... the arg name, if applicable, the data type, a description, etc.. and all of this will be configurable and I plan on mapping the main languages so Lua, GMod Lua, Python, etc... will have a lot of the default functions set up so all of this information will be available ( meaning if you have it in the output window the data-types of each arg, and more will show up, and also if you extend the default then that info can show up too ).... multiple returns will be supported..
  • Rule system which can apply to everything from the sorting ( ie keeping __ prefixed functions at the beginning, end or whatever ), to coding standards ( to detect when a file isn't using your standards to help keep everything nice and neat ), to AccessorFunc defintions, to setting up languages, to applying how languages are loaded ( see next ) and more..
  • Rule system specifically to define how mappers are loaded - for instance right now I have it map the file extension to the 'language / project configuration table name' and its in quotes because it can be ANY name you want ( I will also add a mapping system so based on the syntax you use for a file it'll load the appropriate mapper so you don't have to set up extension maps if you don't want to and there will be an option to enable that feature or disable ) which links to a configuration table which defines the language used, the mapper used, and more.... but the rule system will extend is so instead of linking to a single table you'll be able to set a default, if nothing applies, then you can define if x is in the directory path ( such as garrysmod/ ) then it uses GMod_Lua instead of vanilla Lua and if acecooldev_framework/ is in the path, then it'll use the AcecoolDev_Framework mapper, and so on... Fully customized and it'll support more than path - it will apply to paths, filenames, which syntax is used / active, and so much more and it can be a combination of any single option or all.....
  • Adding default Region Maps ( this is part of the any character mapping system for the output window ).. The following will be included by default so you can map any character to any of these: insert a snippet, run a macro, open a website, jump to a line in a file, Create an informational dialogue / window, Jump to a bookmark in a file, Output text, Show basic ToolTip, Run Command, and maybe a few more --- NOTE: These will be assigned, by default to things such as on double click, on click, on hover, etc.. but can be changed as you see fit and you can make your own..
  • Lots of optimizations....
and so much more..... but those are the main goals for 1.0.0 along with more optimizations, less repeated code ( there are some areas and my current build has a lot of code removed which was redundant ) etc...

As of right now it is fast, and for very long files it saves a LOT of time because it alphabetizes all functions within classes, it saves space because of the current design and default config splitting up class-names, etc... it makes jumping to functions, classes, potential errors ( some error checking ), notes, tasks, etc.. markers in code so quick and easy - the amount of time I've saved using it is incalcuable as I have files which are 10,000 lines in some cases and scrolling to find functions is a pain and with this it can generate output which is organized, very short, etc.. and it makes finding things so efficient...

There are plenty of options to make the output show even less for those with smaller monitors..
Acecool is offline  
Sponsored Links
post #2 of 2 (permalink) Old 07-04-2018, 08:40 PM
New to
Trippen Out's Avatar
Join Date: Feb 2006
Location: Pinellas Park, FLorida
Posts: 5,043
Rep: 322 (Unique: 259)
When I am writing python I use one of two programs. Vim and Spyder2/3. If I am writing other then python then Vim for the win. I like things simple.

Living Under Bridge

Trippen Out is offline  

Quick Reply

Register Now

In order to be able to post messages on the - An Overclocking Community forums, you must first register.
Please enter your desired user name, your email address and other required details in the form below.
User Name:
If you do not want to register, fill this field only and the name will be used as user name for your post.
Please enter a password for your user account. Note that passwords are case-sensitive.
Confirm Password:
Email Address
Please enter a valid email address for yourself.
Email Address:


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Show Printable Version Show Printable Version
Email this Page Email this Page

Forum Jump: 

Posting Rules  
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off