SapphireSteel Forum
Welcome, Guest. Please login or register.
June 19, 2013, 12:34:55 AM

Login with username, password and session length
Search:     Advanced search
Welcome to the SapphireSteel forum - for discussion of the Sapphire and Amethyst IDEs
3893 Posts in 803 Topics by 672 Members
Latest Member: davib
* Home Help Search Login Register
+  SapphireSteel Forum
|-+  General
| |-+  Amethyst
| | |-+  Adding source for Intellisense
« previous next »
Pages: [1] Print
Author Topic: Adding source for Intellisense  (Read 3736 times)
Luth
Jr. Member
**
Posts: 59


« on: December 23, 2009, 02:28:55 PM »

This is a day-one question, but I didn't see the answer in any of the articles or posts I read.  I have a separate Sources folder in which we keep a repository of classes used on multiple projects.  I'd like to add this folder (and thus the classes in it) to the Intellisense database that Amethyst draws from.  I thought that perhaps adding the folder in the project properties 'Source Path' might help, but it didn't.  :-)  So, what am I missing?
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1006


« Reply #1 on: December 23, 2009, 03:11:50 PM »

There are two ways to get files into the IntelliSense system:

1) add the folder containing the files to the project in the Solution Explorer window. The files, I think, have to be under the project root, so in the simplest scenario, you would have to copy them. In which case, you would end up with multiple copies of the files - probably not what you want. However, you can add files which are outside the project root as 'links'. To do this, create a new folder node in the project (using the Solution Explorrer window), right click on it and select Add then Existing Item. Browse to the folder where the file (or files - works for multiple items) you want to add are located, and click the small down arrow next to the Add button (dont click the Add button!). This will display a small menu with Add as Link as one of the items. Select Add as Link. This will add the files to the project without physically moving them. They should then be in the IntelliSense system. I've just noticed a small bug here - the linked files should have a link icon to distinguish them from ordinary files, but they dont right now.

2) the second way is to create a library containing the files and build that as a separate project under the same solution (or a different solution - it should work) and add the library as a Project Reference to the References folder. This is probably the best solution but it probably requires some planning to get the library right. To add the library, build it, and then in your original project right click on the References folder and select Add Reference. In the Add (...) Libraries dialog, select the Projects tab and browse to your library.

We really need a tutorial on these options, and no doubt one will appear in the future ...

Dermot
Logged
Luth
Jr. Member
**
Posts: 59


« Reply #2 on: December 23, 2009, 04:22:22 PM »

Hm.  So if I make a Library project and add our common classes to that, then open that project along side my working project in the same solution, then add that library as a Project Reference, it'll work.  Will this actually compile a swc file and include it into my project?  I have a dozen or so "common use" files that we share between projects, but, for example, only two or three are actually in use by this one particular project.
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1006


« Reply #3 on: December 23, 2009, 04:40:07 PM »

yes it will (if I've managed to avoid any bugs).

I've tried to make it work just like C# producing a DLL.

You'll need one or two Compiler options to build the library swc in order to force the Adobe MXML compiler to include the files you want in the library.

For example, when I was testing this, I built the Flex framework.swc from source and to do this, I had to use a file (already provided by Adobe) that included the classes like this:

Code:
package
{
internal class FrameworkClasses
{
import mx.binding.ArrayElementWatcher; ArrayElementWatcher;
import mx.binding.BindabilityInfo; BindabilityInfo;
import mx.binding.EvalBindingResponder; EvalBindingResponder;

etc ...

I then just included the class by using

Code:
-include-classes FrameworkClasses


in Compiler, Additional compiler arguments.

There were a few other things I had to do as well because the framework is quite complicated, but for a simple library just an included file should be ok.

Dermot
Logged
andersonalex
Newbie
*
Posts: 3


« Reply #4 on: November 07, 2010, 04:01:19 PM »

Regarding solution #1 here, is there any way to do this for a folder that contains numerous subfolders? I have hundreds of classes in many embedded packages, and I'm looking for an easy way to make them all available to IntelliSense at once.
Logged
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 937



« Reply #5 on: November 08, 2010, 12:18:11 PM »

Regarding solution #1 here, is there any way to do this for a folder that contains numerous subfolders? I have hundreds of classes in many embedded packages, and I'm looking for an easy way to make them all available to IntelliSense at once.
I think this is the default way for Flex/FlashBuilder to reference folders outside the project. We've talked about the possibility of providing folder-links in the Solution Explorer in addition to the file-links as at present. On the plus side, this would make it work more like Flex Builder. On the minus side, however, it's not normally the way that Visual Studio works. VS is very much project-based with external code repositories either being added (as code) in a project that forms part of a shared solution or (pre-compiled) as a library reference added to the References node. In addition, Amethyst also supports 'project references' whereby you can import both the source code and the reference to an external project to give full code-navigation in addition to the IntelliSense provided by a simple 'reference'. You may want to watch the Building and Debugging Libraries and the Flex SDK video on the tutorials page for an overview of this:

http://www.sapphiresteel.com/Tutorials/Amethyst-Tutorials/article/amethyst-tutorials-index

It would be possible to add folder-links but I am unsure if this would provide different functionality from adding a reference. The only slight disadvantage I'm aware of to adding references is that you would also need to build the external code as a library first, though this would be a once-only operation.

Does this fulfil your requirements or is there additional functionality that would be available if we followed the Flex Builder way of doing things?

best wishes

Huw
Logged
andersonalex
Newbie
*
Posts: 3


« Reply #6 on: November 08, 2010, 09:16:40 PM »

Thanks for your reply. I'm still looking at the library solution, but it does seem a bit awkward for how I work. First, we're using these classes with other programs, including FlashDevelop and CS5. For the most part we include these among our global classpaths so that they can be available to all projects. In order to share files (and updates) easily, it's really nice to be able to just point the IDE to a set of classes in a single location. Second, it's pretty much a given that at any given time there will be classes in there which won't build. Some might have dependencies that aren't up-to-date on all machines, and other classes might just be in an unfinished state. This doesn't cause problems for us in other editors, since the only classes that have to be build-ready are the ones we import and use. Finally, I could be wrong, but I get the impression it will be quite a bit slower to work with the libraries in situations where we're making a lot of changes to the library files (or adding new classes).

Tips are welcome. I'm impressed with how quickly this product has come along, and I'm excited about the current and coming integration with .NET. Given some of the recent news about Silverlight's cross platform future, I think there may be an increase of interest in Flash amongst .NET developers.
Logged
Huw Collingbourne
Administrator
Hero Member
*****
Posts: 937



« Reply #7 on: November 09, 2010, 04:38:20 AM »

Thanks for the extra information. We are always interested in considering new ideas but I'd be interested in getting more feedback from you after you've had a chance to try the existing way of working at greater length. Some IDEs/editors are a lot less rigorous that VS in the way they allow projects to be structured. This has pros and cons. On the con side, VS makes it quite hard to work with files and directories that aren't an integral part of a project. On the plus side, the control over project building in VS is incredibly powerful.

If you could carry on exploring the library-based way of working and let me know how you get on that would be useful. A couple of tips may also help you get further.

Try changing the file properties of files you don't want to build. i.e. select a file in Solution Explorer change Build Action to Exclude to prevent it building. You can also change other properties here (for example to copy images and other resources to the output directory when building).

Also try experimenting with Pre and Post Build events (in Project Properties/ Build Events). These let you run commands to, for example, copy whole batches of files and folders before or after building). You may also want to experiment with named build configurations to let you switch properties easily.

You can find help on properties in the tutorials and hep sections:

http://www.sapphiresteel.com/Tutorials/Amethyst-Tutorials/article/amethyst-tutorials-index
http://www.sapphiresteel.com/Tutorials/Amethyst-Tutorials/
http://www.sapphiresteel.com/Products/amethyst-ide/Amethyst-Help/

We are still open to the possibility of adding a 'linking' feature as you originally suggested. But for now, I'd be interested in your views on how well the existing features can be used to support development using external code repositories added as references or libraries plus the control over building supplied by file and project properties.

best wishes

Huw
Logged
Dermot
Administrator
Hero Member
*****
Posts: 1006


« Reply #8 on: November 10, 2010, 09:28:12 AM »

I can see the problem you've got. It's probably not how you would start out - but that's the way things are. So, ...

we're thinking about having an extra menu item on a Solution Explorer folder node that opens up a 'wizard' that lets you select a folder which isn't in the project. When you select this, a tree will appear showing all AS files (and possibly others like png) that are under that folder and its subfolders. You will be able to check/uncheck files/folders that you want added as links. When you are ready, click OK and each file will be added under the Solution Explorer folder that you've right clicked as a link.

would that work?

Dermot
Logged
andersonalex
Newbie
*
Posts: 3


« Reply #9 on: November 11, 2010, 06:12:26 AM »

Thank you. Yes, that does sound like a solution that would be helpful for those of us who will be working with multiple editors and common files that are in version control. If the tree control allows for easily selecting all files within a folder (or subfolder), that would be a really useful option.

I see the value in the libraries approach, and I can see where it's a smart decision moving forward. But it's certainly nice to have fewer obstacles when first starting out.
Logged
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!