Sublime Forum

CodeMap - interactive code tree plugin

#21

I’ll probably end up with a 4k monitor so 4 monitors in 1 - and I have 4 more right now ( 5 total 1920 x 1080 ) but with a 4k I may end up with 6 total monitors ( if I end up running them all - with the 4k monitor I may use the 4k, then another monitor above it and maybe one off to the side - or I’ll simply continue using the 750 TI to run 3 monitors and have the 1080 run the 4k monitor… ) with about 9 monitors worth of real-estate so I should be ok. Maybe, later on, I’ll write a plugin to add panels support to ST3 if it is open-source otherwise I’ll have to find a way to inject…

The way I code is with simplicity, no repetition, strongly enforced coding standard, etc… Everything is coded so there is no way to introduce bugs as everything is simplified all the way so you end up with building blocks and each block is tested for all conditions before being released.

As for my mapper, yes I would be fine with it being released with CodeMap and I’m not forcing it on anyone - it’ll be a simple python script base, which if anyone wants to use it they can use my example to see how to use it until I write documentation or modify my wiki generator for Lua to parse it… In short - the mapper will be included into the mapper file, then initialized and the rules set up…

I’m not expecting you to rewrite the back-end to support it which is why it is in the mapper side of things and no one will be forced to use it if they don’t want to…

When it is ready, I’ll post it here.

0 Likes

#22

Here’s a link to my addon for this mod… It makes it better, more organized and easier to create mappings for it… Soon to come, hopefully, automatic additions of rules based on sublime syntax / tm language files, etc…

1 Like

#23

I think I would not attempt to use it until they allow to hide the minimap per view, instead of per window only, because my screen is not too wide and I would like the minimap enabled:

0 Likes

#24

It is possible!

Download my addon… Install CodeMap first, then install XCodeMapper over top…

One of my next updates will address being able to EASILY modify the functions, but for now you can add a callback to the _User class in AppData/Sublime Text 3/Packages/User/CodeMap/custom_mappers/.py ( Each mapper from XCodeMapper will have the _User class set as the DEFAULT near the top of the file at the bottom of the configuration ):

	##
	## Callback used to alter Code - Map Panel configuration per mapper...
	##
	def OnSetupCodeMapPanel( self, _panel ):
		## Disable Scroll Past End...
		print( ' >> Code - Map Panel >> scroll_pass_end set to False!' )
		_panel.settings( ).set( 'scroll_past_end', False )

		## Note: If gutter is set to false, line_numbers and fold_buttons won't appear so it they don't matter if gutter is False..
		_panel.settings( ).set( "gutter", False )
		_panel.settings( ).set( "line_numbers", True )
		_panel.settings( ).set( "fold_buttons", False )

		## Do you want to use a smaller font in the CodeMap panel? set it here... For 4k monitors using Source Code Pro font I'd suggest 10.5 if you use 100% api scaling... For 1080p, etc... 10 - 11 is also fine.. although smaller may be suitable too...
		_panel.settings( ).set( "font_size", 8 )

		## The actual map WIDE scrollbar system which shows an overview of the code - minimap - trying to find the right now - so far I confirmed you can individually set ( per view ) the drawing of borders, etc.. so the minimap shouldn't be any different.. I just need to find the config value:
		##_panel.settings( ).set( "xxxxxx", False )


		##
		## Found it - but it disables it for the entire window.... I'll see if I can come up with a hack... but the best solution would be to persuade them into adding the functionality per panel / view instead of setting it per window...
		##
		_panel.window( ).set_minimap_visible( False )

Basically - _panel is the “Code - Map” View / Panel… You can call settings on it to alter the behavior WITHOUT affecting your other view… Meaning if you know what the minimap is ( possible just “minimap” ) then you can hide it without hiding it on your other view…

I had to create this functionality in order to disable scroll past end for code map but not my normal files because the code-map sync feature can sometimes scroll you to the bottom… I’m working on a solution for that, but for now this is useful…

I will be adding CFG_ options to each mapper to let you choose what to show / hide ( at least until I can figure out why my config.sublime-settings files aren’t being loaded when they have unique names and are in the root directory, ie easy to find )… For now you can add the callback and edit the settings as you want them to be!

0 Likes

#25

Please see my previous post … If you install XCodeMapper I have several different views ( check out the screenshots ) which are tailored for YOU…

In short - When outputting code, by default I use the mathematical sign for function: ƒ and I add this sign to several of the languages ( Python, PHP, GMod Lua and possibly a few others - check my repo ) which means less data to show…

There is also a data-type / arg system replacer which lets you define ( if you follow a coding standard, something I highly recommend ) arguments to replace with their data-types so you can replace _ply or _player with ,

or something shorter / longer and with or without < >s… Or you can shorten the args using the OnFunction/ClassArgument callback by simply returning a different string ( you can automate it by truncating the text, etc… )

There are a lot of other callbacks which lets you customize what you see and how you see it…

The screenshots I’m referred to, though, are the ones which changes how classes and children are displayed… By default, with Lua they’re displayed using the table.index.subindex.FuncNameAsAnotherIndex = function or function …( )… However I’ve added a mode where you can display it in parts - so instead of seeing the full-length for Lua ( Or Python ) you see a category named: table.index.subindex with FuncNameAsAnotherIndex as an entry with the args… For Python I extend it even further so you have the option to display it like Lua with only DirectParent.FuncName( args ) or Full.Path.To.DirectParent.FuncName( args ) OR DirectParent as the category name, and FuncName as an entry…

Take a look at my modification… It may be what you’re looking for. If it isn’t - let me know what you want and I’ll likely add it in…

Oh, you can also adjust the indent size ( I have it set to 4 spaces - you can just as easily use 1 tab, 10 tabs, 1 space, 2 spaces, etc… set it to what you want ) to save a few extra chars…

0 Likes

#26

Updated:

		##
		## Found it - but it disables it for the entire window.... I'll see if I can come up with a hack... but the best solution would be to persuade them into adding the functionality per panel / view instead of setting it per window...
		##
		_panel.window( ).set_minimap_visible( False )
0 Likes