Sublime Forum

Sublime Symbols Dynamic Modification?

#1

I have been trying to get threading working on my plugin but I may actually rewrite it because of how I originally created it - the threading system works, but it still locks up the UI thread when used and that could be something simple or built right into the core of the system so I want to see if there is another way to improve the efficiency of the plugin. Right now I use a very simple but expensive process to map files which had to be used when I created a plugin for CodeMap. Since I’m no longer extending that project via stand-along plugin added to it, I have a lot more freedom and I’d like to use that freedom to look more into the Sublime Symbols system as it works project-wide and file-wide.

I was trying to increase performance and I have gotten it to around 0.1 to 0.01 seconds to load a cached file, but it can take substantially longer to map files. I work work large files on a 10 year old machine so it can take 10 seconds ( typically 6 ish for 15,000 lines and hundreds of entries, expansions and more ).

Sublime Symbols are captured in the background already, which is why I added a simple sublime Symbols system into the plugin, but I want to go a step further. Right now symbols are what Sublime Text provides me and I would be able to create new symbol mapping files but that would mean for each language I’d have to create a file…

I’d rather not do that. I’d rather capture ALL symbols, then process them that way… Or capture all function calls, function declarations, class declarations, and so on individually. But I have yet to find any function in the api which points towards creating sublime symbols dynamically.

It’s easy to highlight symbols by loading the list of symbols Sublime Text provides you and processing them since they provide information such as the line, start character, end character… The only other thing I can think of is to go through each syntax file, or when a new language is selected, and process the file to extract all of the possible symbols then create a file which would extract them then set up a map to ensure those are categorized using my system.

But there must be a way to do it in a more fluid manner - does anyone know of a way to set extracted symbols to * or something to ensure the generated list includes everything… Or a way to filter / mask the list easily using Sublime Text back-end?

This would ensure the mapping would almost entirely happen inside of Sublime Text Threading System and it would also index the project as the project changes making the plugin a possibility to be added natively into a Sublime Text release.

It improves efficiency so many times over, I believe everyone should have easy access to it and with the new features I have planned, it would make Sublime Text on par with some of the most advanced IDEs without the bulk or lag issues.

Thanks in advance

0 Likes

#2

I decided to try something. I created a tmPreferences file in my plugin root directory… I changed the scope to * and it seems to show a lot more in the Symbols list, but it doesn’t show function calls, or a lot of other things I need such as comments, and more. I know for a fact that variables are extracted using Symbols, so there must be a reason why it isn’t showing everything. Either the tmPreferences file isn’t working and I just think I’m seeing more, however I have never seen SQL things or block-strings show up before and they did exist which makes me believe it is working…

Without being able to display everything, this is almost useless… I could use it to extract a lot of information meaning less things need to be checked for on a line by line basis, but those few extra things don’t require a lot of processing power in addition in the first place - it is the combined effect which is causing the issue…

This is the file contents: SublimeListAll.tmPreferences

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Sublime Symbols - Capture all 1.0//EN">
<plist version="1.0">
<dict>
	<key>name</key>
	<string>Symbol List: All</string>
	<key>scope</key>
	<string>*</string>
	<key>settings</key>
	<dict>
		<key>showInSymbolList</key>
		<integer>1</integer>
	</dict>
	<key>uuid</key>
	<string>92E190C9-A861-4025-92D4-D6B5A24C22D4</string>
</dict>
</plist>

Not sure what uuid is for, yet - maybe someone can shed some light. Found this text snippet in the forum except for a specific scope so I changed it to * to see if it would work and it appears as some is shown… But if anything is ignored, which is what is happening, it renders this line of detection problematic.

If I have to set up a symbol list for each and every language I support, it also creates problems. I have a default mapper which is supposed to load for unmapped languages and adds the symbols - if I have to create the list for every language then I may as well create a mapper… This is why I want to make it more dynamic, in addition to the gained efficiency and supporting many more languages as long as a syntax file exists…

0 Likes

#3

Could you please phrase your problem in a short paragraph of 2-3 sentences? It’s quite hard to filter out the noise in your posts and find the actual problem you are looking to receive help for.

Anyway, regarding symbols, refer to http://docs.sublimetext.info/en/latest/reference/symbols.html.

0 Likes

#4

I am looking for a way to dynamically receive a list of all Sublime Symbols, unfiltered, for the language / view in question. in addition to dynamically altering the symbols available…

From what I’ve seen so far, I have to create a file for each and every language, but I have to actually specify the symbols which I don’t want to do.

I tried the file above with the * and while it looks like I may have a few more symbols in the output, I still don’t have access to comments, function calls, and more.

In short: Is there a way to dynamically, for a view or window, define the symbols which are returned? ie set to * and see all, or something… without having to create a file for each and every language for each and every symbol, etc?

0 Likes