Jump to content




CC Syntax Highlighting/Code Completions v1.2 - Sublime Text 2

utility lua

  • You cannot reply to this topic
133 replies to this topic

#21 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:00 AM

View PostSammich Lord, on 20 February 2013 - 03:58 AM, said:

-Automatically add functions to auto-complete after defining them
I've been trying to figure that bit out. how the hell do you do it?


EDIT: Oh Grav... can you attempt to figure you the multi line comment. so if you have multiple highlighted it will surround with --[[ ]] instead of putting -- at the start of each line.

Edited by TheOriginalBIT, 20 February 2013 - 04:01 AM.


#22 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 20 February 2013 - 04:01 AM

View PostTheOriginalBIT, on 20 February 2013 - 04:00 AM, said:

View PostSammich Lord, on 20 February 2013 - 03:58 AM, said:

-Automatically add functions to auto-complete after defining them
I've been trying to figure that bit out. how the hell do you do it?
If I have this code:
function helloWorld()
  print("Hello world")
end
It will automatically add helloWorld as a function. It will also add anything you load. So if I loaded the BIOS.lua and all the lib files I could get auto-complete for all CC files just by loading them. Sublime Text 2 is just awesome.

#23 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:03 AM

View PostSammich Lord, on 20 February 2013 - 04:01 AM, said:

It will automatically add helloWorld as a function. It will also add anything you load. So if I loaded the BIOS.lua and all the lib files I could get auto-complete for all CC files just by loading them. Sublime Text 2 is just awesome.
Oh i thought you meant if you had like
local function name(param1, param2, param3, ...)
end
then whenever you type name it brought up an auto complete with the parameter names... like eclipse and such... someone told me that it could do it...

#24 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 20 February 2013 - 04:07 AM

View PostTheOriginalBIT, on 20 February 2013 - 04:03 AM, said:

View PostSammich Lord, on 20 February 2013 - 04:01 AM, said:

It will automatically add helloWorld as a function. It will also add anything you load. So if I loaded the BIOS.lua and all the lib files I could get auto-complete for all CC files just by loading them. Sublime Text 2 is just awesome.
Oh i thought you meant if you had like
local function name(param1, param2, param3, ...)
end
then whenever you type name it brought up an auto complete with the parameter names... like eclipse and such... someone told me that it could do it...
I never got parameters to work with Sublime Text 2. Might be able to make a plugin for it though, not sure though. I really like Visual Studio's way of doing auto-complete. If Sublime Text 2 had the parameters then I would definitely use it for 90% of the coding I do.

#25 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:09 AM

View PostSammich Lord, on 20 February 2013 - 04:07 AM, said:

I never got parameters to work with Sublime Text 2. Might be able to make a plugin for it though, not sure though. I really like Visual Studio's way of doing auto-complete. If Sublime Text 2 had the parameters then I would definitely use it for 90% of the coding I do.
Indeed that would be nice! :)

#26 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 20 February 2013 - 04:18 AM

View PostTheOriginalBIT, on 20 February 2013 - 04:00 AM, said:

EDIT: Oh Grav... can you attempt to figure you the multi line comment. so if you have multiple highlighted it will surround with --[[ ]] instead of putting -- at the start of each line.

Easy! Done. I'll upload the updated version now.

EDIT: Uploaded.

#27 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:20 AM

View PostGravityScore, on 20 February 2013 - 04:18 AM, said:

Easy! Done. I'll upload the updated version now.
:D yay! :D

#28 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:27 AM

View PostGravityScore, on 20 February 2013 - 04:18 AM, said:

EDIT: Uploaded.
Missing a few keys variables

Spoiler

would be nice to be added to functions list
Spoiler


#29 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 20 February 2013 - 04:44 AM

All of them added. Damn how did I miss them...

#30 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 04:47 AM

View PostGravityScore, on 20 February 2013 - 04:44 AM, said:

All of them added. Damn how did I miss them...
Not sure :P Also the multiline comment doesn't seem to work for me.

EDIT: Sorry let me be more clear. Removing multiline comments don't work for me. also about 3 lines of padding are added to top and bottom when multilines are done.

Edited by TheOriginalBIT, 20 February 2013 - 04:54 AM.


#31 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 05:05 AM

View PostSammich Lord, on 20 February 2013 - 04:07 AM, said:

I never got parameters to work with Sublime Text 2. Might be able to make a plugin for it though, not sure though. I really like Visual Studio's way of doing auto-complete. If Sublime Text 2 had the parameters then I would definitely use it for 90% of the coding I do.
I think if the plugin did a search for the functions, and added them into the ComputerCraft/completions.sublime-completions, that might emulate that it does it ;)

#32 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 05:27 AM

Grav,

For your consideration:

New Code snippets

Center Write
Spoiler

Better Clear Screen
Spoiler

Just for Fun ;) :P
Spoiler


#33 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 06:27 AM

Finally... if you change the following code in the .tmLanguage
<key>fileTypes</key>
<array>
<string>lua</string>
</array>
to this code

<key>fileTypes</key>
<array>
<string></string>
<string>lua</string>
</array>
it means that .lua files will still be highlighted with the ComputerCraft syntax, but when saving new files it will not add the .lua by default

#34 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 20 February 2013 - 06:32 AM

I can see everybody eventually switching over to Sublime. I set it as my default text editor because I love it so much.

#35 lieudusty

  • Members
  • 419 posts

Posted 20 February 2013 - 03:59 PM

Nice! I've always been wondering how to add CC syntax to Sublime Text but never tried or found a way.

#36 NeverCast

  • Members
  • 400 posts
  • LocationChristchurch, New Zealand

Posted 20 February 2013 - 06:40 PM

This looks awesome Grav.
The filenames annoy me lol, but if that's the only fault I have then it must be great :D

Also, .DS_Store and _OSX folders :(

I'll reference this plugin from my post, Excellent work.
Also good to see you're using mega.

#37 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 20 February 2013 - 06:44 PM

View PostNeverCast, on 20 February 2013 - 06:40 PM, said:

Also, .DS_Store and _OSX folders :(
Not his fault, default OSX you can't see them and don't even know they are there, and when you ⌘+A it selects hidden files too. The only reason I know they are there and try to delete them for you, is because I have hiddens turned on. But its just like Thumbs.db crap from Windows, its so annoying! :P

#38 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 20 February 2013 - 09:01 PM

I added in your scripts BIT (centerPrint, advanced computer support to clear screen, and the BSoD template), but I changed them a bit. So I'll call this 1.1 at the moment. Topic updated!

#39 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 22 February 2013 - 02:17 AM

View PostGravityScore, on 20 February 2013 - 01:59 AM, said:

Credits
- TheOriginalBIT for tonnes of suggestions
Woo :P

Just another one. Maybe release the new config to use with NeverCast's Auto Lua Syntax so that ComputerCraft is the default syntax :)

How to do it
Spoiler


#40 Viproz

  • Members
  • 58 posts

Posted 22 February 2013 - 06:29 AM

Waw i always wanted a real IDE for lua, with that it will be a lot easyer, thanks a lot !





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users