SlickEdit Community

General => Community Forum => Topic started by: KingDavid on November 21, 2018, 10:22:00 pm

Title: How Create Symbols Table
Post by: KingDavid on November 21, 2018, 10:22:00 pm
Hello All, I am evaluating SlickEdit but I am getting frustrated cause I can't get it to show me the details on a structure when I hover the mouse over the name, just like I can in Eclipse.  I don't know what I have to activate, if it is called symbol tables or tag files, all I know is with Eclipse it did it automatically as soon as I opened the project but with SlickEdit it is not working out for the life of me.  I am using C/C++.  Can anyone please tell me the exact sequence of steps I need to follow to build whatever table is required?
Thank you

Title: Re: How Create Symbols Table
Post by: Graeme on November 22, 2018, 12:48:32 am
SlickEdit will automatically find symbols in your current source file using what it calls context tagging.  To find symbols that are in other files you need to create a tag file.  The easiest way to create a tag file is to create a new project  - in the Project menu select "new" then select the project tab, enter a project name, location and select a project type in the left hand window e.g. C++.  Leave "create new workspace" selected.  The name you enter for "project name" will become the name of the project and workspace files that hold the project settings and it's also the name of the tag file.  The project properties dialog will appear and on the Files tab you can add the files that you want to be in the project.

When the editing cursor is on a name, the preview window will automatically show the code with the declaration of that symbol.  If you don't have the preview window open it's at View -> Tool windows -> preview.
If you have a c/c++ compiler on your machine, slickedit may have already created a tag file for it.  If not, go to tools -> options, then type "compiler" in the search box at top left and select c/c++ Compiler Properties.  Click the "add" button to add a new compiler and enter the paths to the header files for the compiler library.
In the main slickedit window, select C/C++ options from the Document menu to customise everything to do with C++, including context tagging.  See context tagging in the help for more detail.

Title: Re: How Create Symbols Table
Post by: KingDavid on November 22, 2018, 05:00:56 am
Thanks so much, but I followed your instructions to a T, but I couldn't get it to work. To make sure, the project I am trying to build a tag file for is the Asterisk PBX Open Source project, which is quite complex and looks like the only way I can open it is by clicking "open" and then pointing at Makefile. The instructions you gave me force me to declare an executable name or create a new makefile, which is not what's intended. In one instance only when I opened the first time it showed me the first structure I pointed at but then I went to another file in another folder and it lost the ability to find any more symbols.  Then I went to the section where I rebuilt the tag file but to no avail.

Title: Re: How Create Symbols Table
Post by: Graeme on November 22, 2018, 11:01:56 am
I actually have Asterisk 15.6.1 on my PC.  There are 1308 source files in the tag file and the tag file is 17 MB.  If you go to main menu -> Tools -> Tag files and select the Asterisk workspace tag file, how many files are there and what size is the tag file?  If it's not 1308 then close the tag file dialog and in the Project menu, select Project Properties then click on the file tab.  It will show you how many files are in the project.  If it's less than 1308 then click the "Add Tree" button, browse to the root of the asterisk folder; for "include filespecs" select the *.c; *.h etc option, tick the "recursive" checkbox and click ok.  Now check that the project has 1308 files in it and see if it helps.
Title: Re: How Create Symbols Table
Post by: rowbearto on November 22, 2018, 06:42:37 pm
There is no need to bother with telling SlickEdit about an executable or a makefile for code browsing.

Create the workspace/project by following these steps:

Under C++ choose "Other C++"  (even if your project uses gcc or clang, choose "Other C++" anyway, this is important to avoid requiring executable or makefile)

In "Location:" choose the root directory of your source tree
In "Project Name:" choose a name like "asterisk"
Make sure "Create new workspace" is selected.
Click "OK"

Now you get a new dialog. Click on: "Add Tree"
In next dialog, navigate to the root of your directory tree
In "Include filespecs" choose a set of filespecs that will capture all of your C++ source files, such as one with common *.c,*.cpp,*.h, etc. extensions
Make sure "recursive" is checked

Now click OK to scan the tree, you should see all your source files populated in the "Files" tab.
Then in Project Properties dialog, click OK again to exit.

This will create your project containing all your source files.

Now you will be able to code browse.

Go to a symbol you want to see the definition of and use pulldown menu (or keyboard shortcut):

Seach->Go to definition (or Ctrl+.) to find the definition only, but not references
Search->Go to reference (or Ctrl+/) to find all references (see the "References" tool window at bottom with double-clickable results)

After you navigate to definition or reference, you can press Ctrl+, (Ctrl+comma) to go "back" to your original location.

You can also choose the "Preview" tab at the bottom, then put the mouse on any symbol in a regular editor window with your source file and you will see in the Preview window where that symbol is declared/defined.

Good luck!
Title: Re: How Create Symbols Table
Post by: KingDavid on November 23, 2018, 04:20:17 pm
@Graeme:  It worked!, awesome...  Indeed the tag file wasn't complete.  What did it was the "Add Tree" button which then recreated the tag file which has now 7709 files with a 33MB size. (I will give it another run eliminating all *.o and *.so files)
I have to admit it would have been painful not to use SlickEdit, I really liked the editor I got customized to be a blend of vim + graphics + display code controls, awesome.
Thank you, I can use SlickEdit now :)
Title: Re: How Create Symbols Table
Post by: KingDavid on November 23, 2018, 04:24:13 pm
@Rowbearto: Thank you, thanks to your instructions I was also able to create the project file.  Plus the your tips are very helpful (I didn't know them).  A coworker had recommended SlickEdit to me but after he did I knew I would be pretty much on my own to find out the features :)
Best regards