Skip to content

Commit

Permalink
Port additional change from dotnet#40513
Browse files Browse the repository at this point in the history
  • Loading branch information
mavasani committed Feb 20, 2020
1 parent d545499 commit 8200921
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.TaskList
[Export(typeof(IOptionPersister))]
internal class CommentTaskTokenSerializer : IOptionPersister
{
private readonly VisualStudioWorkspace _workspace;
private readonly ITaskList _taskList;
private readonly IGlobalOptionService _globalOptionService;

private string _lastCommentTokenCache = null;

[ImportingConstructor]
public CommentTaskTokenSerializer(
VisualStudioWorkspace workspace,
IGlobalOptionService globalOptionService,
[Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
{
_workspace = workspace;
_globalOptionService = globalOptionService;

// The SVsTaskList may not be available or doesn't actually implement ITaskList
// in the "devenv /build" scenario
Expand Down Expand Up @@ -68,8 +68,7 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)

var commentString = GetTaskTokenList(_taskList);

var optionSet = _workspace.Options;
var optionValue = optionSet.GetOption(TodoCommentOptions.TokenList);
var optionValue = _globalOptionService.GetOption(TodoCommentOptions.TokenList);
if (optionValue == commentString)
{
return;
Expand All @@ -79,7 +78,7 @@ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
_lastCommentTokenCache = commentString;

// let people to know that comment string has changed
_workspace.SetOptions(optionSet.WithChangedOption(TodoCommentOptions.TokenList, _lastCommentTokenCache));
_globalOptionService.RefreshOption(TodoCommentOptions.TokenList, _lastCommentTokenCache);
}

private static string GetTaskTokenList(ITaskList taskList)
Expand Down

0 comments on commit 8200921

Please sign in to comment.