Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

6 years ago by Rungo73

Hi,

New here today.

Can anyone tell me how I go about getting code hinting for impact?

I'm using Sublime Text 2 but am not tied to it.

Cheers.

6 years ago by Graphikos

Sublime Text 2 isn't really an IDE in that it doesn't do intelligent code completion (as in knowing what functions do and whatnot). There are plugins to extend its autocomplete functionality but I haven't tried any.

Google brought up this one: http://sublimecodeintel.github.io/SublimeCodeIntel/

6 years ago by drhayes

Graphikos is right.

Sublime can do autocompletes and snippets, though (e.g. type "ige" and get a full-blown entity declaration). Try my Sublime Text 2 plugin, see if it works for you.

And if it doesn't, I'm very open to feedback. ( =

6 years ago by Rungo73

Thanks Graphikos, I'll check that out...

drhayes - your plugin works the charm!

Thank you, this is great. Much appreciated.

6 years ago by bram

Quote from drhayes
Graphikos is right.

Sublime can do autocompletes and snippets, though (e.g. type "ige" and get a full-blown entity declaration). Try my Sublime Text 2 plugin, see if it works for you.

And if it doesn't, I'm very open to feedback. ( =


Can you explain to me how I install this plugin? I'm very new to sublime love the editor so far. But some code hinting would be awesome!

Thanks in advance!

6 years ago by jerev

You can install it through Package Control
Check the installation guide there.
Once you have package control, it's as easy as going through a list, and selecting the "impactjs" package.

6 years ago by Joncom

Quote from drhayes
Try my Sublime Text 2 plugin, see if it works for you.

And if it doesn't, I'm very open to feedback. ( =
Hey drhayes. I've had your plugin installed for some time now, and I've never noticed any change. What exactly does it do? How do I use it? Would be super handy if the repository README went over some of the functionality. =)

6 years ago by drhayes

Users are so demanding. ( =

Honestly, it doesn't do much... but have you changed the syntax of your JS files to "Impact"? I didn't want to hijack the native JS bindings so the plugin doesn't do anything out-of-the-box. Do that first and you should see the stuff below. Once you've set the syntax for a file in Sublime it should stay that way as long as you have Sublime open; no need to constantly reset it.

I tried to syntax highlight the Impact-specific JS features: module, extend, Entity, etc. Depending on how much you know about Sublime plugins, I was trying to do smart things with scoping but the regexes involved overwhelmed me... might have been trying to do too much so I backed off entirely.

It has two main pieces of functionality: completions and snippets.

ige: Tab completion snippet that provides a skeleton Entity, assumed to be in game/entities. Extends from Entity but lets you override that.

igm: Tab completion snippet that provides a skeleton module.

It has completions for Entity and for the KEY constants. Once you have the syntax set you should be able to hit CTRL+SPACE and see a list of common Entity methods and properties as well as the KEY constants (which are actually pretty memorable but I hate typing).

That was enough to satisfy me but I'm more than happy to take feature requests or, even better, pull requests.

6 years ago by Joncom

@drhayes: Very cool, thank you!

I didn't realize I had to change the syntax from JavaScript to ImpactJS. The nicest thing I noticed right away was the auto-completion for less memorable property names such as _wmIgnore.

For anyone else curious about the module and entity skeletons, press CTRL + P and then start typing "ImpactJS". You'll see them in the list. I get the impression there is a quicker way? What's this about ige and igm?

6 years ago by drhayes

My 100%-absolute-no-way-josé-fuggedaboutit favorite feature of Sublime Text is snippets.

ige and igm are both tab-completion snippets. Once you've changed the syntax of your file to ImpactJS, type ige then press tab. It will insert the skeleton into place for you and let you hit tab again to navigate through some insertion points in the snippet.

On the mac you can see a list of applicable snippets by hitting CMD+SHIFT+P (I think it's CTRL+P on Windows) and typing "snippet". The list changes depending on what kind of file it is (technically what kind of scope it is but file type is close enough).

I have a bunch of user-defined snippets in Sublime that make all my JS coding easier:

f: writes out function() {} for me.
f;: writes out function() {}; for me.
clog: writes out console.log(); for me.
define: writes out a RequireJS define block for me.

Etc. There are a bunch of built-in JS ones as well.

Seriously, check'em out. It's why I loved Textmate before Sublime and why I love them both above all other editors (except maybe for vim, but that has a more limited scope for me).

6 years ago by drhayes

Just for reference, here's my snippet to insert console.log:

<snippet>
	<content><![CDATA[console.log($0);]]></content>
	<tabTrigger>clog</tabTrigger>
	<scope>
		source.js
	</scope>
</snippet>

That $0 placeholder is a tabstop. $0 is special in snippet-land; it's where the user's cursor ends up after all the other tabstops are finished. Since there are no other tabstops in this snippet, it just completes inside the parenthesis as soon as you type clog and hit tab.

It's saved as the file js-console-log.sublime-snippet inside my Packages/User directory for Sublime Text. Don't know where that directory is for Windows folks, unfortunately. For Macs, it's under ~/Library/Application Support/Sublime Text 2/.
Page 1 of 1
« first « previous next › last »