Skip to content

Commit

Permalink
Updated dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
madskristensen committed Jan 11, 2022
1 parent 59743bb commit 79985bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
7 changes: 2 additions & 5 deletions src/Editor/DropdownBars.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections;
using System.Linq;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Package;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Text.Editor;
Expand All @@ -22,15 +21,13 @@ public DropdownBars(IVsTextView textView, LanguageService languageService)
{
_languageService = languageService;

IVsEditorAdaptersFactoryService adapter = VS.GetMefService<IVsEditorAdaptersFactoryService>();

_textView = adapter.GetWpfTextView(textView);
_textView = textView.ToIWpfTextView();
_textView.Caret.PositionChanged += CaretPositionChanged;

_document = _textView.TextBuffer.GetDocument();
_document.Processed += OnDocumentProcessed;

SynchronizeDropdowns();
//SynchronizeDropdowns();
}

private void CaretPositionChanged(object sender, CaretPositionChangedEventArgs e) => SynchronizeDropdowns();
Expand Down
9 changes: 7 additions & 2 deletions src/Editor/LanguageFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ public LanguageFactory(object site) : base(site)

public override string[] FileExtensions { get; } = new[] { Constants.PkgDefExt, Constants.PkgUndefExt };

public override TypeAndMemberDropdownBars CreateDropDownHelper(IVsTextView textView) =>
_dropdownBars ??= new DropdownBars(textView, this);
public override TypeAndMemberDropdownBars CreateDropDownHelper(IVsTextView textView)
{
_dropdownBars?.Dispose();
_dropdownBars = new DropdownBars(textView, this);

return _dropdownBars;
}

public override void SetDefaultPreferences(LanguagePreferences preferences)
{
Expand Down
2 changes: 1 addition & 1 deletion src/PkgdefLanguage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Community.VisualStudio.Toolkit.16" version="16.0.384" ExcludeAssets="runtime">
<PackageReference Include="Community.VisualStudio.Toolkit.16" version="16.0.385" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools">
Expand Down
2 changes: 1 addition & 1 deletion test/PkgdefLanguage.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Compile Remove="C:\Users\madsk\.nuget\packages\community.visualstudio.toolkit.16\16.0.357\build\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Community.VisualStudio.Toolkit.16" Version="16.0.384" />
<PackageReference Include="Community.VisualStudio.Toolkit.16" Version="16.0.385" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
Expand Down

0 comments on commit 79985bb

Please sign in to comment.