Skip to content

(GH-466) Add IDE integration with Visual Studio using TeamCity addin #479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -535,5 +535,20 @@ public void Should_Replace_EndColumn_Token()
result.ShouldBe("FooendColumnBar");
}
}

public sealed class TheForVisualStudioUsingTeamCityAddinMethod
{
[Fact]
public void Should_Return_Settings()
{
// Given

// When
var settings = IdeIntegrationSettings.ForVisualStudioUsingTeamCityAddin();

// Then
settings.ShouldNotBeNull();
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
[SuppressMessage("ReSharper", "UnusedType.Global", Justification = "Class will be loaded by Cake")]
public static class GenericIssueReportFormatAliases
{
/// <summary>
/// Gets an instance of the IDE integration settings for opening files in Visual Studio using the TeamCity addin.
/// </summary>
/// <param name="context">The context.</param>
/// <returns>IDE integration settings.</returns>
[CakeMethodAlias]
[CakeAliasCategory(ReportingAliasConstants.ReportingFormatCakeAliasCategory)]
public static IdeIntegrationSettings GenericIssueReportIdeIntegrationSettingsForVisualStudioUsingTeamCityAddin(
this ICakeContext context)
{
context.NotNull(nameof(context));

return IdeIntegrationSettings.ForVisualStudioUsingTeamCityAddin();
}

/// <summary>
/// Gets an instance of a the generic report format using an embedded template.
/// </summary>
Expand Down
20 changes: 20 additions & 0 deletions src/Cake.Issues.Reporting.Generic/IdeIntegrationSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ public class IdeIntegrationSettings
/// </summary>
public string MenuEntryText { get; set; } = "Open in IDE";

/// <summary>
/// Returns settings for integrating with Visual Studio using the TeamCity addin.
/// </summary>
/// <returns>Settings for integrating with Visual Studio using the TeamCity addin.</returns>
public static IdeIntegrationSettings ForVisualStudioUsingTeamCityAddin()
{
return new IdeIntegrationSettings()
{
MenuEntryText = "Open in Visual Studio",
JavaScript =
@"function sendHttpGetRequest(filePath, lineNumber) {
var url = 'http://127.0.0.1:63330/file?file=' + filePath + '&line=' + lineNumber;
var xmlHttp = new XMLHttpRequest();
xmlHttp.open('GET', url, false);
xmlHttp.send(null);
}",
OpenInIdeCall = "sendHttpGetRequest({FilePath}, {Line});"
};
}

/// <summary>
/// Returns the JavaScript which should be called to open the file affected by an issue in an IDE
/// with all patterns of <see cref="OpenInIdeCall"/> replaced.
Expand Down