public ScriptManager(ICompletionService completionService, IScriptWorkspace scriptWorkspace) { _completionService = completionService; _scriptWorkspace = scriptWorkspace; _compilationOptions = new CompilationOptions(OutputKind.DynamicallyLinkedLibrary); _parseOptions = new ParseOptions(CompatibilityMode.None, LanguageVersion.CSharp6, true, SourceCodeKind.Script); var metadataFileProvider = _scriptWorkspace.CurrentSolution.MetadataFileProvider; _references = AssemblyTypes.Select(type => GetReference(metadataFileProvider, type)); }
public DescriptionModifyingCompletionItem(CompletionItem completionItem, ICompletionService completionService, Workspace workspace) : base(default(CompletionListProvider), completionItem.DisplayText, completionItem.FilterSpan, descriptionFactory: null, glyph: completionItem.Glyph, sortText: completionItem.SortText, filterText: completionItem.FilterText, preselect: completionItem.Preselect, isBuilder: completionItem.IsBuilder, showsWarningIcon: completionItem.ShowsWarningIcon, shouldFormatOnCommit: completionItem.ShouldFormatOnCommit) { this.CompletionItem = completionItem; _completionService = completionService; _workspace = workspace; }
public void ComputeModel( ICompletionService completionService, CompletionTriggerInfo triggerInfo, IEnumerable<ICompletionProvider> completionProviders, bool isDebugger) { AssertIsForeground(); // If we've already computed a model then we can just ignore this request and not // generate any tasks. if (this.Computation.InitialUnfilteredModel != null) { return; } new ModelComputer(this, completionService, triggerInfo, completionProviders, isDebugger).Do(); }
public ModelComputer( Session session, ICompletionService completionService, CompletionTriggerInfo triggerInfo, IEnumerable<ICompletionProvider> completionProviders, bool isDebugger) { _session = session; _completionService = completionService; _options = session.Controller.SubjectBuffer.TryGetOptions(); _triggerInfo = triggerInfo; _subjectBufferCaretPosition = session.Controller.TextView.GetCaretPoint(session.Controller.SubjectBuffer).Value; _completionProviders = completionProviders; _text = _subjectBufferCaretPosition.Snapshot.AsText(); _includeBuilder = session.Controller.SubjectBuffer.GetOption(Options.EditorCompletionOptions.UseSuggestionMode); _disconnectedBufferGraph = new DisconnectedBufferGraph(session.Controller.SubjectBuffer, session.Controller.TextView.TextBuffer); }
public ModelComputer( Session session, ICompletionService completionService, CompletionTriggerInfo triggerInfo, IEnumerable <ICompletionProvider> completionProviders, bool isDebugger) { _session = session; _completionService = completionService; _options = session.Controller.SubjectBuffer.TryGetOptions(); _triggerInfo = triggerInfo; _subjectBufferCaretPosition = session.Controller.TextView.GetCaretPoint(session.Controller.SubjectBuffer).Value; _completionProviders = completionProviders; _text = _subjectBufferCaretPosition.Snapshot.AsText(); _includeBuilder = session.Controller.SubjectBuffer.GetOption(Options.EditorCompletionOptions.UseSuggestionMode); _disconnectedBufferGraph = new DisconnectedBufferGraph(session.Controller.SubjectBuffer, session.Controller.TextView.TextBuffer); }
private bool StartNewModelComputation(ICompletionService completionService, CompletionTriggerInfo triggerInfo, bool filterItems, bool dismissIfEmptyAllowed = true) { AssertIsForeground(); Contract.ThrowIfTrue(sessionOpt != null); if (this.TextView.Selection.Mode == TextSelectionMode.Box) { // No completion with multiple selection return(false); } if (this.TextView.Caret.Position.VirtualBufferPosition.IsInVirtualSpace) { // Convert any virtual whitespace to real whitespace by doing an empty edit at the caret position. _editorOperationsFactoryService.GetEditorOperations(TextView).InsertText(""); } var computation = new ModelComputation <Model>(this, PrioritizedTaskScheduler.AboveNormalInstance); this.sessionOpt = new Session(this, computation, GetCompletionRules(), Presenter.CreateSession(TextView, SubjectBuffer, null)); var completionProviders = triggerInfo.TriggerReason == CompletionTriggerReason.Snippets ? GetSnippetCompletionProviders() : GetCompletionProviders(); sessionOpt.ComputeModel(completionService, triggerInfo, completionProviders, _isDebugger); var filterReason = triggerInfo.TriggerReason == CompletionTriggerReason.BackspaceOrDeleteCommand ? CompletionFilterReason.BackspaceOrDelete : CompletionFilterReason.TypeChar; if (filterItems) { sessionOpt.FilterModel(filterReason, dismissIfEmptyAllowed: dismissIfEmptyAllowed); } else { sessionOpt.IdentifyBestMatchAndFilterToAllItems(filterReason, dismissIfEmptyAllowed: dismissIfEmptyAllowed); } return(true); }
private bool StartNewModelComputation(ICompletionService completionService, bool filterItems, bool dismissIfEmptyAllowed = true) { return(StartNewModelComputation( completionService, CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo().WithIsDebugger(_isDebugger).WithIsImmediateWindow(_isImmediateWindow), filterItems, dismissIfEmptyAllowed)); }
private async Task <CompletionList> GetCompletionListAsync(ICompletionService completionService, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { return(_documentOpt != null ? await completionService.GetCompletionListAsync(_documentOpt, _subjectBufferCaretPosition, triggerInfo, _options, _completionProviders, cancellationToken).ConfigureAwait(false) : null); }
public AcknowledgementController(IBus bus, ICompletionService completionService) { this.bus = bus; this.completionService = completionService; }
private async Task <IEnumerable <CompletionItemGroup> > GetGroupsAsync(ICompletionService completionService, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { if (_documentOpt == null && completionService is ITextCompletionService) { var textCompletionService = (ITextCompletionService)completionService; return(await textCompletionService.GetGroupsAsync(_text, _subjectBufferCaretPosition, triggerInfo, _completionProviders, _options, cancellationToken).ConfigureAwait(false)); } else if (_documentOpt != null) { return(await completionService.GetGroupsAsync(_documentOpt, _subjectBufferCaretPosition, triggerInfo, _completionProviders, cancellationToken).ConfigureAwait(false)); } else { return(null); } }
public WordSpudEngine(ICompletionService completionService, ILogger logger, WordSpudClient client) : base(completionService, logger, client) { JackboxClient.OnSelfUpdate += OnSelfUpdate; JackboxClient.OnRoomUpdate += OnRoomUpdate; JackboxClient.Connect(); }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, ImmutableArray <CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); // Get the set of actual filters used by all the completion items // that are in the list. var actualFiltersSeen = new HashSet <CompletionItemFilter>(); foreach (var item in totalItems) { foreach (var filter in item.Filters) { actualFiltersSeen.Add(filter); } } // The set of filters we'll want to show the user are the filters that are actually // used by our completion items. i.e. there's no reason to show the "field" filter // if none of completion items is actually a field. var actualItemFilters = CompletionItemFilter.AllFilters.Where(actualFiltersSeen.Contains) .ToImmutableArray(); // By default we do not filter anything out. ImmutableDictionary <CompletionItemFilter, bool> filterState = null; if (completionService != null && workspace != null && workspace.Kind != WorkspaceKind.Interactive && // TODO (https://github.com/dotnet/roslyn/issues/5107): support in interactive workspace.Options.GetOption(InternalFeatureOnOffOptions.Snippets) && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DescriptionModifyingCompletionItem which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shortcuts. var updatedTotalItemsBuilder = ImmutableArray.CreateBuilder <CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItemsBuilder.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedTotalItems = updatedTotalItemsBuilder.AsImmutable(); updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } var completionItemToFilterText = new Dictionary <CompletionItem, string>(); return(new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, actualItemFilters, filterState, completionItemToFilterText, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty)); }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, IList <CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); if (completionService != null && workspace != null && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DisplayCompletionItems which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shorcuts. updatedTotalItems = new List <CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItems.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } return(new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty)); }
private async Task<IEnumerable<CompletionItemGroup>> GetGroupsAsync(ICompletionService completionService, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { if (_documentOpt == null && completionService is ITextCompletionService) { var textCompletionService = (ITextCompletionService)completionService; return await textCompletionService.GetGroupsAsync(_text, _subjectBufferCaretPosition, triggerInfo, _completionProviders, _options, cancellationToken).ConfigureAwait(false); } else if (_documentOpt != null) { return await completionService.GetGroupsAsync(_documentOpt, _subjectBufferCaretPosition, triggerInfo, _completionProviders, cancellationToken).ConfigureAwait(false); } else { return null; } }
public OrderService(IOrderRepository orderRepository, IOrderLineRepository orderLineRepository, IClientRepository clientRepository, IAddressRepository addressRepository, ICurrencyRepository currencyRepository, IUnitOfWork unitOfWork, IConfigurationService configurationService, ICompletionService completionService, IProductRepository productRepository) { _orderRepository = orderRepository; _orderLineRepository = orderLineRepository; _clientRepository = clientRepository; _unitOfWork = unitOfWork; _currencyRepository = currencyRepository; _configurationService = configurationService; _completionService = completionService; _productRepository = productRepository; }
protected BaseJackboxEngine(ICompletionService completionService, ILogger logger, TClient client) { CompletionService = completionService; JackboxClient = client; _logger = logger; }
private async Task<CompletionList> GetCompletionListAsync(ICompletionService completionService, CompletionTriggerInfo triggerInfo, CancellationToken cancellationToken) { return _documentOpt != null ? await completionService.GetCompletionListAsync(_documentOpt, _subjectBufferCaretPosition, triggerInfo, _options, _completionProviders, cancellationToken).ConfigureAwait(false) : null; }
public CompletionMessageHandler(ICompletionService completionService) { this.completionService = completionService; }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, ImmutableArray<CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); if (completionService != null && workspace != null && workspace.Kind != WorkspaceKind.Interactive && // TODO (https://github.com/dotnet/roslyn/issues/5107): support in interactive workspace.Options.GetOption(InternalFeatureOnOffOptions.Snippets) && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DescriptionModifyingCompletionItem which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shortcuts. var updatedTotalItemsBuilder = ImmutableArray.CreateBuilder<CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItemsBuilder.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedTotalItems = updatedTotalItemsBuilder.AsImmutable(); updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } return new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty); }
private bool StartNewModelComputation(ICompletionService completionService, bool filterItems, bool dismissIfEmptyAllowed = true) { return(StartNewModelComputation( completionService, CompletionTriggerInfo.CreateInvokeCompletionTriggerInfo(), filterItems, dismissIfEmptyAllowed)); }
internal ExecutionHelper(TaskScheduler executor) { this.service = new TaskSchedulerCompletionService <T>(executor); }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, ImmutableArray <CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); if (completionService != null && workspace != null && workspace.Kind != WorkspaceKind.Interactive && // TODO (https://github.com/dotnet/roslyn/issues/5107): support in interactive workspace.Options.GetOption(InternalFeatureOnOffOptions.Snippets) && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DescriptionModifyingCompletionItem which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shortcuts. var updatedTotalItemsBuilder = ImmutableArray.CreateBuilder <CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItemsBuilder.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedTotalItems = updatedTotalItemsBuilder.AsImmutable(); updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } return(new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty)); }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, IList<CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); if (completionService != null && workspace != null && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DisplayCompletionItems which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shorcuts. updatedTotalItems = new List<CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItems.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } return new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty); }
public static Model CreateModel( DisconnectedBufferGraph disconnectedBufferGraph, TextSpan defaultTrackingSpanInSubjectBuffer, ImmutableArray<CompletionItem> totalItems, CompletionItem selectedItem, bool isHardSelection, bool isUnique, bool useSuggestionCompletionMode, CompletionItem builder, CompletionTriggerInfo triggerInfo, ICompletionService completionService, Workspace workspace) { var updatedTotalItems = totalItems; CompletionItem updatedSelectedItem = selectedItem; CompletionItem updatedBuilder = builder; CompletionItem updatedDefaultBuilder = GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer); // Get the set of actual filters used by all the completion items // that are in the list. var actualFiltersSeen = new HashSet<CompletionItemFilter>(); foreach (var item in totalItems) { foreach (var filter in item.Filters) { actualFiltersSeen.Add(filter); } } // The set of filters we'll want to show the user are the filters that are actually // used by our completion items. i.e. there's no reason to show the "field" filter // if none of completion items is actually a field. var actualItemFilters = CompletionItemFilter.AllFilters.Where(actualFiltersSeen.Contains) .ToImmutableArray(); // By default we do not filter anything out. ImmutableDictionary<CompletionItemFilter, bool> filterState = null; if (completionService != null && workspace != null && workspace.Kind != WorkspaceKind.Interactive && // TODO (https://github.com/dotnet/roslyn/issues/5107): support in interactive workspace.Options.GetOption(InternalFeatureOnOffOptions.Snippets) && triggerInfo.TriggerReason != CompletionTriggerReason.Snippets) { // In order to add snippet expansion notes to completion item descriptions, update // all of the provided CompletionItems to DescriptionModifyingCompletionItem which will proxy // requests to the original completion items and add the snippet expansion note to // the description if necessary. We won't do this if the list was triggered to show // snippet shortcuts. var updatedTotalItemsBuilder = ImmutableArray.CreateBuilder<CompletionItem>(); updatedSelectedItem = null; foreach (var item in totalItems) { var updatedItem = new DescriptionModifyingCompletionItem(item, completionService, workspace); updatedTotalItemsBuilder.Add(updatedItem); if (item == selectedItem) { updatedSelectedItem = updatedItem; } } updatedTotalItems = updatedTotalItemsBuilder.AsImmutable(); updatedBuilder = null; if (builder != null) { updatedBuilder = new DescriptionModifyingCompletionItem(builder, completionService, workspace); } updatedDefaultBuilder = new DescriptionModifyingCompletionItem( GetDefaultBuilder(defaultTrackingSpanInSubjectBuffer), completionService, workspace); } var completionItemToFilterText= new Dictionary<CompletionItem, string>(); return new Model( disconnectedBufferGraph, updatedTotalItems, updatedTotalItems, updatedSelectedItem, actualItemFilters, filterState, completionItemToFilterText, isHardSelection, isUnique, useSuggestionCompletionMode, updatedBuilder, updatedDefaultBuilder, triggerInfo, GetDefaultTrackingSpanEnd(defaultTrackingSpanInSubjectBuffer, disconnectedBufferGraph), completionService.DismissIfEmpty); }