Skip to content

nonconforme/UrhoAngelscriptIDE

 
 

Repository files navigation

UrhoAngelscriptIDE

An IDE and Debugger for Angelscript with Urho3D.

Application Screenshot

Trouble shooting

NuGet dependencies

Newtonsoft Josn.NET, WebSocket4Net, and AvalonEdit

FirstFloor.ModernUI included (slightly tweaked)

Critical Todo's That May Interfere with usages

  • Code editors for the IDE/Debug views need to be consolidated
  • Saving remote files (received from debug server) locally, in the case of debugging the local machine, this is unnecessary as the saving will send the file data over the connection where the debug daemon will save it

Table of Contents

Running the IDE

After compiling the project, your application directory must contain a "bin" directory in the location of the exe. In this directory place your ScriptCompiler.exe and drop a generated ScriptAPI.dox and if available also a "dump.h" header dump to have intellisense ready without having to compile first.

IDE Functionality

The IDE is focused on directories instead of projects/solutions. Select the bin directory of your project, the parent directory will be used as the source tree for the ScriptCompiler's dump.

Presently only, text, XML, and Angelscript (.as) files may be edited. Angelscript files support intellisense. XML assistance is a WIP pending finishing XSD specs for all Urho3D xml file types.

Intellisense requires a successful compilation in order to function, or it will fallback on a default header dump that it will parse for generic Urho3D specific intellisense.

File Tree

The file tree contains all files and folders below the selected path. .as, .xml, and .txt files can be opened by double clicking. Folder context menu options are to create a new file, new folder, rename, or delete. File context menu options are to rename, edit, or delete.

Code Editor

  • Ctrl + F = Search/Find

Context Menu:

  • Compile
  • Create a template ScriptObject
  • Insert a #include by browsing for the file
  • Insert doxygen style comment
  • Insert doxygen style property comment
  • Insert a snippet
  • Common edit operations

Class Browser

The class information is created by parsing the header dumps generated by the script compiler. A type hierarchy is built that is used both for displaying the class browser and for intellisense functionality.

Code Snippets

If a folder named "snippets" exists in the directory of the IDE's executable it will be scanned for XML files to be loaded as snippets. Snippets may have "inputs" which are inserted into the snippet code using a {{mustache}} style marking. Snippets can also have "options" for which code blocks may depend on one or many options using "requires."

Snippet XML example:

<snippet name="Test Options" extension=".as">
    <input name="Test Input" key="testin" />
    <option name="Include Second" key="second" />
    <code><![CDATA[
void {{testin}}() {
    insert some cool code!
}
]]>
    </code>
    <code requires="second"><![CDATA[
void Start() {
    insert some cool code!
}
]]> 
    </code>
</snippet>

"Options" are presented as checkboxes, and "inputs" as text fields.

FileSpecs

Template XML files stored in the "filespecs" folder in the application root are used for creating new files. The format consists of a display name "name" attribute and an ext attribute that determines the extension. When creating a new file if the user specifies an extension it will be stripped off and replaced with the extension specified in the XML.

Text in the "file" tag will have all instances of "{FILENAME}" replaced with the name of the file (without extension).

FileSpec XML Example:

<file name="Urho3D ScriptObject" ext=".as">
<![CDATA[ 
class {FILENAME} : ScriptObject
{
}
]]>
</file>

Console Log

Contains verbatim output from the last compilation action.

Error List

If a compilation attempt fails the error log will be parsed and the messages will appear here. The tab will include a bright red 'X' along with a count of the errors. Each error contains basic summary information and may be double clicked to navigate directly to the location of the error.

Because of how angelscript detects errors, most errors will be reported as being on the line after the error, so investigate everything around the large red squiggly line if in doubt.

Search

Search functionality is provided by plugins that contain classes implementing ISearchService. Search "plugins" may be selected and will populate the search list with results. Included Search plugins are Code (.as files), XML (.xml files) and All files.

Search plugins feed their results into a ISearchPublisher interface and it is thread safe for them to do such and it is recommended that you run your search in a thread ... don't be Visual Studio, don't freeze the IDE because you're searching.

Compiling

The executable directory must contain a bin folder into which you place the ScriptCompiler executable. The IDE will run and feed parameters to the compiler as a slave process. Commandline output from the compiler is piped into the IDE where it is parsed to scan for error messages.

After a successful compilation the script compiler will be used again in order to generate Latex documentation dumps and a header file for the script types. The IDE will parse these files to generate documentation and class hierarchies.

Debugger Functionality

Connections

You may connect to a debug daemon for the launch screen of the IDE or use the the "Debug" link at the top to go to the debugger without connection.

If the Debugger is not connected to an asPEEK daemon it will display a "Disconnected from server..." bar at the bottom. In the bar you may enter the address of the daemon you wish to connect to and attempt to connect/reconnect.

Remote Files

When connected to a daemon you'll receive a list of remote files. Double clicking on any file will open it in the editor. In the editor you may use the margin to set/unset breakpoints.

Breakpoints

Breakpoints may be set/unset in the editor. A list of breakpoints is available in which you may reset/unset breakpoints, or use delete to remove the breakpoint completely.

Execution Control

When execution is halted you may use the buttons at the top, left, or the shortcuts to Continue (F5), Step Over (F10), Step-In (F11), or Step-Out (Shift + F11)

Callstack

When execution is halted the callstack will be displayed. The topmost entry is the current position. Double click on any callstack entry will open the file in question (if not opened) and move the focus to the line.

Locals, This, and Watches

When execution halts a full list of the local variables on the stack, the "this" object (if it exists), and the values of globals will be sent to the debugger. They may be seen in their respective tabs. Double clicking a leaf in these views will edit the value (if possible), and right clicking will allow the placement of a "watch." Hovering over a complex type will reveal the type name (Vector3, RigidBody, etc)

Many Urho3D types will display additional information, such as the pointer address in hex, the size of a resource, etc.

During each step (or new halt) the values of "watched" variables will be re-evaluated if possible. You may force re-evaluation, and may manually enter the path to the variable to watch.

Plugins

The IDE uses the PluginLib class library that other class library projects may link to in order to implement specific interfaces to extend the IDE.

Plugins are to be stored in a "plugins" folder in the same location as the asDevelop executable.

At startup the program will scan that directory for dlls and bind any classes (as new instances) that it finds which implement the interfaces known in the PluginLib library.

A list of recognized plugins can be accessed from the "Plugins" menu option at the top of the program. The list includes information about the library as well as a list of all the 'services' it provides.

ISearchService plugins

ISearchService is used by the IDE to perform "Find-in-File" searches. The include "FileSearch" library implements "All Files," "XML," and "Code" (angelscript) searching.

ISearchServices use an ISearchPublisher interface that is thread safe to publish their search results to. It is recommend to thread your search process.

IFileEditor plugins

Heavy work in progress

IFileEditor plugins extend the ability of the IDE to open and edit files. The interface must confirm (first-come-first-serve) whether it can handle a file and it must construct a valid WPF control object to be placed in the containing tab.

An included example "CSVEditorPlugin" generates a DataTable from a CSV file and creates a WPF Datagrid control to edit that data.

ICompilerService plugins

ICompilerService's are presented as compilation options in settings. When code is to be compiled they will be given the file to be compiled. They use an ICompileErrorPublisher interface to push their errors to the UI. They use an IErrorPublisher interface to report other errors, such as exceptions.

ICompilerService plugins should not use threading.

After compilation has been completed they will be called again for "PostCompile." This process is a heavy work in progress, and its' final intent is to be used for rebuilding autogenerated documentation and intelligent autocompletion related data.

IInfoTab plugins

Similar in implementation to the IFIleEditor plugins. Main difference is in intent. IFileEditor plugins have a lifecycle wherease an IInfoTab plugin's tab is constructed on application start and then left alone.

IBackgroundService plugins

Too soon to document.

Example Plugins

Urho3d Compiler (ICompilerService - UrhoCompilerPlugin)

Runs the Urho3D script compiler on the target file to compile. If compilation has succeeded it will then generate the relevant file dumps to be scanned for autocomplete and class information.

Urho3d Mass Compiler (ICompilerService - UrhoCompilerPlugin)

Runs the Urho3D compiler on all files found in the folder containing the target file. It's primary purpose is bulk compilation and detecting sequencing issues with #includes.

CSV Editor (IFileEditor - CSVEditor plugin)

Implements the IFileEditor to provide a Datagrid for

XML Editor (IFileEditor XMLEditor plugin)

Implements http://wpfxmleditor.codeplex.com for general purpose XML DOM editing. XSD schemas may be placed in a schemas folder inside the plugins folder. These schemas will be presented as options to use to perform validation on the xml.

If the file name (without extension) of a schema matches the name of the root element of the XML file it will be inferred as the "most likely" schema for validating that document. Otherwise, the schema may be manually selected from the list.

MediaViewer (IFileEditor - MediaViewer plugin)

Provides basic viewing of image files (png, jpg, tga, dds, bmp) and playback of audio files.

Attributes Browser (IInfoTab - UrhoDocsPlugin)

The Attributes browser is populated from parsing the Latex output of the scriptcompiler's dump.

The tree consists of entities (Scene/Node/Components) registered to the Urho3D engine and each record contains a list of the attributes registered for it and the attributes type. Right clicking on an attribute will bring up a context menu with options to copy either a "getter" or a "setter" for the attribute selected - which will remove any risk of a typo.

Events Browser (IInfoTab - UrhoDocsPlugin)

The events browser is populated from parsing the Latex output of the scriptcompiler's dump.

Events are grouped by Category, Event, Parameters.

Right-clicking on the Event or Parameters will bring a context menu with clipboard options.

In the case of an Event you can copy a template event subcribtion function call, unsubribtion, or generic event handler for the event.

For parameters the only current option is to copy the parameter getter (eventData["ParamName"]).

About

IDE and Debugger for Angelscript with Urho3D

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 98.2%
  • C++ 1.8%