private Task ProduceTagsAsync( TaggerContext <IClassificationTag> context, DocumentSnapshotSpan snapshotSpan, IClassificationService classificationService, ClassificationOptions options, ClassificationType type, CancellationToken cancellationToken) { return(ClassificationUtilities.ProduceTagsAsync( context, snapshotSpan, classificationService, _owner._typeMap, options, type, cancellationToken)); }
protected sealed override Task ProduceTagsAsync( TaggerContext <IClassificationTag> context, CancellationToken cancellationToken) { Debug.Assert(context.SpansToTag.IsSingle()); var spanToTag = context.SpansToTag.Single(); var document = spanToTag.Document; if (document == null) { return(Task.CompletedTask); } // Attempt to get a classification service which will actually produce the results. // If we can't (because we have no Document, or because the language doesn't support // this service), then bail out immediately. var classificationService = document.GetLanguageService <IClassificationService>(); if (classificationService == null) { return(Task.CompletedTask); } // The LSP client will handle producing tags when running under the LSP editor. // Our tagger implementation should return nothing to prevent conflicts. var workspaceContextService = document.Project.Solution.Services.GetRequiredService <IWorkspaceContextService>(); if (workspaceContextService?.IsInLspEditorContext() == true) { return(Task.CompletedTask); } // If the LSP semantic tokens feature flag is enabled, return nothing to prevent conflicts. var isLspSemanticTokensEnabled = _globalOptions.GetOption(LspOptions.LspSemanticTokensFeatureFlag); if (isLspSemanticTokensEnabled) { return(Task.CompletedTask); } var classificationOptions = _globalOptions.GetClassificationOptions(document.Project.Language); return(ClassificationUtilities.ProduceTagsAsync( context, spanToTag, classificationService, _typeMap, classificationOptions, _type, cancellationToken)); }