I am trying out the new AppCode 2.0 for Objective-C development.
It shows me a warning in a bubble I don't know from Xcode if I hover the code it indicates as problematic.
How can I copy this message to the clipboard for googling?
Note, that I don't want information about the warning itself, just about how to copy it, so please don't add comments that I should paste some code.
Actually I just found a way: if the bubble shows up, you need to point with the cursor to it, what is quite difficult, as you must enter it through the arrow it points to the problematic code. than you have to point to the beginning of the message by not leaving the text that is printed inside the bubble. by dragging till the second last char you can mark the text and copy it than, while still holding the mouse key down. But if you also try to mark the last char, it will fail.
So the question is now: how to perform the copying of a warning message more easy?
OK, for the more curious among us:
AppCode yields a warning for the line
self.descriptionLabelSize = [description sizeWithFont:[UIFont fontWithName:#"Helvetica" size:17] constrainedToSize:constraintSize lineBreakMode:UILineBreakModeWordWrap];
it says about UILineBreakModeWordWrap:
Parameter type mismatch: Incompatible enum types 'NSLineBreakMode' and 'anonymous enum'
I am quite sure that we all agree with Xcode that this line is correct. I just want to google for it, and in case i won't find anything, report to the AppCode team.
There is a way to copy the warning message: run the inspections in the batch mode for the current file: Code | Inspect Code and choose the current file scope. Then find your warning in the inspections view below (this one will be under "type checks").
BTW, you shouldn't use "UILineBreakModeWordWrap" - it's deprecated since iOS 6.0 (AppCode should warn you). If you use NSLineBreakByWordWrapping, the warning will go away.
Related
Just upgraded from VS2013 to VS2015 Enterprise Update 3 and discovered that intellisense seems broken with enums.
With VS2013, typing space after, for instance:
dim myEnum as MyEnumType =
... would immediately give a choice of enum values of the correct type.
This was also true with more complex situations, where, when choosing from a number of overloaded versions of a method, you could down-arrow through the overloads till you got to the right overload, then type space again, and it would give you a choice of the right enum values of the correct type, for the argument you had got to in the list.
Here's what VS2013 did, for instance:
However, this is the VS2015 equivalent, on the exact same line of code, after scrolling through to the correct overload:
As you can see, it gives a completely wrong list of possible options.
There was a similar problem with a previous version of Studio that eventually got fixed after the whole community howled in pain.
It seems to be back with VS2015 - a significant retrograde step. Now you have to know the exact type it's expecting before it will give you options.
A similar issue seems to have been reported a year ago re the Community Edition but it, or a more subtle version of it is clearly also affecting Update 3 of Enterprise.
Is there any way to reproduce the Common/All tabs behaviour of VS2013?
Edit: here are my selected options:
They're the same as I had in VS2013.
What the intellisense shows is the list of member according to the current signature (or what the compiler thinks it could be), not according to the overload tooltip.
For example see this
It shows the same overall behaviour as in your post.
But to obtain it, after having written the comma after "caption" I changed the current overload tooltip manually using up/down arrow on keyboard.
Note, it was not mandatory to change it manually even without that it was proposing me some overload which takes an IWin32Window for first argument even with an already present string as first argument
Then I pressed space and the intellisense showed what is appropriate given the context not the tooltip.
In your post we can see it's not the same overload in both screen.
I can't say for sure it is what happened for you (given I changed the overload tooltip on purpose) but if I had to bet, I would go that way.
I have an Eclipse custom editor and I implemented 'report errors as you type', but every now and then my error squigglies (using JFace annotations) are not shown or linger after they should be removed.
I am using MonoReconciler with my implementation of IReconcilingStrategy. During the reconcile step I call annotationModel.replaceAnnotations to remove the old errors and add the new ones. Most of the times this works fine. Every now and then the updates are lost, and I notice the following:
the red stamp on the left ruler disappears, but the red underlines stay
on the next character I type, the underline disappears
I verified in the debugger that the annotations are correctly calculated. The underline disappears immediately after typing a character, and not after the 500ms delay of the reconciler. It looks like a lost UI update/redraw.
There must be a race condition somewhere (the reconciler runs in its own thread). What am I doing wrong? I couldn't find any documentation about this use-case.
Edit: To reproduce, checkout the scala-worksheet and create a new one. Type
object Test {
val m = Map( 't' -> 1 )
}
Now edit the arrow: remove the >. The underline is missing. Type a space, it comes back. Add it back, the underline is still there until you type another space.
I fixed it by calling invalidateTextPresentation on the underling SourceViewer, but it seems to me that shouldn't be necessary. I'd like to understand what is the correct way to use editor annotations.
PS. The lost updates can also be seen in this screencast.
It's hard to tell from a distance, typically in eclipse, any changes that impact the ui should be executed on the ui thread (and eclipse will not always warn about this).
Normally you use Display.getDefault().asyncExec(...) to execute something on the ui thread but you probably already know this. It can happen that 2 queued up changes cause a race.
(I have implemented semantic highlighting, error highlighting etc several times for the company I work for, Sigasi. If you can point me to your implementation I may be able to figure out what's going wrong.)
It really annoys me that IntelliJ highlights certain 'errors' (that don't prevent successful compilation) the same way that real errors are highlighted. For example, a magic number is not really an error, but it will be flagged in exactly the same way as an incompatible type error.
How can I change this?
Go to Settings -> Inspections. Then you need to search through the long list for the offending inspection, which you can get the name of by hovering on the warning marker in the margin. You can change the severity of the inspection, whether it's an error, warning, etc. or just disable it altogether.
Edit: if you search for "magic" in Settings, you get the following, which should be helpful:
Whenever you see an inspection warning/error you can place the caret on it and press Alt+Enter (a light bulb also appears that tells you that). A menu will appear with suggested quick fixes. You may need to open a submenu by pressing Right, and you'll find "Edit inspection settings" there. Having invoked that, you may proceed as in hvgotcodes's answer :), it's just a faster way of getting to those settings.
As Michael Calvin said you can use the SuppressWarnings annotation. For example:
#SuppressWarnings("OptionalUsedAsFieldOrParameterType")
See https://github.com/JetBrains/intellij-community/blob/master/plugins/InspectionGadgets/src/inspectionDescriptions/OptionalUsedAsFieldOrParameterType.html
Usually searching the internet for the exact description leads me to this.
Not directly relevant to the OP, but may be of use to future Googlers
I got to this question while trying to figure out how to disable IntelliJ IDEA's warnings about Guava functionalities that have been replaced by Java 8 features. I'm not able to use the Java 8 versions of these features in my case because of a library we're using that was built with Guava (despite being a Java 8 project). So to solve that, I added a SuppressWarnings annotation before any class using Guava:
#SuppressWarnings(Guava)
public final class...
I come from a .Net world so I'm used to just hovering over a variable while debugging and seeing what its value is.
In Objective-C I am incredibly confused on how to do that.
If I hover over it, I get a small popup with lots of information...that doesn't help me at all.
For example, I have an object called "myServer" and it is an instance of a "Server" that I have created through CoreData. One of its properties is "root" which is a simple NSString.
I cannot for the LIFE of me figure out how to view what the value of [myServer root] is.
Can some please give me some advice on this?
In the gdb console, type
po [myServer root]
I like to use GDB from the command line. Open a terminal and type
gdb
attach <your process name>
(be sure your program was built with debugging symbols). Then, when your variable name is in scope (e.g. when you break somewhere relevant) type
po variableName
to view its contents.
Another nice way to deal with this is to log directly from a breakpoint.
To do this, create a breakpoint after the value you want to see has been set, then edit it. Add a breakpoint action of 'log', and put the expression you want logged within a pair of # symbols. Check the box to the right, ensuring that the breakpoint doesn't actually cause a stop. The value will be output to the debugger console on doing a run & debug.
Doing it this way you (a) don't clutter your source, (b) can dis/enable the breakpoint at will according to your immediate needs, and (c) don't need to stop execution.
This and other very handy xcode tips can be culled from Joar Wingfors' 'Debugging with Xcode' talk.
I'm trying to watch a variable with Xcode. I'm following the instructions in here by pausing at a breakpoint, selecting Run > Variables View > .... but with the exception of "Enable Data Formatters" the rest of the options are all greyed out. Any ideas?
I'm using Xcode version 3.1.3.
I haven't gotten watchpoints created from the Run menu to work for me either, unfortunately. One thing to be aware of is that when a variable goes out of scope, the watchpoint may become invalid.
If you don't mind getting a little more in-depth, you can use some low-level gdb commands to set a watchpoint for the address of the memory itself. For example, in the guide you linked to, they show how to watch the variable path which is a pointer with the value 0xbfffeb70. To manually set a watchpoint for that address, click in the debugger console (where the debugging output is printed) after the "(gdb)" prompt and type something like this:
watch *((int*)0xbfffeb70)
The cryptic syntax is necessary because gdb expects inputs as C expressions. For a little more detail, visit this link and jump to the section titled "Using hardware watchpoints". (I'm testing on an Intel machine, not sure how PowerPC handles it.) When you set watchpoints this way, Xcode will alert you with a drop-down sheet when a watchpoint is reached and tell you how the value was changed, and gdb will print the same info in the console.
I just ran into this problem. Here is a solution: right click on the variable name and select "View variable in window" from the menu which appears. It should be near the bottom.
Add a breakpoint. Right click in the watch list of the debug area and choose "Add expression..."
If you are getting a different menu, you have to click off of the currently highlighted variable so that nothing is highlighted when you right click.
The Answers given here only work if you use the gdb compiler. For those of you who are looking for an option to set a watchpoint with the lldb compiler I have bad news:
It's not working jet (XCode 4.3.2 with lldb 3.1) even though the lldb docs say you can.
Check out this Email. The lldb commands compared to the gdbs can be found here
I was trying to figure this out in XCode 5. I finally found a "Variables view" button at the bottom right of the output console. It's the little rectangle that will be gray on the left, white on the right if it's not enabled. I'm not sure if this is in XCode 3, but I expect most people have upgraded anyway.