Raised This Month: $32 Target: $400
 8% 

[Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NicholaScott
New Member
Join Date: Feb 2016
Old 02-13-2016 , 00:06   [Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3
Reply With Quote #1

Warning: I take no credit for these creations, I did not code them myself and I will give credit to the proper individuals!

The reason I am posting this is because it took me over 2 1/2 hours to find the proper links, and set this up correctly. Now onto the tutorial!

*Note: I've only tried this on Windows 64 version of Sublime Text 3, however I'm sure it will work properly for other versions of windows and for your OS, but for the sake of this tutorial I will only be covering instructions for Windows 64bit, this includes download links I put below!

First off let's state the obvious that I had the most trouble with, this will not work with Sublime Text 2, it will only work with the latest build of Sublime Text 3. If you want to update your Sublime Text and keep all of your file associations in windows I highly recommend going to your program locations for your current sublime text and deleting all of the files inside of the folder, leaving an empty folder named <installname, ie. Sublime Text 2> or whatever your folder was called, now go download Sublime Text 3 from here and install it to the same directory that you deleted all of the old sublime text files out of.

Step 1. Download SourcePawn Dynamic Include Syntax(I'm not sure the proper name for this tbh, it allows you to get function info from a #include)(GitHub and all credit to this user: https://github.com/d-ai/Sourcepawn)
- SourcePawn Dynamic Include Syntax

Step 2. Open Sublime Text 3 and Get Project Control
- Open Sublime Text
- Hold CTRL and press `(key above tab, next to one: The Tilda Key)
- Paste this into it: import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
- Hit Enter
- Now Restart Sublime Text!

Step 3. Install SourcePawn Syntax Highlight(all credit to this user: https://forums.alliedmods.net/showthread.php?t=204535
- Inside of Sublime Text 3, Press CTRL+SHIFT+P and type Package Control: Install Package
- Hit Enter
- When the Dialog Opens Type SourcePawn
- Hit Enter
- Done!

Step 4. Install The SourcePawn Dynamic Include Syntax we downloaded in Step 1(This Package also has a build option for compiling however I couldn't get it to work so I will be leaving it out(Sorry))
- Inside of Sublime Text 3 click Preferences>Browse Packages...
- Extract the .zip we downloaded to the folder your Sublime Opened, the dir should look something like: .../AppData/Roaming/Sublime Text 3/Packages
- Now go into the Soucepawn-master folder you extracted and rename SPCompletions.sublime-settings.example to SPCompletions.sublime-settings
- Open Sourcepawn.sublime-settings and SPCompletions.sublime-settings with Sublime Text 2
- Inside of Sourcepawn.sublime-settings you can change your color_scheme to whatever you want, you can get the path name from Preferences>Settings-User. !Warning don't use the default one provided in Sourcepawn.sublime as it will not work and glitch out the ui for sublime text
- Inside of SPCompletions.sublime-settings you will need to get the directory of your scripting files are, and more specifically your include folder(For including syntax's of course ):
So for example, say my directory to were I am scripting for sourcemod is
C:\Users\Nick\Desktop\CSGO\csgo\addons\source mod\scripting
I would take that and add an extra "\" to each backslash(escaping backslashes) so the new directory would look like
"C:\\Users\\Nick\\Desktop\\SteamCMD\\CSGO\\cs go\\addons\\sourcemod\\scripting"
now we need to specify the include folder to the end( this will be the same for every user, unless you have your sourcemod include files somewhere else!??! but why would you do that) the final directory will look like
"C:\\Users\\Nick\\Desktop\\SteamCMD\\CSGO\\cs go\\addons\\sourcemod\\scripting\\include\\".
Now inside of the SPCompletions.sublime-settings you replace the directory in quotation marks prefixed by "include_directory":, so that line should now look like
"include_directory": "C:\\Users\\Nick\\Desktop\\SteamCMD\\CSGO\\cs go\\addons\\sourcemod\\scripting\\include\\",

That's it! Restart Sublime Text 3 and you're good to go! Have fun, post below if I messed something up ;)

Some Pictures For What You Can Expect!
The nicktest.inc I'm using for this example:


What that file contains:


and the #include <nicktest> and the syntax being autocompleted:


and what happens when you hit Enter:

Last edited by NicholaScott; 02-13-2016 at 00:26.
NicholaScott is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 02-22-2016 , 04:30   Re: [Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3
Reply With Quote #2

HTML Code:
WARNING: Please do not redistribute the install code via another website. It will change with every release. Instead, please link to this page.
https://packagecontrol.io/installation
ImACow is offline
Phil25
AlliedModders Donor
Join Date: Feb 2015
Old 02-29-2016 , 02:03   Re: [Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3
Reply With Quote #3

Holy damn, I love you man! I've been trying to switch to Sublime Text for a such a long time.

Cheers

Last edited by Phil25; 02-29-2016 at 02:04.
Phil25 is offline
GAVVVR
Member
Join Date: May 2010
Old 02-29-2016 , 16:07   Re: [Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3
Reply With Quote #4

Long story short:
  1. Download ST3 from here
  2. Open Sublime Text -> Preferences -> Browse Packages and clone the repo to packages dir:
    Code:
    git clone https://github.com/d-ai/Sourcepawn
  3. Rename SPCompletions.sublime-settings.example to SPCompletions.sublime-settings and edit set up the folder with sourcepawn includes. Paste an absolute path, relative paths are not supported. Do not forget to escape every "\" in pasth.
  4. Rename SourcePawn.sublime-build.example to SourcePawn.sublime-build, here is my example:
    Code:
    {
    	"cmd": ["C:/users/username/sourcemod/scripting/spcomp", "-o..\\plugins\\\\$file_name", "$file"]
    }
GAVVVR is offline
David92
Junior Member
Join Date: Aug 2012
Old 06-15-2016 , 21:57   Re: [Tutorial] Syntax Highlighting + Dynamic Include For Sublime Text 3
Reply With Quote #5

a version for amxmodx?
David92 is offline
Reply



Posting Rules
You may not post new threads
You may not 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

Forum Jump


All times are GMT -4. The time now is 17:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode