Raised This Month: $12 Target: $400
 3% 

[TUT] Compiling AMXX plugins with Sublime Text


Post New Thread Reply   
 
Thread Tools Display Modes
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 02-13-2017 , 11:54   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #41

I tried to do it a several times, but this is one of the three problems I could not fix.
  1. Lets call this the first problem.

  2. The second problem is when you put the open paren on the next line:



    To fix this the only way is the Sublime Text developers to do it. For more details see:
    https://forum.sublimetext.com/t/how-to-match-a-function-call-spitted-across-multiples-lines-on-sublime-syntax/22392

  3. The third problem I can remember of is the preprocessor messing with the open
    and closing braces. It is working fine, if the C preprocessor do not mess with it.
    Example, this will unbalance the brackets, from the line 384 up it will show one
    extra scope meta.block which does not popped, as on the preprocessor define
    there is one opening unclosed bracket at the line 378.
    Code:
    370: public own_type:on_damage( id ) 371: { 372: #if defined DAMAGE_RECIEVED 373:     // id should be connected if this message is sent, but lets check anyway 374:     if( is_user_connected( id ) ) 375:     { 376: #else 377:     if( is_user_connected( attacker ) ) 378:     { 379: #endif 380:         ShowSyncHudMsg( attacker, g_MsgSync, "%i^n", damage ) 381:     } 382:     hi_girl() 383: } 384: 385: public on_damage( id ) 386: { 387:     get_user_attacker( id ) 388: }

    For more details see:
    https://forum.sublimetext.com/t/syntax-how-to-match-block-when-the-c-preprocessor-is-unbalancing-brackets/22932
Now I am reviewing and rewriting the syntax with rigorous Unit Tests.
Though, I am not sure I will be able to fix two out of the three fixable syntax problems.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 02-13-2017 at 11:57.
addons_zz is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-13-2017 , 17:55   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #42

Eh, i guess it is fine even like that, besides we could work around these issues by choosing what to and what not to highlight

Btw, great job with updating the IDE, after you get done with fixing and improving you should make some screenshots, and a download and run version for newbies, then release it in the general section

I think it will get pretty popular since it is more functional than all the other alternatives, not to mention the aspect which is very neat

Again, you did a really great job, love it
__________________

Last edited by Depresie; 02-13-2017 at 17:56.
Depresie is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 02-13-2017 , 22:00   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #43

You are welcome. Now I do not feel comfortable creating a full package, as Sublime Text is
proprietary software. Also, I do not see how it could be more newbies proof. I already posted
pictures for every single step it is necessary to be done. May be I could include the compiler,
but the newbie would still have to set the folder to their plugin's folder on his game. So, if he
can do that, he can also point the settings file to his compiler and to where the compiler's
include folder is on.

What I cannot help is with lazy people who do not dares to carefully read the instructions and even
see the pictures corresponding. Though, may be a video tutorial teaching how to setup should be
helpful with the laziest ones.

Quote:
Originally Posted by Mistrick View Post
private functions don't highlighted.
After working on it today I found out how to fix this. After I have tried several approaches
I found out a easy way to differ the `private_function_declarion()` from a call to call_to_function()`.

Hopefully, pawn has the error:
Code:
error 055: start of function body without function header
Therefore I only set the syntax to function call inside braces, so everything what is outside
braces are function definitions. However this causes the problem for function's call on functions
without braces, example:
Code:
private_function_declaration()     call_to_function()
On this case, as both are outside braces, they will be colored as function's definition.
Anyways, I believe this should not to be problem for anyone eyes/taste. If they do not like,
just put the damn braces on it:
Code:
private_function_declaration()    { call_to_function() }
Now the other problem, actually even this above problem can be fixed, doing a complete
parse of the file and creating a syntax file dynamically for each file you got open, however
this is very computing expensive, so should just be considered impossible until Sublime Text
provide a more complete native support for the syntaxes we can write to it.

@Mistrick, you can download the syntax I am attaching here and replace your on the folder
`Sublime Text Root/Data/Packages/Amxx Pawn`. I also update the file on the first post within it.
Attached Files
File Type: zip AmxxPawn.sublime-syntax.zip (3.9 KB, 100 views)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 02-14-2017 at 07:51.
addons_zz is offline
Mistrick
Senior Member
Join Date: Aug 2012
Location: Russia
Old 02-14-2017 , 04:12   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #44

addons_zz, one more exception. Red is Function Definition
Mistrick is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 02-14-2017 , 10:07   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #45

Quote:
this is very computing expensive, so should just be considered impossible
Even if it may be computing expensive i don't think anyone will feel any difference, so i think you should go for it until they fix sublime

What i meant by providing screenshots was to make screenshots of the application, to give the people an idea what the application/package is like

Having the package already included in the application will shorten the "tutorial" which will have a good impact on newbies, because when someones sees a full page of explanation how to install it, they just give up before even reading it

Of course they will still have to set the paths of the compiler/output/include

Even tho Sublime Text is proprietary software i don't think it will bother anyone, since it is actually free to download on their website, and your package release is giving the application more popularity
__________________
Depresie is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 02-14-2017 , 12:58   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #46

Quote:
Originally Posted by Depresie View Post
Even if it may be computing expensive i don't think anyone will feel any difference, so i think you should go for it until they fix sublime
This is just not computing expensive, it is also my timing expensive. There are two bugs. The first is this:



If I write more code and more code, after some days we could get a solution computing
expensive accordingly to the size of the file you are editing `O(n)` * the number of file
you have on you project, for each time you edit and save some file. Therefore, if you have
a project within 10.000 file like mine, it will take a very big time to the computer to the
parsing all 10.000 files. This is due the dynamic syntax file creation. Each time a syntax
file is changed, Sublime Text must to re-parse all the project files, so is not wise to have
something changing them each time you edit you file.

So, just wait Sublime Text allow its syntax file to do multi-line regex matching, and this
problem is solved. I am not fixing it mostly because it do not bother me. If bother you,
just put the parenthesis on the line before like this when you are doing your functions call/definitions:



The other bug is a problem on my syntax, not with Sublime Text. I just do not figured out yet how to fix the unbalanced braces by the preprocessor:
Code:
370: public own_type:on_damage( id ) 371: { 372: #if defined DAMAGE_RECIEVED 373:     // id should be connected if this message is sent, but lets check anyway 374:     if( is_user_connected( id ) ) 375:     { 376: #else 377:     if( is_user_connected( attacker ) ) 378:     { 379: #endif 380:         ShowSyncHudMsg( attacker, g_MsgSync, "%i^n", damage ) 381:     } 382:     hi_girl() 383: } 384: 385: public on_damage( id ) 386: { 387:     get_user_attacker( id ) 388: }
It is not a big issue, it only happens if your source code has such preprocessor directive
doing the unbalancing of braces. The problem it will cause is just for the private functions
on the code after the unbalancing. They will be recognized as a function call, instead of a
function definition:



For now I am thinking about some strategy/trick to overcame such preprocessor mess.
I just do not figured it out yet. May be never, may be tomorrow. May you figure it out the tell me.
The C language syntax is doing this trick already, someone just have to understand how it is being
done, or came out with some new idea.

Quote:
Originally Posted by Depresie View Post
then release it in the general section
...
What i meant by providing screenshots was to make screenshots of the application, to give the people an idea what the application/package is like
So, I can take some screen shots and create a zip within Sublime Text and the Packages.
I do not see why a new thread on the General section. I can just added them to the first
post on this thread.

Anyways, people should not download programs like that. They should be able to download the
files from the origin sources and mount/compound the program by themselves. Thought, I am
shipping several packages and settings on the fist post, but they are all pure text files, anyone
can read and inspect what they are doing.

Quote:
Originally Posted by Mistrick View Post
addons_zz, one more exception. Red is Function Definition
Fixed. You can download the syntax I am attaching here and replace your on the folder
`Sublime Text Root/Data/Packages/Amxx Pawn`. I also update the file on the first post within it.
Attached Files
File Type: zip AmxxPawn.sublime-syntax.zip (4.6 KB, 89 views)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 02-14-2017 at 23:19.
addons_zz is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 02-15-2017 , 13:18   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #47

Released a new version:
HTML Code:
v1.4.2 | 2017-01-15
 * Fixed pawn constants not being highlighted on the default syntax.
The fix is the difference from this:



To this:



You can download the syntax I am attaching here and replace your on the folder
`Sublime Text Root/Data/Packages/Amxx Pawn`. I also update the file Packages.zip on the first post within it.
Attached Files
File Type: zip AmxxPawn.sublime-syntax.zip (4.7 KB, 102 views)
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective

Last edited by addons_zz; 02-16-2017 at 12:03.
addons_zz is offline
Depresie
Veteran Member
Join Date: Nov 2013
Old 04-05-2017 , 17:41   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #48

Ahm, downloading again, had to post again, love this !!!!!!!!!!!!!!!!!!!!!!!
__________________
Depresie is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 04-05-2017 , 18:21   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #49

Belo trabalho. Vou trocar o amxx studio pelo Sublime.

Gfj.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 04-05-2017 at 18:22.
EFFx is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 04-05-2017 , 19:15   Re: [TUT] Compiling AMXX plugins with Sublime Text
Reply With Quote #50

Yeah, Sublime Text itself is lovely as it is very flexible & hackable. I hope its development keeps forward improving it, so someday it may overcome some rich specific language tools as Visual Studio for C++.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
Reply


Thread Tools
Display Modes

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 15:49.


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