Skip to content

Commit

Permalink
Merge pull request #3039 from VsVim/vsmac17.6
Browse files Browse the repository at this point in the history
VSMac 17.6 / .Net 7
  • Loading branch information
nosami committed Feb 23, 2023
2 parents 18f2e58 + b317073 commit c09517b
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Expand Up @@ -88,7 +88,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: VSMacExtension
path: 'Binaries/Debug/VimMac/net6.0-macos/Vim.Mac.VsVim_${{ env.EXTENSION_VERSION }}.mpack'
path: 'Binaries/Debug/VimMac/net7.0/Vim.Mac.VsVim_${{ env.EXTENSION_VERSION }}.mpack'

- name: Create VS Mac extension release
uses: softprops/action-gh-release@v1
Expand All @@ -100,5 +100,5 @@ jobs:
name: 'Visual Studio for Mac ${{ env.VERSION_TAG }}'
draft: false
generate_release_notes: true
files: 'Binaries/Debug/VimMac/net6.0-macos/Vim.Mac.VsVim_${{ env.EXTENSION_VERSION }}.mpack'
files: 'Binaries/Debug/VimMac/net7.0/Vim.Mac.VsVim_${{ env.EXTENSION_VERSION }}.mpack'
if: ${{ success() && startsWith(github.ref, 'refs/tags') && contains(github.ref, 'vsm') }}
16 changes: 10 additions & 6 deletions Scripts/build.sh
@@ -1,17 +1,21 @@
echo "Downloading VSMac"
url="https://download.visualstudio.microsoft.com/download/pr/e81e04d3-768a-4310-9c9b-f32e8ba00eaa/889c20580d7989524e9b42726510452e/visualstudioformac-17.3.0.2102-x64.dmg"
url="https://download.visualstudio.microsoft.com/download/pr/93f43532-c75a-43bf-a335-9c62d3ad7c56/a0c1df1aa17141472362c80cef1a2581/visualstudioformac-preview-17.6.0.402-pre.1-x64.dmg"
wget --quiet $url

hdiutil attach `basename $url`

echo "Installing VSMac 17.3"
ditto -rsrc "/Volumes/Visual Studio/" /Applications/
echo "Removing existing VSMac installation"
sudo rm -rf "/Applications/Visual Studio.app"

echo "Installing VSMac 17.6"
ditto -rsrc "/Volumes/Visual Studio (Preview)/" /Applications/
mv "/Applications/Visual Studio (Preview).app" "/Applications/Visual Studio.app"
ls -la /Applications/

echo "installing dotnet 6.0.3xx"
echo "installing dotnet 7.0.2xx"
wget https://dot.net/v1/dotnet-install.sh
bash dotnet-install.sh --channel 6.0.3xx
sudo ~/.dotnet/dotnet workload install macos
bash dotnet-install.sh --channel 7.0.2xx
~/.dotnet/dotnet workload install macos

echo "Building the extension"
~/.dotnet/dotnet msbuild /p:Configuration=ReleaseMac /p:Platform="Any CPU" /t:Restore
Expand Down
2 changes: 1 addition & 1 deletion Src/VimCore/AutoCommandRunner.fs
Expand Up @@ -50,7 +50,7 @@ type internal AutoCommandRunner
let bclPattern = builder.ToString()
VimRegexFactory.CreateBcl bclPattern RegexOptions.None

static let FileNameEndsWithPattern fileName pattern =
static let FileNameEndsWithPattern (fileName: string) pattern =
try
let regex = CreateFilePatternRegex pattern
match regex with
Expand Down
2 changes: 1 addition & 1 deletion Src/VimCore/CoreInterfaces.fs
Expand Up @@ -715,7 +715,7 @@ type ISearchService =

/// Find the next 'count' occurrence of the specified pattern. Note: The first occurrence won't
/// match anything at the provided start point. That will be adjusted appropriately
abstract FindNextPattern: searchPoint: SnapshotPoint -> searchPoint: SearchData -> navigator: SnapshotWordNavigator -> count: int -> SearchResult
abstract FindNextPattern: searchPoint: SnapshotPoint -> searchData: SearchData -> navigator: SnapshotWordNavigator -> count: int -> SearchResult

/// Column information about the caret in relation to this Motion Result
[<RequireQualifiedAccess>]
Expand Down
3 changes: 2 additions & 1 deletion Src/VimCore/VimCore.fsproj
Expand Up @@ -3,11 +3,12 @@
<OutputType>Library</OutputType>
<RootNamespace>Vim.Core</RootNamespace>
<AssemblyName>Vim.Core</AssemblyName>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net7.0</TargetFrameworks>
<OtherFlags>--standalone</OtherFlags>
<NoWarn>2011</NoWarn>
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
<DebugType>portable</DebugType>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<None Include="README.md" />
Expand Down
2 changes: 1 addition & 1 deletion Src/VimCore/VimRegex.fs
Expand Up @@ -260,7 +260,7 @@ type VimRegex
member x.Regex = _regex
member x.IncludesNewLine = _includesNewLine
member x.MatchesVisualSelection = _matchesVisualSelection
member x.IsMatch pattern = _regex.IsMatch(pattern)
member x.IsMatch (pattern: string) = _regex.IsMatch(pattern)
member x.Replace (input: string) (replacement: string) (replaceData: VimRegexReplaceData) (registerMap: IRegisterMap) =
let collection = _regex.Matches(input)
if collection.Count > 0 then
Expand Down
2 changes: 1 addition & 1 deletion Src/VimMac/Properties/AddinInfo.cs
Expand Up @@ -5,7 +5,7 @@
[assembly: Addin(
"VsVim",
Namespace = "Vim.Mac",
Version = "2.8.0.19"
Version = "2.8.0.20"
)]

[assembly: AddinName("VsVim")]
Expand Down
@@ -1,6 +1,6 @@
using System;
using System.Globalization;

using System.Runtime.InteropServices;
using AppKit;
using CoreAnimation;
using CoreGraphics;
Expand All @@ -15,7 +15,7 @@ internal sealed class CocoaLineNumberMarginDrawingVisual : CALayer, ICALayerDele
{
private NSStringAttributes stringAttributes;
private CGRect lineBounds;
private nfloat lineAscent;
private NFloat lineAscent;
private CTLine ctLine;

public int LineNumber { get; private set; }
Expand All @@ -37,7 +37,7 @@ public CocoaLineNumberMarginDrawingVisual()
internal void Update(
NSStringAttributes stringAttributes,
Line line,
nfloat lineWidth)
NFloat lineWidth)
{
// NOTE: keep this in sync with CocoaRenderedLineVisual regarding any font
// metric handling, transforms, etc. Ensure that line numbers are always
Expand All @@ -63,7 +63,7 @@ public CocoaLineNumberMarginDrawingVisual()
AffineTransform = new CGAffineTransform(
1, 0,
0, 1,
0, (nfloat)line.TextTop);
0, (NFloat)line.TextTop);

var transformRect = AffineTransform.TransformRect(new CGRect(
line.IsCaretLine ? 0 : lineWidth - lineBounds.Width, // right justify
Expand Down
17 changes: 16 additions & 1 deletion Src/VimMac/RelativeLineNumbers/RelativeLineNumbersMargin.cs
Expand Up @@ -29,6 +29,7 @@ internal sealed class RelativeLineNumbersMargin : NSView, ICocoaTextViewMargin
private ICocoaClassificationFormatMap _classificationFormatMap;
private IClassificationTypeRegistryService _classificationTypeRegistry;
internal NSStringAttributes _formatting;
private NSStringAttributes _currentLineFormatting;

private int _visibleDigits = 5;

Expand Down Expand Up @@ -135,7 +136,12 @@ private void SetFontFromClassification()

var font = _classificationFormatMap.GetTextProperties(lineNumberClassificaiton);

IClassificationType currentLineNumberClassification = _classificationTypeRegistry.GetClassificationType("Selected Line Number");

var currentLineNumberFont = _classificationFormatMap.GetTextProperties(currentLineNumberClassification);

_formatting = font;
_currentLineFormatting = currentLineNumberFont;

this.DetermineMarginWidth();
Layer.BackgroundColor = (font.BackgroundColor ?? NSColor.Clear).CGColor;
Expand Down Expand Up @@ -208,6 +214,7 @@ private void ResizeIfNecessary(int lastVisibleLineNumber)
private void UpdateLineNumbers()
{
_updateNeeded = false;
int currentLineNumber = _textView.Caret.Position.BufferPosition.GetContainingLine().LineNumber + 1;

if (!Enabled)
{
Expand Down Expand Up @@ -302,8 +309,16 @@ private void UpdateLineNumbers()
void UpdateVisual(CocoaLineNumberMarginDrawingVisual visual, Line line)
{
visual.InUse = true;

var formatting = _formatting;

if (line.LineNumber == currentLineNumber)
{
formatting = _currentLineFormatting;
}

visual.Update(
_formatting,
formatting,
line,
intrinsicContentSize.Width);
}
Expand Down
4 changes: 2 additions & 2 deletions Src/VimMac/VimMac.csproj
Expand Up @@ -4,15 +4,15 @@
<OutputType>Library</OutputType>
<RootNamespace>Vim.Mac</RootNamespace>
<AssemblyName>Vim.Mac</AssemblyName>
<TargetFramework>net6.0-macos</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<DefineConstants>$(DefineConstants);VS_SPECIFIC_MAC</DefineConstants>
<!-- Suppress warning CA1416 -->
<EnableNETAnalyzers>false</EnableNETAnalyzers>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\VimCore\VimCore.fsproj" />
<PackageReference Include="Microsoft.VisualStudioMac.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="4.3.0.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Scripting" Version="4.5.0-2.final" />
</ItemGroup>
<ItemGroup>
<AddinReference Include="MonoDevelop.TextEditor" />
Expand Down

0 comments on commit c09517b

Please sign in to comment.