diff --git a/src/Editor/DropdownBars.cs b/src/Editor/DropdownBars.cs index db9c97d..e2f9a65 100644 --- a/src/Editor/DropdownBars.cs +++ b/src/Editor/DropdownBars.cs @@ -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; @@ -22,15 +21,13 @@ public DropdownBars(IVsTextView textView, LanguageService languageService) { _languageService = languageService; - IVsEditorAdaptersFactoryService adapter = VS.GetMefService(); - - _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(); diff --git a/src/Editor/LanguageFactory.cs b/src/Editor/LanguageFactory.cs index 7c96aef..8296e10 100644 --- a/src/Editor/LanguageFactory.cs +++ b/src/Editor/LanguageFactory.cs @@ -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) { diff --git a/src/PkgdefLanguage.csproj b/src/PkgdefLanguage.csproj index 455df68..cd6365f 100644 --- a/src/PkgdefLanguage.csproj +++ b/src/PkgdefLanguage.csproj @@ -70,7 +70,7 @@ - + compile; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/PkgdefLanguage.Test.csproj b/test/PkgdefLanguage.Test.csproj index 7ea2af3..a42809c 100644 --- a/test/PkgdefLanguage.Test.csproj +++ b/test/PkgdefLanguage.Test.csproj @@ -7,7 +7,7 @@ - +