Auto insert semicolon after class definition in Codelite - c++

When writing classes in Codelite, I get this annoying behaviour where the IDE doesn't insert a semicolon after the closing brace, which has resulted in a few annoying syntax errors when compiling.
I tried looking in the program's Preferences menu but couldn't find a relevant option and Google didn't help either in this respect.
Is there any option at all to enable the auto-insertion of a semicolon after a class declaration?

CodeLite does not do that by default and there is no setting that you can modify to do that.
You can however, achieve this in two other ways:
Use the class wizard:
Create your class using the 'Class Wizard': Right click on a folder in the tree view and select New class
Use the abbreviations plugin
From the menu bar: plugins->abbreviations->settings
Click on the new entry button (green plus icon)
Name it "class" (or a name of your choice) and paste the following code:
class | {
public:
};
Click "Save"
Now when typing in the editor class hit: Ctrl-ENTER and you will see this entry - select it and it will added to the text editor for you.
NOTE: the | marker indicates where CodeLite will place the caret, You can have multiple carets. So the above example can be expanded to something like this:
class | {
public:
|(){}
~|(){}
};
Now, when CodeLite adds this snippet to the editor, you will get 3 carets. Typing the class name will add them in all three locations
NOTE 2: The above was tested using CodeLite 11.0.8 (git latest), but it should work with CodeLite 11.0 as well
HTH,
Eran, Author of CodeLite IDE

Related

Object 'X' already exists

I'm learning C++ and am redoing a tutorial that I did before. I deleted the project folder and recreated it. I right clicked on the solution, clicked Add Class and entered my class name, but I get the error that 'Object 'X' already exists' even though I deleted the previous folder. I'm just learning C++ so I guess I don't understand how C++ creates objects.
Probably some stored data are still there from the previous project.
1st solution: I would suggest you to change from the name tag, your project name. Maybe something was still there.
Then, second option: restart Visual studio
2nd solution: Watch also to the solution explorer, if there are hidden folder named as your class name. If so, delete them and create the class again
Let me know.
To solve this problem I created a file with the name that did not work via windows explorer in my project folder. I then dragged the file into visual studio and it worked.

Code completion drop down suggestions not working properly Xcode 8.0 Swift 3

Im having a problem with the code completion drop down suggestion menu when you are writing code in Xcode. It used to be you could type something like:
button.frame = CGRect(
and once your at this point instead of filling in all the arguments manually, the code completion suggestions drop down menu should appear and provide suggestions of auto completion then you simply just click on the one that suits your needs and you end up with something like: (from the example above)
button.frame = CGRect(x: CGFloat, y: CGFloat, width: CGFloat, height: CGFloat)
then all you have to do is simply fill in the parameters. After I updated from Xcode 7.3.1 to the latest version (Xcode 8) for some reason I lost this amazing feature; however, Xcode still shows the code completion suggestions drop down menu but it is not the same, it just contains variables that I have written and attributes that don't even pertain to the object that I am editing.
Further more, Xcode 8.0 for me at least no longer highlights: Attributes, Project Class Names, Project Function and Method Names, Project Constants, Project Type Names, Project Instant Variables and Globals, and a few other types in the source editor. However keywords, strings, and numerical types remain highlighted as before the update.
I have tried monkeying around in the Preferences tab but I can not find options that will fix these frustrating issues. Please help!
It should be just temporary issue:
Clean your build / build folder, reopen Xcode. It ensures your code will be indexed again and this is used to result in quick syntax highlighting and smart suggestion features.
It is because of Indexing....
just go to your project name at the top of navigation and Clean (cmd+shift+k) then come again to the file where you wanna work type any word you will see suggestion popUp. that it..

Change Default Tabbing Structure for Classes in Visual Studio

My preferred tabbing structure for classes in C++ doesn't match Visual Studio's (2013), and I always have to manually correct it. For example, my structure is as follows:
class CExample
{
public:
CExample();
~CExample();
};
When I type this in, Visual Studio auto-corrects it to this:
class CExample
{
public:
CExample();
~CExample();
};
Note that it pulls back "public" and everything else by a full tab. I don't like this, so I have to go and manually re-indent everything. Then, if I copy and paste this class somewhere else, it re-introduces the default tabbing and I have to manually fix it again.
I don't want to turn off all auto-correction or auto-formatting - it's just this specific case (tab formatting of classes) that I want to change (and ideally "fix," rather than just disable).
Is there a template or something I can adjust, so that Visual Studio uses my "style" in this case, rather than its own?
Thanks.
One alternative I suggest is to simply highlight everything and hit tab.
This will indent the whole chunk of code instead of replacing it with a tab.
You can use the same method to "unindent" a chunk of code with shift tab
You can change the indentations of the access specifiers, but there doesn't seem to be an option for the lines after them.
Tools -> Options -> Text Editor -> C/C++ -> Formatting -> Indentation -> Indent access specifiers

Netbeans code templates with changing value

Is it possible to create code template that will use written value?
simple example:
firstly: while + tab gives standard while code.
I would like to create something where while 100 + tab would give:
while (i<100) {
}
Where 100 is given value and can be different. Also would be nice to have more than one custom value.
Go to Tools -> Options.
Then click on Editor and go to Code Templates tab.
Click New, give and abbreviation and the code template.
Look at the existing templates, like whilexp - it shows how
to prompt for input on the code template.

NetBeans template prompts user for variables

I am taking a programming class in college where my professor requires me to include information on the assignment withing a JavaDoc comment block in a specific format. I'm wanting to create a java class template so that when I create my file, I just type in the assignment specific information, and it places it in the template. Is this possible, or do the variables used in netbeans templates have to be pre-defined?
"I'm wanting comments that are generated when the user creates a .java file in netbeans."
Then your best solution is modifying the templates and defining custom User.properties when needed.
In NetBeans 7.2 (latest I think), go to [Tools] -> [Templates], and in the Template Manager window you can expand whatever template for whatever language you like and customize it.
For example, if you expand Java, you can then change the Java Class by highlighting it and selecting [Open in Editor]. At that point, you can easily see the normal javadoc comment block at the top.
/**
*
* #author ${user}
* #professor Mr. LordZardeck's Professor
*/
public class ${name} {
}
If you want to add custom properties, like the above uses the user property, in the Template Manager window, select [Settings]. That will open the User.properties file where you can add properties of your own. If you look at the bottom of the file, the last line is commented out, but it is an example of a custom property, uncommented it is:
user=Your Name <your.name at your.org>
So, with this you can specify static tags that can be auto-created without any work by simply changing the templates (like the professor tag added to the java class template). For a tag whose variable might change from assignment to assignment, you can use the custom user properties to assign those at the start of each assignment, then the templates will auto-fill your assignment information into the auto-generated custom javadoc tags when your template is opened.