Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Fixing line ending issues
Browse files Browse the repository at this point in the history
Looks like we got CRLF in the repo
  • Loading branch information
citizenmatt committed Dec 12, 2013
1 parent 1d41307 commit 559ee89
Show file tree
Hide file tree
Showing 6 changed files with 245 additions and 246 deletions.
3 changes: 1 addition & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Auto detect text files and perform LF normalization
* text eol=crlf
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
Expand All @@ -20,4 +20,3 @@
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
*.exe binary
68 changes: 34 additions & 34 deletions src/resharper-nuget/ExposeNuGetServices.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
/*
* Copyright 2012 JetBrains
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using JetBrains.VsIntegration.Application;
using Microsoft.VisualStudio.ComponentModelHost;

namespace JetBrains.ReSharper.Plugins.NuGet
{
[WrapVsInterfaces]
public class ExposeNuGetServices : IExposeVsServices
{
#if RESHARPER_8
public void Register(VsServiceProviderResolver.VsServiceMap map)
#else
public void Register(VsServiceProviderComponentContainer.VsServiceMap map)
#endif
{
if (!map.IsRegistered<IComponentModel>())
map.QueryService<SComponentModel>().As<IComponentModel>();
}
}
/*
* Copyright 2012 JetBrains
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using JetBrains.VsIntegration.Application;
using Microsoft.VisualStudio.ComponentModelHost;

namespace JetBrains.ReSharper.Plugins.NuGet
{
[WrapVsInterfaces]
public class ExposeNuGetServices : IExposeVsServices
{
#if RESHARPER_8
public void Register(VsServiceProviderResolver.VsServiceMap map)
#else
public void Register(VsServiceProviderComponentContainer.VsServiceMap map)
#endif
{
if (!map.IsRegistered<IComponentModel>())
map.QueryService<SComponentModel>().As<IComponentModel>();
}
}
}
176 changes: 88 additions & 88 deletions src/resharper-nuget/Hacks.cs
Original file line number Diff line number Diff line change
@@ -1,89 +1,89 @@
/*
* Copyright 2012 JetBrains
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Application;
using JetBrains.Application.Progress;
using JetBrains.DataFlow;
using JetBrains.ProjectModel;
using JetBrains.UI.Tooltips;
#if RESHARPER_8
using JetBrains.ReSharper.Psi.Modules;
#else
using JetBrains.ReSharper.Psi;
#endif
using JetBrains.TextControl;
using JetBrains.Threading;
using JetBrains.UI.Application;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.NuGet
{
internal static class Hacks
{
public static void PokeReSharpersAssemblyReferences(IPsiModule module,
IEnumerable<FileSystemPath> assemblyLocations,
FileSystemPath packageLocation,
IProjectPsiModule projectModule)
{
if (packageLocation.IsNullOrEmpty())
return;

// TODO: I wish we didn't have to do this
// When NuGet references the assemblies, they are queued up to be processed, but after
// this method completes. Which means the import type part of the process fails to find
// the type to import. We force an update which works through the system early. It would
// be nice to find out if we can process the proper import notifications instead
using (var cookie = module.GetSolution()
.CreateTransactionCookie(DefaultAction.Commit, "ReferenceModuleWithType",
NullProgressIndicator.Instance))
{
var assemblyLocation = assemblyLocations.FirstOrDefault(packageLocation.IsPrefixOf);
if (!assemblyLocation.IsNullOrEmpty())
cookie.AddAssemblyReference(projectModule.Project, assemblyLocation);
}
}

public static void HandleFailureToReference(FileSystemPath packageLocation, Lifetime lifetime, ITextControlManager textControlManager, IShellLocks shellLocks, ITooltipManager tooltipManager, IActionManager actionManager)
{
// TODO: Wish we didn't have to do this, either
// If we failed to install the package, it's because something has gone wrong,
// and we don't want the rest of the process to continue. Unfortunately, ReSharper
// doesn't display any error messages, so we'll very hackily try and find the
// current text editor, and display a tooltip with an error message.
// (This replicates the experience when something else goes wrong in the context
// actions that use ModuleReferencerService.) It's not a nice thing to do, but
// it's safe with how ReSharper uses IModuleReferencer out of the box. If anyone
// else uses it, and we go wrong, well, fingers crossed. We should either get
// the tooltip as expected, multiple error messages, or no error messages. Hopefully,
// we shouldn't see this very often, although I've probably just jinxed it now...
//
// Ideally, ReSharper should provide a better error mechanism as part of IModuleReferencer
if (packageLocation.IsNullOrEmpty())
{
var textControl = textControlManager.FocusedTextControl.Value;
if (textControl != null)
{
shellLocks.Queue("Failed to import type",
() => tooltipManager.ShowAtCaret(lifetime, "Failed to add NuGet package.", textControl, shellLocks, actionManager));
}
}
}
}
/*
* Copyright 2012 JetBrains
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Application;
using JetBrains.Application.Progress;
using JetBrains.DataFlow;
using JetBrains.ProjectModel;
using JetBrains.UI.Tooltips;
#if RESHARPER_8
using JetBrains.ReSharper.Psi.Modules;
#else
using JetBrains.ReSharper.Psi;
#endif
using JetBrains.TextControl;
using JetBrains.Threading;
using JetBrains.UI.Application;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.NuGet
{
internal static class Hacks
{
public static void PokeReSharpersAssemblyReferences(IPsiModule module,
IEnumerable<FileSystemPath> assemblyLocations,
FileSystemPath packageLocation,
IProjectPsiModule projectModule)
{
if (packageLocation.IsNullOrEmpty())
return;

// TODO: I wish we didn't have to do this
// When NuGet references the assemblies, they are queued up to be processed, but after
// this method completes. Which means the import type part of the process fails to find
// the type to import. We force an update which works through the system early. It would
// be nice to find out if we can process the proper import notifications instead
using (var cookie = module.GetSolution()
.CreateTransactionCookie(DefaultAction.Commit, "ReferenceModuleWithType",
NullProgressIndicator.Instance))
{
var assemblyLocation = assemblyLocations.FirstOrDefault(packageLocation.IsPrefixOf);
if (!assemblyLocation.IsNullOrEmpty())
cookie.AddAssemblyReference(projectModule.Project, assemblyLocation);
}
}

public static void HandleFailureToReference(FileSystemPath packageLocation, Lifetime lifetime, ITextControlManager textControlManager, IShellLocks shellLocks, ITooltipManager tooltipManager, IActionManager actionManager)
{
// TODO: Wish we didn't have to do this, either
// If we failed to install the package, it's because something has gone wrong,
// and we don't want the rest of the process to continue. Unfortunately, ReSharper
// doesn't display any error messages, so we'll very hackily try and find the
// current text editor, and display a tooltip with an error message.
// (This replicates the experience when something else goes wrong in the context
// actions that use ModuleReferencerService.) It's not a nice thing to do, but
// it's safe with how ReSharper uses IModuleReferencer out of the box. If anyone
// else uses it, and we go wrong, well, fingers crossed. We should either get
// the tooltip as expected, multiple error messages, or no error messages. Hopefully,
// we shouldn't see this very often, although I've probably just jinxed it now...
//
// Ideally, ReSharper should provide a better error mechanism as part of IModuleReferencer
if (packageLocation.IsNullOrEmpty())
{
var textControl = textControlManager.FocusedTextControl.Value;
if (textControl != null)
{
shellLocks.Queue("Failed to import type",
() => tooltipManager.ShowAtCaret(lifetime, "Failed to add NuGet package.", textControl, shellLocks, actionManager));
}
}
}
}
}
42 changes: 21 additions & 21 deletions src/resharper-nuget/NuGetModuleReferencerImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

using System.Collections.Generic;
using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Application;
using JetBrains.DataFlow;
using JetBrains.ProjectModel;
using System.Collections.Generic;
using System.Linq;
using JetBrains.ActionManagement;
using JetBrains.Application;
using JetBrains.DataFlow;
using JetBrains.ProjectModel;
using JetBrains.ProjectModel.Model2.Assemblies.Interfaces;
using JetBrains.ReSharper.Psi;
using JetBrains.UI.Tooltips;
using JetBrains.ReSharper.Psi;
using JetBrains.UI.Tooltips;
#if RESHARPER_8
using JetBrains.Util.Logging;
using JetBrains.ReSharper.Psi.Modules;
Expand All @@ -34,20 +34,20 @@ namespace JetBrains.ReSharper.Plugins.NuGet
{
[PsiSharedComponent]
public class NuGetModuleReferencerImpl
{
private readonly Lifetime lifetime;
{
private readonly Lifetime lifetime;
private readonly ITextControlManager textControlManager;
private readonly IShellLocks shellLocks;
private readonly ITooltipManager tooltipManager;
private readonly IActionManager actionManager;

private readonly IShellLocks shellLocks;
private readonly ITooltipManager tooltipManager;
private readonly IActionManager actionManager;

public NuGetModuleReferencerImpl(Lifetime lifetime, ITextControlManager textControlManager, IShellLocks shellLocks, ITooltipManager tooltipManager, IActionManager actionManager)
{
this.lifetime = lifetime;
{
this.lifetime = lifetime;
this.textControlManager = textControlManager;
this.shellLocks = shellLocks;
this.tooltipManager = tooltipManager;
this.actionManager = actionManager;
this.shellLocks = shellLocks;
this.tooltipManager = tooltipManager;
this.actionManager = actionManager;
}

public bool CanReferenceModule(IPsiModule module, IPsiModule moduleToReference)
Expand All @@ -57,7 +57,7 @@ public bool CanReferenceModule(IPsiModule module, IPsiModule moduleToReference)

Logger.LogMessage(LoggingLevel.VERBOSE, "[NUGET PLUGIN] Checking if module '{0}' is a nuget package", moduleToReference.DisplayName);

var assemblyLocations = GetAllAssemblyLocations(moduleToReference);
var assemblyLocations = GetAllAssemblyLocations(moduleToReference);
var canReference = module.GetSolution().GetComponent<NuGetApi>().AreAnyAssemblyFilesNuGetPackages(assemblyLocations);

Logger.LogMessage(LoggingLevel.VERBOSE, "[NUGET PLUGIN] Module '{0}' is {1}a nuget package", moduleToReference.DisplayName, canReference ? string.Empty : "NOT ");
Expand All @@ -75,7 +75,7 @@ public bool ReferenceModule(IPsiModule module, IPsiModule moduleToReference)
var assemblyLocations = GetAllAssemblyLocations(moduleToReference);
var projectModule = (IProjectPsiModule)module;

FileSystemPath packageLocation;
FileSystemPath packageLocation;
var handled = module.GetSolution().GetComponent<NuGetApi>().InstallNuGetPackageFromAssemblyFiles(assemblyLocations, projectModule.Project, out packageLocation);
if (handled)
{
Expand Down
Loading

0 comments on commit 559ee89

Please sign in to comment.