Is there a way to force sync Visual Studio Code extensions on a seperate machine running a different OS? - editor

Configuration Drift
When I use two systems, I expect both to be synced with the same set of extensions.
In my case, the primary system I'm using is at work, and once I load my editor at home I'd expect any uninstalled or added extensions to eventually sync up.
This isn't happening.
My Setup
I use macOS at work and Windows at home.
I have the same Visual Studio Code (not insiders) installed.
I have configured both with settings sync enabled and login.
I have configured keybindings to be unique per platform.
My settings.json does seem to sync, but not the extensions installed.
Manual Fix
I'd like to force sync the extensions to get this aligned, but there doesn't seem to be a way to do this in the settings sync UI.
My interim solution was to disable all extensions and then parsed the backed-up json with PowerShell to convert into code install-extension commands. This didn't fix it though as it is still drifting.
My understanding is that key bindings were unique per platform, but extensions should be.
Fixing the Issue Long-Term
Is there anything I should check that prevents extensions from being synced with the built in Visual Studio Code Settings sync.
Note: I'm not using the Shan.code-settings-sync extension at this time, having migrated over in the last year to the built in sync solution. If I don't figure this out I might consider changing back over.
I'll update this as with my progress figuring it out as a wiki style post if I can resolve through the logs what's actually causing this type of drift.

Manual Fix
To manually restore, the option isn't contained in a context menu, but instead an icon that appears on hovering.
Restoring Extensions
Use the restore icon here.
UPDATE: This solved my issue from what I can tell.
I just opened VSCode on Windows and the extensions I installed a few hours ago on macOS are showing correctly there now.

I too found that the built-in Vscode settings sync feature has bugs when syncing extensions. In the case of two clean vscode installs on two different machines, none of my extensions synced.
It seems that non existent extensions (perhaps the developer deleted their extension) can cause all extensions to inadvertently be 'blacklisted' in in the file lastSyncextensions.json under the key "skippedExtensions":[]. You can get to this file via the command Settings Sync : Open Local Backups Folder. For me, all my extensions were listed to be skipped and thus no extensions were synced on a new install of vscode.
Transitory internet errors in syncing e.g. in log [settingssync] [error] Download: XHR failed also causes extensions to be blacklisted in "skippedExtensions" in the aforementioned lastSyncextensions.json. This also sometimes causes vscode to broadcast that the extension which could not be download be removed by other machines running vscode (which sync using the same Github account).
Look in the vscode Settings Sync : Show Log and look for the list of skipped extensions.
Once something is blacklisted - the question is how fix the situation.
Solution 1 - Recovering from all extensions being blocked by non-existent extensions
Step 1:
Identify the extensions which no longer exist (search for them in the vscode extensions UI and if they don't appear, then they are the culprits). For me, they happened to be the first few entries in the "skippedExtensions" list. Then add them to "settingsSync.ignoredExtensions" of your settings.json. For my situation, I added the entry:
"settingsSync.ignoredExtensions": [
"patrys.vscode-code-outline",
"gayanhewa.referenceshelper",
"ms-vscode-remote.remote-ssh-explorer"
],
Step 2 (brutal resync):
Now we need to re-sync. Turn off settings sync via the Settings Sync:Show Synced Data / "Synced Machines" r.click on your machine and select "Turn off Settings Sync". This seems to work better than simply logging out of settings sync.
Now click on the normal vscode gear icon (bottom left) and sign in to settings sync. This prompted me like a fresh install, whether to merge, overwrite local etc. This time all the extensions came down OK.
Solution 2 - Recovering from blacklisted extension caused by transient internet errors
Lets say you see some skipped extensions in your sync log (Settings Sync : Show Log):
[2021-12-30 14:05:57.690] [settingssync] [info] Extensions: Updated last synchronized extensions. Skipped: ["sapos.yeoman-ui","tht13.html-preview-vscode","patbenatar.advanced-new-file","alexisvt.flutter-snippets","vscjava.vscode-java-pack","vscjava.vscode-java-dependency","vscjava.vscode-java-test","vscjava.vscode-maven","vscjava.vscode-java-debug","janisdd.vscode-edit-csv","mohd-akram.vscode-html-format","zjhmale.vscode-ag"].
which causes what seems to be a permanent blacklisting of these extensions on your machine in the file lastSyncextensions.json under the key "skippedExtensions". How do you fix this?
You can get to lastSyncextensions.json via the command Settings Sync : Open Local Backups Folder and then open the file in vscode itself.
To get those extensions properly installed, I edited lastSyncextensions.json and cleared the list - it now reads as "skippedExtensions":[].
Then I went to each particular extension that was previously skipped, using the vscode UI, and installed it. This should also re-install it on any other vscode machine which might have been affected.
Possibly, a simpler solution 2 (which I haven't tried) is don't bother with editing the file lastSyncextensions.json - simply do the brutal re-sync described in step 2 of my solution 1 above. Thus hopefully the lastSyncextensions.json gets regenerated (as well as the problematic "skippedExtensions": entry) and this time pray your internet connection is good and there are no download errors this time.

Just turning the settings sync off and on did it for me.

Related

How to get ios app I was working on from phone to computer?

I accidentally ran rm -rf on my terminal on my mac and lost everything, including an app project I was working on. Is it possible to somehow transfer the app project that I had deployed on my iPhone back to my computer in any way? Just so I can see what I can salvage?
You can't get the Xcode app project back from the app that was installed on your phone.
If you're using source control (such as with git), you may be able to go back to a prior version. To check, go to the command-line and do
% git log
See if it shows any history.
Otherwise, if you stored your project in your Documents or Desktop folders and have those folders synchronized with iCloud, you might be able to get it back by going to iCloud.com and checking if you can download it. However, because these folders are synchronized, doing this right away is important, because it will synchronize the deletion. This is why a cloud-sync'd folder isn't considered a backup.
If you have Time Machine configured on your Mac, you can check if there is a version available there. Open Time Machine from Launchpad -> Other -> Time Machine, or click the Time Machine icon in the upper right corner of your Mac screen (looks like a clock with an arrow/circle around it), then click "Enter Time Machine". If you're able to do this, you can go to the folder and browse previous versions by time.
Lastly, check any other backup solution you may have, such as Backblaze, for example. Backblaze is a cloud backup solution. It also has an icon up top on your Mac desktop -- it looks like a flame.
If none of these work, you're out of luck (sorry!). Learn about git, and use Bitbucket or Github with it. Set up time machine. Also set up a cloud backup, like Backblaze. I use all of those. Hopefully one of these works for you!

TFS server workspace with detection of local changes

I would like to leverage the benefits of a server workspace (seeing who has checked out which file) together with the ability of the Team Explorer - Pending Changes to detect local changes (which with my current configuration works only when using a local workspace).
Is there a possibility to configure such behavior? I do not understand which technical limitation makes my server workspace incapable of sensing that I added, removed or changed files without checking them out first. It should at least be capable of showing these and then prompting me to check them out before I can include them for commit.
Is there a possibility to configure such behavior?
Nothing is built in. If you take locks on the server, you need to explicitly notify the server, but that would mean having something running all the time to check for file changes and see if a lock could be taken (and how would arbitrary tools handle that failing?)
You could create something yourself to do this (the TFS-VC API is available).
Meanwhile most developers find the local model works better (don't require exclusive access, in the cases where there is a conflict it is resolved at checkin).

Xcode Environment Variables and Command Line Arguments

Background
I am developing an iOS app that connects to a server. We have a team of developers who run their own server with unique addresses for debugging. Our rule for source control is to only checkin the "production url".
In Android we have a solution that works really well. This solution won't work in iOS.
What I've Tried
Set a "Command line argument" or "Environment variable" in the Build Scheme. The problem with this is those are put into the "*.xcproject" file which get's checked in and causes merge conflicts. If it could be set at the user level it would be fine because we .gitignore xcuserdata.
I also tried referencing a "MyConfig.h" file that does not get checked in. But if it does not exist the project won't build.
What I want to do
If a developer wants to point at a different server they would set an environment variable on their mac. Something like "export MY_SERVER="http://domain.com/api/". In the project file we would add and environment or command line argument that is basically "MY_SERVER=$(MY_SERVER)".
Unfortunately I can't figure out how to get XCode to resolve the variable on my OSX machine. It seems environment variables are resolved on the device only. Command line arguments seem to be taken literally.
Research I've done
http://qualitycoding.org/production-url/ - does not really address the real issue
http://nshipster.com/launch-arguments-and-environment-variables/
Google, Apples developer forum and Stackoverflow post.
How do you do this in your projects ?
Is the only solution to use a backdoor or some file folks change and just try not to accidentally checkin?
As an update I found the solution that solves the problem for me. I am using https://github.com/xslim/mobileDeviceManager and a script that is checked in. The developer can create their custom configuration and copy it to the documents directory. Now we keep production checked in and have a runtime check for our custum configuration file.
Here is an example of the tools usage:
$ mobileDeviceManager -o copy -app "com.domain.MyApp" -from ~/.myAppConfig/app_override.plist
This way the developer can keep their custom configuration in their home directory (out of source control) without fear of accidental checkin. We already use process like this for other desktop and android apps so this fits our process really well. This has the added benefit that if a testers device is failing we can point it at a custom debug server with extra logging to simplify the debug process and not need to deploy a new binary to that device during internal testing.
I hope this can help someone else.

Using subversion across visual studio and Xcode [duplicate]

It seems that all of the initial Google results for "using subversion with xcode" are actually just tutorials for installing and configuring svn and Xcode, as opposed to actually using the two (i.e. interacting with svn via Xcode's GUI).
Is anyone aware of a good guide that teaches the tricks and pitfalls of working with svn via Xcode's GUI? Something that bridges the gap between the most excellent Version Control with Subversion book and the Xcode IDE (as in pure Xcode GUI without any terminal command use)?
Edit:
We all love our terminal commands, and we all love Eclipse but (and I mean this in the nicest possible way) neither is really the point of the question. I’d prefer to use svn via Xcode’s IDE instead of via terminal just as I prefer (well, for this case) to code in Xcode’s IDE instead of using vim and gcc. Apple engineers spent a good bit of time implementing that SCM menu in Xcode; someone has to have seen a usage guide somewhere.
I used this page as a reference for setting up my XCode projects with SVN. It is a good starting point, but I'll give a short walkthrough of what I did (since the page isn't really all that helpful!).
A couple notes: I'm using XCode 3.1.2 and Subversion 1.4.2. I've heard of problems with using SVN 1.5, but there are ways around that which I wont get into.
First off, I had a repository already set up and created the XCode project afterwards.
In XCode you need to set it up to know about your repository using the SCM tab in the preferences window. Enter:
A Name (this is arbitrary and used for reference with XCode)
The scheme (http or svn)
The host (i.e. svn.example.com)
The path (the exact path to the SVN repository located on the host)
The port (only if it isn't the default)
And a username and password used to access the repository.
The URL will be auto-filled as you enter the other fields. Hit "OK" when all the fields are good and XCode says it can connect.
Then open your project and do a "Get Info" (Round blue icon with an exclamation mark) on the project itself. Under the "General" tab down at the bottom is an option for SCM, select the repository you made in 1 and close the window.
Now open SCM in the menu-bar and go to "Repositories." Hopefully you've built your repository right using branches, trunk, and other directories at the base level because XCode doesn't have support for checking out the root directory. So go one directory at a time down the list and click the "Checkout" button and select a directory to check it out to (I recommend a "Code" or "Source" or "SVN" directory inside your XCode project directory). You cannot checkout multiple directories at once, but you can tell the next directory to checkout before the first has finished and XCode with queue the commands.
Once that is all done go back to your XCode project window and "Add -> Existing Files..." to your project. Select the directory you've checked out the repository to and I recommend using the "Create folder references" option instead of the "Recursively create groups" option because added and removed items will be automatically reflected in a Folder Reference but not in a Group.
Now you've imported your SVN repository into an XCode project. From here any time you make a change, simply Right-Click (Control-Click if you only have 1 button) in the file and at the bottom of the context menu are the SCM options for comparing, committing, updating, and discarding (reverting) the file. You can also use the SCM menu in the menubar for file or project-wide updates/commits/reverts.
I second the comment by the_mandrill, SVN support from within XCode is very limited, especially if you're used to Eclipse.
I also don't understand why everyone seems to need visual clients. I keep a terminal window open on my project directory and I have no problems interacting with SVN from the command line.
I know this is not quite what you asked, but I wouldn't rely much on the use of SVN from Xcode as what you can do with it is very limited. It's useful for being able to do a diff or annotate direct from the IDE but not a great deal else. I don't think it's any substitute for using a separate standalone client such as SmartSVN or Versions.
You also have to jump through a number of hoops to get Xcode to work with SVN version 1.5 onwards, so that's something to be aware of before installing a standalone client. If in doubt, check out a sandbox first.
Here is one of the best tutorials to configure subversion in XCode - http://iphonedevelopment.blogspot.com/2009/03/version-control-is-your-friend.html
It also teaches even to create repository in local MAC.
if you want to work with svn through a gui interface then i suggest you use eclipse + subclipse plugin (which have more features and much more reliable and easy than svn on xcode)..
you will work in xcode as normal but you will use eclipse only as an svn client (by creating a general project in eclipse and make it points to your xcode project directory )
and here is a tutorial of how to install subclipse
A lot of people have problems using the build in svn client, especially to get a new project into svn and that it works.
I created a straight foreward tutorial on how to do this, along with a very well known pitfall (works for Xcode up till the latest version of xcode incl. Iphone 4 sdk)
http://www.sodeso.nl/?p=599
I myself looked up for some good resources and one of the best I've found is a quite recent video from the WWDC 2012 :
Sign in here if it's not already the case : https://developer.apple.com/videos/wwdc/2012/
Then there is a video called :Session 411 - Source Control Management in Xcode
It explains how to use version control both with GIT and Subversion. It's really nice !
Hope it helps!
As has been mentioned in many other answers, the svn client with Xcode is quite weak (and that is being kind).
Personally, I think that running Eclipse just to get access to a svn client is a bit heavy handed.
I would suggest two answers:
Use a dedicated svn client for the Mac (Versions and Cornerstone are both very good, albeit not free... there are free ones, such as svnX)
If you are not wildly comfortable with the terminal, you can script a couple of the key commands that you want to use and add them to your Xcode user scripts folder, then you can trigger them from a menu item of from a keystroke, just as if you were using the Xcode native client. There's a ton of examples on how to do this available via Google.
I came across these - no idea how well they work, but wanted to add some resources if I could:
http://www.macresearch.org/tutorial-introducing-xcode-30-organizer
http://developer.apple.com/tools/subversionxcode.html
With XCode4 you can perform almost all of your SCM tasks from within the IDE itself, this is a great step forward.
Here is a link to the official guide :
http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/SCM/SCM.html#//apple_ref/doc/uid/TP40010215-CH7-SW26
Unfortunately you still have to use the Terminal command line to add a new project to SCM, this is also clearly documented in the link above.
What it does not tell you is that you also need to manually add ignore instructions to your SCM configuration otherwise you are going to end up with user settings and build outputs in your repositories. I am currently figuring out the list and I will update this answer once I have it finalised.
PS :
I know this question is quite old now but I have added this for those of you who arrive here looking for answers like I did.
PPS :
Terminal command line increases probability of human error, takes longer, is more complex and is less transparent to end users. Overall the omission of being able to add projects to SCM from within XCode is poor design, I expected better from Apple who are usually good at simplifying UI. For the command line fans out there you might feel L337 but try managing a team of programmers and being responsible for their code, command line is not your friend.

TF400018: Local version table locked

Got the below in TFS and VS 2012 RC, anyone know of a fix? Doesn't seem to exist on MS website.
TF400018: The local version table for the local workspace
COMPUTERNAME;MYNAME could not be opened. The process cannot access the
file because it is being used by another process
Any suggestions welcomed.
We experienced this one as well. Migrating to the RTM makes this happen a lot less, but it can still happen a lot.
When using local workspaces (a new feaure in vs 2012) a local file based database is created to administer changes you make localy. When you change a source file, this file base database needs to be updated. If this update conflicts with the normal update task which routinely checks for changes you get this error. The cause of this issue is usually that you are using local workspace for more items than it was intended or that your disk I/O is too slow.
Workarounds for this are either:
Replace your disk with an ssd. Having better I/O makes this issue
happen a lot less.
Switch back to server based workspaces. (which handles this better)
Use the TFS-GIT connector and use git for offline support.
Split your workspace mapping in portions so they contain less items.
Please delete the files under %Temp% folder and open the project as
"Run as Administrator " mode .It works for me .
Regards,
Kamaraj

Resources