After I do a git rebase, the code lines I have added/modified are indented four spaces or more to the left of the respective code block. This is incredibly annoying and time-consuming to fix, not to mention it makes it unreadable for Objective-C (imagine if I was coding in python...?)
Xcode (or whatever, git?) adds in tabs in place of the spaces, and my Xcode is set to make tabs spaces.
No one at my work seems to have a good answer for why it occurs. I made trustctime false, but that did not help. Any help?
This could be a whitespace setting. Check out the options for core.whitespace on the git-config man page. If you have that set as well as apply.whitespace, then git will do things to your whitespace, probably including during a rebase.
Try finding out what git config core.whitespace and git config apply.whitespace are and modify them in your ~/.gitconfig file or with something like:
git config --global apply.whitespace nowarn
UPDATE
I think this may be a duplicate of git whitespace woes
END UPDATE
Unless you've done some customization into your git post-commit hooks or to your git config core.whitespace settings (thanks for pointing that out jesse), git does not translate spaces to tabs or vice versa or anything like that. The changes are usually results of your environment/files and your merge activities.
Having dealt with this in various forms, my guess is that some of your peers are using tabs and some are using spaces. People will have flame wars all day long on whether you should use tabs or spaces, and depending on the day and language I hop sides. That's not something I will get into here.. However just about every rational participant in said war would agree that regardless of which you pick, you need to pick one and use it consistently throughout a project.
Most reasonable editors allow you to control whether tabs or spaces should be inserted, and I know XCode is no stranger to this.
I would suggest showing the whitespace or using briefly an editor which allows you to see the whitespace to see what the difference actually is. Seperately, after you correct a whole file you could also just use git diff -w -b to suppress white space changes. That said you should really figure out what the heck is causing your whitespace to go nuts on a rebase because that suggests to me most likely git is confused by mixed usages, and multiple people correcting it at multiple points with different resolutions.
Good luck to you, it's never easy, and someone is always unhappy when their cheese gets moved.
I don't know what about my git-config was the issue, but after clearing it out and re-doing my settings, the problem was fixed. I don't have my old git-config :( This occurred many months ago, but I thought I would express that this was not xcode related.
Related
My question is the same as the one posed here:
Ignore a folder in search results
I'm using PyCharm rather than IntelliJ-IDEA, but I'm guessing that features common to all JetBrains IDEs should work the same. If the accepted answer actually did what is suggested, it would be just what I'm looking for. But it doesn't work for me. It does something interesting, but not what I want.
I have marked directories I don't want searched as "Excluded". My problem is, files aren't excluded from my search results as suggested. The interesting thing is, matched file in the directories I've marked Excluded ARE HILIGHTED to indicate that they were found in one of those directories. So I know I've got everything set up right. The GUI is showing me which files I can myself ignore by way of hilighting them in the search results window. So if it's going that far, surely there must be an option somewhere to exclude them completely. I've looked and looked. I can't find such an option.
Here's a sample result so that you can see what I'm talking about in terms of the hilighting:
Here, what I want is for the first four files shown here to show up but not the remaining eight. Can anyone tell me how to get Excluded files to not show up at all in a Jetbrains Find in Files result window rather than just hilighting them differently? TIA.
I sent off a tech support request to Jetbrains. They got back to me in less than 24 hours (I've always had great response times from them). Here's what they said:
Your understanding is correct -- the excluded directories should not
appear in the search result. However, if you just marked the directory
as excluded, it may require a project refresh to update the indices.
This is done when you reopen the project.
If the issue is still reproduced after reopening a project, there may
be an issue with indices, so please try File | Invalidate Caches... |
(Check all boxes) Invalidate and Restart.
If that doesn't help as well, please check if the issue is reproduced
in a new empty project with a minimal structure to reproduce the
issue.
I had already tried reloading my project, then restarting PyCharm, and even rebooting my Mac. None of those things helped. I had thought to rebuild the indexes, but I've got a number of large projects and was concerned that I'd keep hitting delays every time I opened one of them if I cleared out all of PyCharm's caches. But that was about all I had left to try, and since Jetbrains told me to try that, I did.
...and...clearing all PyCharm caches fixed the problem! I no longer see any of the files in Excluded directories when using any of the search modes in the "Find In Files" dialog. To be quite sure that the re-indexing fixed this, before clearing the PyCharm caches, I made a point of closing everything, then opening just the one project I was having trouble with, and then doing a straightforward search. I saw files from Excluded dirs that shouldn't have been there. Then I cleared all the PyCharm caches, and quit and restarted PyCharm. Then I did the exact same search I had done just a few minutes earlier (it took about 5 minutes to re-index the project). The results this time were to only show me what I expected/wanted. The files in Excluded directories were gone from the search results.
SUMMARY:
I need the most efficient workflow to individually edit over 200 files, and have them automatically disappear from the search results as they are updated.
DETAILS:
I am in the process of adding logging throughout a legacy system, and need to update over 200 files, each with their own custom code. I need to edit them one by one, and would like for the updated files to automatically disappear from my working search results after I have completed each one. The idea is to know how many and which ones still need to be updated as I slowly work through them all.
I already had to do something similar a few months ago, but on a much smaller scale, and I used an old-school HACK to do it. I did a search and replace for my keyword, and intentionally misspelled it. I then used the misspelled keyword for my search, and corrected it when editing each file, hence automatically removing it from the list. It "works", but is obviously a TOTAL HACK.
I recently started using IntelliJ IDEA, and am not yet familiar with the more advanced features like Find in File Scopes, Search Structurally, Search Templates, etc., but I am sure there HAS to be a "correct" way to do this in IntelliJ, and I just don't know how.
I am currently using "Find in Files" to work through the list, and recently found "All Changed Files" in the Scope list, which is actually the EXACT OPPOSITE of what I need. Is there a way to show "All UNCHANGED Files"??? That would work PERFECTLY in a pinch! But really, I would rather learn the CORRECT way to do this in IntelliJ.
Thanks!
I've been experiencing some weird issues with IntelliJ IDEA on my Mac. When I copy, cut and paste, the input is usually doubled. So if I have a line like this,
println("Awesome message")
and then I try to cut the "Awesome message" part, it doubles the cut command (meaning that it actually puts println() into my clipboard). Then when I try to paste it, it pastes as println()println().
Rarely, this does not happen, but the majority of the time it does.
Additionally when I'm typing the IDE will often not register some of my keystrokes. So if I type something like "class User(#Id #GeneratedValue(strategy = GenerationType.IDENTITY)", it will often times come out as "(#Id #GentedVale(stragy = GennType.IDENTTY)". This also doesn't happen all the time, just most of the time.
I've tried adding editor.zero.latency.typing=true into idea.properties but it hasn't helped at all.
I wasn't able to pinpoint the problem, but after uninstalling IntelliJ IDEA, completely deleting all the software's data on my machine, and then reinstalling, the problem was solved.
Again, to clarify, merely deleting my plugins and reinstalling did not fix the problem. I had to follow the instructions written here. After doing that, then reinstalling, the problem was solved.
I'm using several of JetBrains' products, like IntelliJ IDEA, PyCharm and PhpStorm. One issue I'm having is that when viewing a diff codelines will look different even though they are identical.
(full image)
The lines are identical, but the rendering of them are different. That's pretty annoying, as it's hard to spot where there are actual differences.
This example can be mostly solved by turning off inspections, but that turns them off for the whole project, and I will need to constantly enable and disable it.
(full image)
In this example, there's also no differences. And there are no highlighting from inspections. But still the code is rendered differently. The comment reminded my that this is because of language injections. Turning them off makes stuff look right, but I want them when I work.
How can I make my diff become more readable and the differences easier to spot without all the clutter and without disabling everything?
It's been possible for a while now to change this just for a diff-view. For instance when committing, one can press the cog and change Highlighting Level.
On both Xcode 4.4 and 4.4.1 I'm experiencing the same issue in that with the specific project I'm working on, I don't seem to be able to rename any classes or variables from the Refactor menu option.
Each time I try and do a rename, I type in the new name for the class/variable and click Preview at which point the bottom left begins a spinner with Finding files.... However, I then get a message saying:
The selection is not a type that can be renamed.
Make a different selection and try again.
I'm pretty sure that this is not an issue with my specific install of Xcode, because I can refactor other projects fine, it's just that I can't seem to be able to refactor this specific project.
Anyone with any ideas? I don't have any particularly exotic configuration for this project, it just seems to be a random affliction. I've deleted all of my derived data and re-indexed, but that doesn't seem to help.
Since it works OK in other projects, I'm thinking one thing I could try to do is re-generate the actual project file(s) itself. I don't know if there is a way to do this automatically?
If they're in dropbox get them out of there. It mangles project files. I've had it happen numerous times and at times it makes refactoring > renaming not work.
I have managed to solve this issue after trying many different things (tweaking project settings, pch, etc.) and it turns out there was a very simple (and totally counter-intuitive) method of fixing this issue.
All I have done is:-
Copy my entire project folder (so from Project to Project Copy).
Move Project (the original folder) to trash.
Rename Project Copy to Project.
Mysteriously, everything now works fine.
I really cannot figure out why this works. As mentioned previously, I had already deleted all derived data, etc. so I don't know why this should make things spontaneously work, but it does.
Would appreciate anyone who is able to shed some light on this as it does expose just how fiddly Xcode can be, and any understanding of what goes on under the hood is always beneficial.
Sounds like a buggered index.
I usually use the nuke from space option to delete everything in the derived data directory.
Unless you have changed it (I change mine to /tmp/bbum-derived), it'll be at:
~/Library/Developer/Xcode/DerivedData
Thus, I'll quit Xcode and do:
rm -rf ~/Library/Developer/Xcode/DerivedData
Yes, it is a bit brute force, but it works. You can likely force Xcode to rebuild the index from the UI, but I never bother. Of course, I'm also installing quite a few "odd" builds of this and that as a part of my day job...
(that is an rm -rf. It means "nuke everything and don't ask" in unix parlance. It is dangerous. Do not mistype that command.)
It seems you have an active selection somewhere in the gui, perhaps some of your files or classes are selected ? Try unselect in every sub window and retry refactoring.
I'm a bit late to this thread, but I ran into the same problem today and I was able to get it to finally refactor correctly, thought I share it.
So in large part I did what bbum said, I closed xCode, nuked the Derived data for the project the class files were in and re opened the project. Doing just that, it didn't work; the key, I found (at least for me), is that I had to do a clean (command shift k) after xCode restarts. After that I was able to rename the class files again :)
Also as a side note, my project is divided into the main project, and a static library. When I had to rename classes in the static library, I had to quit the main project and do what I described in the static library itself. Somehow I got the same error described in the question when I tried to do the refactor/rename from the main project.
Good luck!
This thread was very helpful for me in determining the problem.
It turned out that I had to Repair Disk with Disk Utility. I had visited a site earlier that had hijacked Safari and was telling me to call a number for emergency repairs, an obvious scam.
I followed the Disk Utility instructions to repair disk (including restarting with CMD-R pressed). Another clue was that I tried to commit to git and Xcode said No Way, Jose.
Afterwards I was able to refactor and commit changes as if nothing ever happened. I hope this helps someone else as a possible cause to investigate.