public SyntacticClassificationMode GetMode()
        {
            if (_modeCache != -1)
            {
                return((SyntacticClassificationMode)_modeCache);
            }

            if (!CodeAnalysis.Workspace.TryGetWorkspace(_buffer.AsTextContainer(), out var workspace))
            {
                return(SyntacticClassificationMode.TextMate);
            }

            var experimentService = workspace.Services.GetService <IExperimentationService>();

            if (experimentService == null)
            {
                return(SyntacticClassificationMode.TextMate);
            }

            if (RoslynSyntaxClassificationService.ShouldRunExperiment(_lspClientServiceFactory, experimentService, WellKnownExperimentNames.SyntacticExp_LiveShareTagger_TextMate))
            {
                _modeCache = (int)SyntacticClassificationMode.TextMate;
            }
            else if (RoslynSyntaxClassificationService.ShouldRunExperiment(_lspClientServiceFactory, experimentService, WellKnownExperimentNames.SyntacticExp_LiveShareTagger_Remote))
            {
                _modeCache = (int)SyntacticClassificationMode.SyntaxLsp;
            }
            else
            {
                // tagger is disabled.
                _modeCache = (int)SyntacticClassificationMode.None;
            }

            return((SyntacticClassificationMode)_modeCache);
        }
        public SyntacticClassificationMode GetMode()
        {
            if (_modeCache != -1)
            {
                return((SyntacticClassificationMode)_modeCache);
            }

            if (!Workspace.TryGetWorkspace(_buffer.AsTextContainer(), out var workspace))
            {
                return(SyntacticClassificationMode.TextMate);
            }

            var experimentService = workspace.Services.GetService <IExperimentationService>();

            if (experimentService == null)
            {
                return(SyntacticClassificationMode.TextMate);
            }

            // this is most likely already ran, so it will be no-op
            RoslynSyntaxClassificationService.EnsureInitializationAsync(_lspClientServiceFactory, CancellationToken.None).Wait(CancellationToken.None);

            if (RoslynSyntaxClassificationService.ShouldRunExperiment(_lspClientServiceFactory, experimentService, WellKnownExperimentNames.SyntacticExp_LiveShareTagger_TextMate))
            {
                _modeCache = (int)SyntacticClassificationMode.TextMate;
            }
            else if (RoslynSyntaxClassificationService.ShouldRunExperiment(_lspClientServiceFactory, experimentService, WellKnownExperimentNames.SyntacticExp_LiveShareTagger_Remote))
            {
                _modeCache = (int)SyntacticClassificationMode.SyntaxLsp;
            }
            else
            {
                // tagger is disabled.
                _modeCache = (int)SyntacticClassificationMode.None;
            }

            return((SyntacticClassificationMode)_modeCache);
        }