Skip to content

Commit

Permalink
Huge Update: Object-Oriented Auto-Completion
Browse files Browse the repository at this point in the history
+ Object-Oriented go to Declaration
  • Loading branch information
Zinggi committed Mar 29, 2013
1 parent 70ec033 commit d1b41b0
Show file tree
Hide file tree
Showing 16 changed files with 726 additions and 319 deletions.
72 changes: 72 additions & 0 deletions Array.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Dynamic Arrays
* ______________
* Dynamic arrays provide various ways for reading and manipulating the content and length of the array.
* All of these must be done through variables or struct members,
* dynamic arrays returned from functions must be assigned to a variable first.
*
* Declaration: var array<type> MyArray;
*
* NOTE: array<bool> is not a supported type!
*
* Dynamic arrays now support the foreach command to allow simple iterations. The basic syntax is:
* foreach ArrayVariable(out ArrayItem, optional out ItemIndex) { ... }
*
* This is a non-existent class. You can't extend it.
*/
class Array
native;

/**
* The length of the array.
*/
var native int Length;


/**
* Adds a item to the array.
*
* @param item - The item to add.
*/
native final function AddItem( object item );

/**
* Removes a specified item.
*
* @param item - The item to remove.
*/
native final function RemoveItem( object item );

/**
* Inserts a item at a specified index.
*
* @param index - The index to insert the item at.
* @param count - The item to insert.
*/
native final function InsertItem( int index, object item );

/**
* Find and returns the found element with a specified value, if nothing is found it will return -1.
*
* @param value - The value to look for.
*
* @return The found index or -1 if value wasn't found.
*/
native final function int Find( object value );

/**
* Find and returns the found element with a specified value, if nothing is found it will return -1.
*
* @param propertyName - The property name of within a struct to test against.
* @param value - The value to look for.
*
* @return The found index or -1 if value wasn't found.
*/
native final function int Find( name propertyName, object value );

/**
* Sorts the array.
*
* @param sortDelegate - The method to use for sorting.
*/
native final function Sort( delegate sortDelegate );
49 changes: 49 additions & 0 deletions Class.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* Class
* _____
* In Unreal, classes are objects just like actors, textures, and sounds are objects. Class objects belong to the class named "class".
* Now, there will often be cases where you'll want to store a reference to a class object, so that you can spawn an actor belonging to that class
* (without knowing what the class is at compile-time). For example:
* var() class C;
* var actor A;
* A = Spawn( C ); // Spawn an actor belonging to some arbitrary class C.
*
* When declaring variables that reference class objects,
* you can optionally use the syntax class<metaclass> to limit the classes that can be referenced by the variable to classes of type metaclass (and its child classes).
* For example, in the declaration:
* var class<Actor> ActorClass;
* The variable ActorClass may only reference a class that extends the "actor" class.
* This is useful for improving compile-time type checking. For example, the Spawn function takes a class as a parameter,
* but only makes sense when the given class is a subclass of Actor, and the class<classlimitor> syntax causes the compiler to enforce that requirement.
*
* As with dynamic object casting, you can dynamically cast classes like this:
* // casts the result of SomeFunctionCall() a class of type Actor (or subclasses of Actor)
* class( SomeFunctionCall() )
*/
class Class
native;

/**
* Access a static function from this class instance.
*/
var const native Specifier Static;

/**
* Access a default variable from this class instance.
*/
var const native Specifier Default;

/**
* Access a constant from this class instance.
*/
var const native Specifier Const;

/**
* Access a object from this class instance.
*/
var const native Object Self;

/**
* Access a function from this class parent's instance.
*/
var const native Specifier Super;
4 changes: 3 additions & 1 deletion Default (Linux).sublime-keymap
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[
{
"keys": ["f10"], "command": "unreal_goto_definition",
"keys": ["f10"],
"command": "unreal_goto_definition",
"args": {"b_new_start_point": false}
},

// Add event right before auto-completion to insert a dynamic snippet
{
"keys": ["tab"],
Expand Down
4 changes: 3 additions & 1 deletion Default (OSX).sublime-keymap
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[
{
"keys": ["f10"], "command": "unreal_goto_definition",
"keys": ["f10"],
"command": "unreal_goto_definition",
"args": {"b_new_start_point": false}
},

// Add event right before auto-completion to insert a dynamic snippet
{
"keys": ["tab"],
Expand Down
14 changes: 14 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@
}
]
},
{
"caption": "Tools",
"id": "tools",
"children": [
{
"caption": "-"
},
{
"caption": "UnrealScriptIDE: Rebuild Cache",
"id": "unreal_script_rebuild_cache",
"command": "unreal_rebuild_cache"
}
]
},
{
"caption": "Preferences",
"id": "preferences",
Expand Down
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
UnrealScript IDE Plug-in for Sublime Text 2
===========================

UnrealScript IDE mainly adds better auto-completion features to Sublime Text 2 for UnrealScript and a goto declaration command.
UnrealScript IDE adds many features to Sublime Text 2 that you'd expect from a good UnrealScript IDE.
Fully featured object-oriented auto-completion, go to declaration, syntax highlighting, build and run, snippets and some more to name a few...


![Pic](http://www.mediafire.com/conv/a12c7703e035e63ecb6ff1d39b8677716286a0f50c386ac5de0329f53e3e1e3d6g.jpg)
Expand All @@ -10,31 +11,34 @@ UnrealScript IDE mainly adds better auto-completion features to Sublime Text 2 f
Feautures
------------

* **Dynamic, intelligent auto-completion**
* **Dynamic, intelligent auto-completions**
* fully object-oriented completions
* Context sensitive completions (e.g. in the defaultproperties block you only want to get variables)
* parameter hints
* display documentation when you need it
* completions feel like the great Sublime Text 2 snippets
* get other completions depending where you are typing (e.g. in the defaultproperties block you only want to get variables)

* **Go to declaration and back again**
* use F10, alt + left click, right click menu, via 'Goto' -> 'UnrealScript Goto Declaration' or search in the command palette to go to the declaration of the currently selected word
* when browsing in the declarations you can always return to your starting position by using one of the above keys when nothing is under your cursor.
* Object-oriented goto declaration (pressing it over controller.GetPlayerViewPoint(a, b) will take you to the declaration of GetPlayerViewPoint in Controller)
* use F10, alt + left click, right click menu, via 'Goto' -> 'UnrealScript Goto Declaration' or search it in in the command palette to go to the declaration of the currently selected word
* when browsing in the declarations you can always return to your starting position by using one of the above keys when nothing is under your cursor.

* **Syntax highlighting**
* For .uc files and .log files

* **Build system**
* use Ctrl + B, F7 or search in the command palette to build your game
* use Ctrl + B, F7 or search for it in the command palette to build your game
* if the build contains errors, the error log will be opened, allowing you to navigate to your errors quickly.
* if the build was successful, the game will start

* **Launch Game**
* quickly open the game with your last configuration
* you can chose witch map to open
* chose between Standalone or a Server and 2 Clients
* you can specify additional startup settings
* you can specify additional startup settings [more information](https://github.com/Zinggi/UnrealScriptIDE/wiki/Getting-Started#configure)

* **Various useful Snippets**
* predefined Snippets for Standard classes, and language features such as defaultproperties

* **Add bookmarks to your comments**
* to add a bookmark write your comments like this: // ! text or /** ! text*/
Expand All @@ -46,13 +50,16 @@ Feautures
Planned
------------

* **Object-oriented auto-completions**
* if you write e.g. "Controller." you'd want to see it's methods, functions and variables. Currently this doesn't work.
* **Add support for enumerations, structs and CONST**
* currently structs aren't supported. e.g. if you type Actor(other).Location.* you won't get x, y, z although you would want to.
* same for Enumerations

* **Object-oriented goto declaration command**
* typecasting e.g. Actor(Pawn). and super(className). are not supported yet
* **Support for local variables**
* local variables and function arguments should also appear in the completion list

* **Add support for enumerations, structs and CONST**
* **live parsing of the current file**
* if you have declared a variable such as: var Pawn MyPawn; and immediately afterwards type MyPawn.* it won't give you any suggestions.
To get your suggestions you have to save your file first.

* **Your suggestion here?**
* You can suggest features, report bugs and vote for features on this site here: [UnrealScript IDE - Userecho](http://unrealscriptide.userecho.com/)
Expand All @@ -75,16 +82,16 @@ For a more in detail explanation visit the wiki: https://github.com/Zinggi/Unrea

**please note:**
----------------
UnrealScriptIDE will **only** work properly if you add the **Src** folder as a project.
UnrealScriptIDE will **only** work properly if you add the **Src** folder as a project.
To do so, goto 'Project' -> 'Add Folder To Project...' -> add the Src folder (/UDK/UDK-201*-**/Development/Src/)

Usage
----------------
Please refer to the wiki: https://github.com/Zinggi/UnrealScriptIDE/wiki

------------
All **credits** for various Snippets (and also for the old (now unused) Syntax highlighting file) goes to **[Michael Alexander](https://github.com/beefsack)**. Thanks!
All **credits** for Syntax highlighting in UnrealScript files goes to **[Rokit](https://github.com/rokit)** and **[Eliot](https://github.com/EliotVU)**. Thanks!
All **credits** for various Snippets (and also for the old (now unused) Syntax highlighting file) goes to **[Michael Alexander](https://github.com/beefsack)**. Thanks!
All **credits** for Syntax highlighting in UnrealScript files goes to **[Rokit](https://github.com/rokit)** and **[Eliot](https://github.com/EliotVU)**. Thanks!
**Credits** for Syntax highlighting in Log files goes to **[Rokit](https://github.com/rokit)**. Thanks!

My auto-complete settings
Expand All @@ -93,10 +100,10 @@ Here are some relevant settings for auto-completion that I've found quite helpfu

{
"auto_complete_with_fields": true, //this allows auto-completion inside snippets.
"auto_complete_triggers": //this activates auto-completion on '.' and '('
"auto_complete_triggers": //this activates auto-completion on '.'
[
{
"characters": ".(",
"characters": ".",
"selector": "source.unrealscript"
}
],
Expand Down
8 changes: 8 additions & 0 deletions Snippets/Broadcast.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
WorldInfo.Game.Broadcast(${1:self}, ${2:Your message});]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>broadcast</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.unrealscript</scope>
</snippet>
2 changes: 1 addition & 1 deletion Snippets/GameInfo.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<snippet>
<content><![CDATA[
class $1 extends ${2:Simple}Game;
class $1 extends ${2:SimpleGame};
$7
Expand Down
2 changes: 1 addition & 1 deletion Snippets/Pawn.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<snippet>
<content><![CDATA[
class ${1:ClassName} extends ${2:Simple}Pawn;
class ${1:ClassName} extends ${2:SimplePawn};
$2
Expand Down
2 changes: 1 addition & 1 deletion Snippets/PlayerController.sublime-snippet
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<snippet>
<content><![CDATA[
class ${1:ClassName} extends ${2:Simple}Controller;
class ${1:ClassName} extends ${2:SimpleController};
$4
Expand Down
8 changes: 8 additions & 0 deletions Snippets/log.sublime-snippet
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<snippet>
<content><![CDATA[
`log(${1:String or variable})]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>log</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
<scope>source.unrealscript</scope>
</snippet>
4 changes: 4 additions & 0 deletions UnrealScript.sublime-commands
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"caption": "UnrealScriptIDE: Build Project",
"command": "unreal_build_project"
},
{
"caption": "UnrealScriptIDE: Rebuild Cache",
"command": "unreal_rebuild_cache"
},
{
"caption": "UnrealScriptIDE: Build and Run last opened map",
"command": "unreal_build_project",
Expand Down
10 changes: 10 additions & 0 deletions UnrealScript.sublime-settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"auto_complete_triggers":
[
{
"characters": ".",
"selector": "source.unrealscript"
}
],
"auto_complete_with_fields": true
}
Loading

0 comments on commit d1b41b0

Please sign in to comment.