How do you use Xcode's Extract refactoring tool?
Whatever code I select, I always get the same unhelpful error message.
The selection does not contain anything that can be extracted. Make a
different selection and try again.
See the screenshots below:
What do I need to follow to have it work?
I am doing this on a simple iOS project, nothing special, no C++. Tried with the latest version of Xcode (4.4) and the newer latest developer preview releases.
Is this a bug? Any workaround?
For some strange reason if you have a block that doesn't create an obvious return value of pick up parameters XCode complains if you include the newlines. In my opinion this is a bug, as whitespace should be ignore. Just make sure you don't include the newlines. For example, the following works with "Refactor > Extract Method":
Automated refactoring tools first check that certain preconditions are true before applying the requested refactoring. In this case, it seems that the preconditions failed. I've done plenty of similar Extract Method refactorings in XCode and I can't why there's a problem with the code you selected. Perhaps there's some subtle dependency that isn't apparent in the code you show.
I'm not sure if I'd call this a bug. In developing a refactoring tool the developer can always make the preconditions a bit weaker at the price of more complicated refactoring logic.
Doesn't solve your problem but perhaps is of some help.
Related
When writing Ruby code, the following suggestion comes up each time the cursor hits an end statement (intellisense-like):
It is very annoying (breaks the flow, since it must be escaped) and useless. I don't know where or what extension it comes from.
How do I determine what piece of plugin injects this suggestion?
And then, how do I shut it off?
In your settings.json file - you have the ability to control which plugin is making recommendations - mine has the following:
"editor.quickSuggestions": null // use rubocop for formatting
"ruby.intellisense": "rubyLocate",
Purely disabling the intellisense functionality would be controlled by these settings.
https://code.visualstudio.com/docs/editor/intellisense
I don't believe that you can purely turn off the 'end' only intellisense - it appears to be an all-or-none proposition.
After a recent update on VS2017. I'm seeing lots of Late binding errors on all projects.
The errors are showing because Option Script of set to on somewhere, but all my projects have the option Option Strict set to Off.
On some projects even if I set Option Strict to Off in the page code behind, I still get the error.
Sometimes if I try to reference Microsoft Visual Basic in the project, the errors go away, sometimes not.
Anyone else experiencing this problem? Any ideas how to fix?
seems to be fixed in Rel. 15.5.2!
pLease have a look at
https://developercommunity.visualstudio.com/content/problem/160609/vb-option-strict-on-warnings-are-shown-on-existing.html
So MS is already aware of the bug and proposes another workaround.
I'm facing the same problem. The workaround I found is:
1. Turn option strict ON
2. Compile your project (will not succeed due to option strict on)
3. Turn option strict OFF
4. Compile your project (compilation success and no more errors)
This problem has now been Fixed in release 15.5.2.
You might have to save a project with Option Strict On then save with Option Strict Off. I didn't have to do that.
Source :https://developercommunity.visualstudio.com/content/problem/160609/vb-option-strict-on-warnings-are-shown-on-existing.html
Using Visual Studio Online, how should we mark bugs that are not reproducible? I don't want to mark them as "Done", obviously. Marking them as "Removed" feels weird, but maybe that's the correct way to handle them. Any advice?
This is exactly the kind of thing you can solve with tags. You're not fixing the bug -- the reason doesn't matter. It's "Done". Then tag it as "No-Repro", and you have a way to track it.
As Bugs are the result os a failing Test Case you should not have any Bugs that are not reproducible. It's about workflow.
When a user reports issue should a tester to use exploratory trying tools to verify that it is indeed a bug.
At that point they can create both the Bug and related Test Case that proves that it exists.
Ultimately you should never have a bug in your system that does not have a Test Case associated.
If you don't have that workflow then you can use Tags as Daniel suggests, but changing your workflow would be a better option. Less rework...
You have some code you want to remove associated with an obsolete piece of functionality from a ruby project. How do ensure that you get rid of all of the code?
Some guidelines that usually help in refactoring ruby apply, but there are added challenges because having code that isn't being called by anything won't break any unit tests.
Update: Has anyone written anything that allows you to guess based on your version control history if there are commits where you have since deleted most, but not all, of the code and can point out the remaining code?
Current thoughts:
Identify the outermost part of the stack associated with the obsolete functionality: the binary script calling it, or the unit tests calling it.
Look for methods that are only called by methods associated with the obsolete functionality. I often use git grep for this.
In theory, running mutation testing and looking for code that used to be mutation resistant when the old test suite applied, but is now mutation prone might help. It only helps if your code was well-tested in the first place! (Or you can use code coverage tools such as rcov rather than mutation testing)
Running test suites will ensure you haven't removed anything you shouldn't have!
Using autotest can save you time if you're constantly running tests.
If your code was well-structured, it should be easier to find related methods that need to be removed.
Especially in a dynamically typed language, there is no easy way to do this. If you have unittests, thank the developer that wrote them because it will help you remove the code correctly. But you're basically SOL. Remove the code, if it breaks, put it back, figure out where it broke, attempt to work around it, and repeat.
Look at your code coverage. Any code which isn't covered may be part of the code you have left to remove (if any). (Just be sure you have removed you tests. =])
I've just done a major, major overhaul on a colleagues project and throughout the process almost everything got rewritten. There was far too much code beforehand.
Now, I am left with the prospect that in amongst my project somewhere are old pre-refactoring methods that are no longer needed.
Is there a way to search the whole project for such methods in one go?
I understand the risk of potentially removing code used via reflection.
It's very similar to this question, except I would like two extra things:
An answer specific to ReSharper
Instructions on how to achieve this using ReSharper as I cannot seem to figure it out
Use solution-wide analysis.
If you change "Unused declaration" in
"R# Options/Inspection Severity/Code Redundancies/Unused declaration" to "Show as Errors", you'll be able to identify all unused declarations.
As far as I know, there is not way to do this with R# for the entire solution/project. The only way I know of is to go through your code manually, pressing Alt+F7 on each method name.