public void AddLexicalClassifications(SourceText text, TextSpan textSpan, List <ClassifiedSpan> result, CancellationToken cancellationToken) { var liveshareResults = new ArrayBuilder <ClassifiedSpan>(); _liveshareSyntaxClassificationService.AddLexicalClassifications(text, textSpan, liveshareResults, cancellationToken); result.AddRange(liveshareResults); liveshareResults.Free(); }
public void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder <ClassifiedSpan> result, CancellationToken cancellationToken) { if (ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_Local)) { using (new RequestLatencyTracker(SyntacticLspLogger.RequestType.LexicalClassifications)) { _originalService.AddLexicalClassifications(text, textSpan, result, cancellationToken); } } else if (ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_Remote)) { var documentId = _remoteLanguageServiceWorkspace.GetDocumentIdInCurrentContext(text.Container); var document = _remoteLanguageServiceWorkspace.CurrentSolution.GetDocument(documentId); if (document == null) { // It is expected that the document cannot be found (e.g. source text comes from preview workspace). // These cases are already not supported in liveshare, so for now just return. return; } using (new RequestLatencyTracker(SyntacticLspLogger.RequestType.LexicalClassifications)) { _threadingContext.JoinableTaskFactory.Run(async() => { await AddRemoteClassificationsAsync(LexicalClassificationsHandler.LexicalClassificationsMethodName, document.FilePath, text, textSpan, result.Add, cancellationToken).ConfigureAwait(false); }); } } else if (ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_LiveShareTagger_Remote) || ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_LiveShareTagger_TextMate)) { // do nothing here so that existing RoslynSyntacticTagger return nothing in this mode return; } else { // Some other invalid flight. Just fallback to the regular service. Don't want to block the user based on an experimentation failure. _originalService.AddLexicalClassifications(text, textSpan, result, cancellationToken); } }
public void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder <ClassifiedSpan> result, CancellationToken cancellationToken) { if (ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_LiveShareTagger_Remote) || ShouldRunExperiment(WellKnownExperimentNames.SyntacticExp_LiveShareTagger_TextMate)) { // do nothing here so that existing RoslynSyntacticTagger return nothing in this mode return; } else { // Some other invalid flight. Just fallback to the regular service. Don't want to block the user based on an experimentation failure. _originalService.AddLexicalClassifications(text, textSpan, result, cancellationToken); } }
public void AddLexicalClassifications(SourceText text, TextSpan textSpan, ArrayBuilder <ClassifiedSpan> result, CancellationToken cancellationToken) { _originalService.AddLexicalClassifications(text, textSpan, result, cancellationToken); }