public async Task<IEnumerable<IPeekableItem>> GetPeekableItemsAsync(ISymbol symbol, Project project, IPeekResultFactory peekResultFactory, CancellationToken cancellationToken) { if (symbol == null) { throw new ArgumentNullException(nameof(symbol)); } if (project == null) { throw new ArgumentNullException(nameof(project)); } if (peekResultFactory == null) { throw new ArgumentNullException(nameof(peekResultFactory)); } var results = new List<IPeekableItem>(); var solution = project.Solution; var sourceDefinition = await SymbolFinder.FindSourceDefinitionAsync(symbol, solution, cancellationToken).ConfigureAwait(false); // And if our definition actually is from source, then let's re-figure out what project it came from if (sourceDefinition != null) { var originatingProject = solution.GetProject(sourceDefinition.ContainingAssembly, cancellationToken); project = originatingProject ?? project; } string filePath; int lineNumber; int charOffset; var symbolNavigationService = solution.Workspace.Services.GetService<ISymbolNavigationService>(); if (symbolNavigationService.WouldNavigateToSymbol(symbol, solution, out filePath, out lineNumber, out charOffset)) { var position = new LinePosition(lineNumber, charOffset); results.Add(new ExternalFilePeekableItem(new FileLinePositionSpan(filePath, position, position), PredefinedPeekRelationships.Definitions, peekResultFactory)); } else { var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false); var symbolKey = SymbolKey.Create(symbol, compilation, cancellationToken); var firstLocation = symbol.Locations.FirstOrDefault(); if (firstLocation != null) { if (firstLocation.IsInSource || _metadataAsSourceFileService.IsNavigableMetadataSymbol(symbol)) { results.Add(new DefinitionPeekableItem(solution.Workspace, project.Id, symbolKey, peekResultFactory, _metadataAsSourceFileService)); } } } return results; }
public PeekableItemSourceProvider( IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IWaitIndicator waitIndicator) { _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _waitIndicator = waitIndicator; }
public ExternalFilePeekableItem( FileLinePositionSpan span, IPeekRelationship relationship, IPeekResultFactory peekResultFactory) : base(peekResultFactory) { _span = span; _relationship = relationship; }
public PeekableItemSource( ITextBuffer textBuffer, IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IUIThreadOperationExecutor uiThreadOperationExecutor) { _textBuffer = textBuffer; _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _uiThreadOperationExecutor = uiThreadOperationExecutor; }
public DefinitionPeekableItem( Workspace workspace, ProjectId projectId, SymbolKey symbolKey, IPeekResultFactory peekResultFactory, IMetadataAsSourceFileService metadataAsSourceService) : base(peekResultFactory) { _workspace = workspace; _projectId = projectId; _symbolKey = symbolKey; _metadataAsSourceFileService = metadataAsSourceService; }
public PeekableItemSourceProvider( IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IMetadataAsSourceFileService metadataAsSourceService, IWaitIndicator waitIndicator) { _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _metadataAsSourceService = metadataAsSourceService; _waitIndicator = waitIndicator; }
public PeekableItemSourceProvider( IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IThreadingContext threadingContext, IUIThreadOperationExecutor uiThreadOperationExecutor) { _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _threadingContext = threadingContext; _uiThreadOperationExecutor = uiThreadOperationExecutor; }
public PeekableItemSource( ITextBuffer textBuffer, IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IWaitIndicator waitIndicator) { _textBuffer = textBuffer; _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _waitIndicator = waitIndicator; }
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly) { return peekResultFactory.Create( displayInfo, filePath: filePath, startLine: entityOfInterestSpan.Start.Line, startIndex: entityOfInterestSpan.Start.Character, endLine: entityOfInterestSpan.End.Line, endIndex: entityOfInterestSpan.End.Character, idLine: identifierLocation.Start.Line, idIndex: identifierLocation.Start.Character, isReadOnly: isReadOnly); }
public PeekableItemSource( ITextBuffer textBuffer, IPeekableItemFactory peekableItemFactory, IPeekResultFactory peekResultFactory, IMetadataAsSourceFileService metadataAsSourceService, IWaitIndicator waitIndicator) { _textBuffer = textBuffer; _peekableItemFactory = peekableItemFactory; _peekResultFactory = peekResultFactory; _metadataAsSourceService = metadataAsSourceService; _waitIndicator = waitIndicator; }
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, IPeekResultFactory peekResultFactory) { var fileName = Path.GetFileName(filePath); var label = string.Format("{0} - ({1}, {2})", fileName, identifierLocation.Start.Line + 1, identifierLocation.Start.Character + 1); var displayInfo = new PeekResultDisplayInfo(label: label, labelTooltip: filePath, title: fileName, titleTooltip: filePath); return CreateDocumentPeekResult( filePath, identifierLocation, entityOfInterestSpan, displayInfo, peekResultFactory, isReadOnly: false); }
private async Task <IPeekableItem> GetPeekableItemAsync(IPeekResultFactory peekResultFactory, ITextBuffer buffer, SnapshotPoint pt) { var entry = buffer.TryGetAnalysisEntry(); if (entry == null) { return(null); } var result = await NavigableSymbolSource.GetDefinitionLocationsAsync(entry, pt).ConfigureAwait(false); if (result.Length > 0) { return(new PythonPeekableItem(peekResultFactory, result)); } return(null); }
public async Task <IEnumerable <IPeekableItem> > GetPeekableItemsAsync( ISymbol symbol, Project project, IPeekResultFactory peekResultFactory, CancellationToken cancellationToken) { if (symbol == null) { throw new ArgumentNullException(nameof(symbol)); } if (project == null) { throw new ArgumentNullException(nameof(project)); } if (peekResultFactory == null) { throw new ArgumentNullException(nameof(peekResultFactory)); } var results = new List <IPeekableItem>(); var solution = project.Solution; var sourceDefinition = await SymbolFinder.FindSourceDefinitionAsync(symbol, solution, cancellationToken).ConfigureAwait(false); // And if our definition actually is from source, then let's re-figure out what project it came from if (sourceDefinition != null) { var originatingProject = solution.GetProject(sourceDefinition.ContainingAssembly, cancellationToken); project = originatingProject ?? project; } var symbolNavigationService = solution.Workspace.Services.GetService <ISymbolNavigationService>(); var definitionItem = symbol.ToNonClassifiedDefinitionItem(project, includeHiddenLocations: true); if (symbolNavigationService.WouldNavigateToSymbol( definitionItem, solution, cancellationToken, out var filePath, out var lineNumber, out var charOffset)) { var position = new LinePosition(lineNumber, charOffset); results.Add(new ExternalFilePeekableItem(new FileLinePositionSpan(filePath, position, position), PredefinedPeekRelationships.Definitions, peekResultFactory)); }
internal static IDocumentPeekResult CreateDocumentPeekResult( string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, PeekResultDisplayInfo displayInfo, IPeekResultFactory peekResultFactory, bool isReadOnly ) { return(peekResultFactory.Create( displayInfo, filePath: filePath, startLine: entityOfInterestSpan.Start.Line, startIndex: entityOfInterestSpan.Start.Character, endLine: entityOfInterestSpan.End.Line, endIndex: entityOfInterestSpan.End.Character, idLine: identifierLocation.Start.Line, idIndex: identifierLocation.Start.Character, isReadOnly: isReadOnly )); }
private static IEnumerable <IPeekableItem> GetPeekableItemsForNavigableItems( IEnumerable <INavigableItem>?navigableItems, Project project, IPeekResultFactory peekResultFactory, CancellationToken cancellationToken ) { if (navigableItems != null) { var workspace = project.Solution.Workspace; var navigationService = workspace.Services.GetRequiredService <IDocumentNavigationService>(); foreach (var item in navigableItems) { var document = item.Document; if ( navigationService.CanNavigateToPosition( workspace, document.Id, item.SourceSpan.Start, cancellationToken ) ) { var text = document.GetTextSynchronously(cancellationToken); var linePositionSpan = text.Lines.GetLinePositionSpan(item.SourceSpan); if (document.FilePath != null) { yield return(new ExternalFilePeekableItem( new FileLinePositionSpan(document.FilePath, linePositionSpan), PredefinedPeekRelationships.Definitions, peekResultFactory )); } } } } }
public InternalFunctionPeekItem(string sourceFileName, Span sourceSpan, string functionName, IPeekResultFactory peekResultFactory, ICoreShell shell) : base(functionName, peekResultFactory, shell) { // Create source right away so it can start asynchronous function fetching // so by the time GetOrCreateResultSource is called the task may be already underway. _source = new InternalFunctionPeekResultSource(sourceFileName, sourceSpan, functionName, this, shell); }
public XSharpDefinitionPeekItem(XSharpModel.XElement gotoElement, IPeekResultFactory peekResultFactory) { _gotoElement = gotoElement; _peekResultFactory = peekResultFactory; }
public PeekableItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory, IServiceContainer services) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; _services = services; }
public PeekableItemSource(ITextBuffer buffer, IPeekResultFactory peekResultFactory) { this.buffer = buffer; this.peekResultFactory = peekResultFactory; }
public IdDefinitionPeekItem(string id, IPeekResultFactory peekResultFactory, ITextBuffer textbuffer) { _id = id; _peekResultFactory = peekResultFactory; _textbuffer = textbuffer; }
internal static IDocumentPeekResult CreateDocumentPeekResult(string filePath, LinePositionSpan identifierLocation, LinePositionSpan entityOfInterestSpan, IPeekResultFactory peekResultFactory) { var fileName = Path.GetFileName(filePath); var label = string.Format("{0} - ({1}, {2})", fileName, identifierLocation.Start.Line + 1, identifierLocation.Start.Character + 1); var displayInfo = new PeekResultDisplayInfo(label: label, labelTooltip: filePath, title: fileName, titleTooltip: filePath); return(CreateDocumentPeekResult( filePath, identifierLocation, entityOfInterestSpan, displayInfo, peekResultFactory, isReadOnly: false)); }
public PeekableItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; }
public ClassPeekItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; }
public XSharpDefinitionPeekItem(XSourceSymbol gotoElement, IPeekResultFactory peekResultFactory) { _gotoElement = gotoElement; _peekResultFactory = peekResultFactory; }
public PeekableItemSourceProvider(IPeekResultFactory peekResultFactory, ICoreShell shell) { _peekResultFactory = peekResultFactory; _shell = shell; }
private static IEnumerable<IPeekableItem> GetPeekableItemsForNavigableItems( IEnumerable<INavigableItem> navigableItems, Project project, IPeekResultFactory peekResultFactory, CancellationToken cancellationToken) { if (navigableItems != null) { var workspace = project.Solution.Workspace; var navigationService = workspace.Services.GetService<IDocumentNavigationService>(); foreach (var item in navigableItems) { var document = item.Document; if (navigationService.CanNavigateToPosition(workspace, document.Id, item.SourceSpan.Start)) { var text = document.GetTextAsync(cancellationToken).WaitAndGetResult(cancellationToken); var linePositionSpan = text.Lines.GetLinePositionSpan(item.SourceSpan); yield return new ExternalFilePeekableItem( new FileLinePositionSpan(document.FilePath, linePositionSpan), PredefinedPeekRelationships.Definitions, peekResultFactory); } } } }
protected PeekableItem(IPeekResultFactory peekResultFactory) { this.PeekResultFactory = peekResultFactory; }
public UserDefinedPeekItem(string fileName, IAstNode definitionNode, string name, IPeekResultFactory peekResultFactory, ICoreShell shell) : base(name, peekResultFactory, shell) { DefinitionNode = definitionNode; FileName = fileName; }
public ClassDefinitionPeekItem(string className, IPeekResultFactory peekResultFactory, ITextBuffer textbuffer) { _className = className; _peekResultFactory = peekResultFactory; _textbuffer = textbuffer; }
public async Task <IEnumerable <IPeekableItem> > GetPeekableItemsAsync(ISymbol symbol, Project project, IPeekResultFactory peekResultFactory, CancellationToken cancellationToken) { if (symbol == null) { throw new ArgumentNullException(nameof(symbol)); } if (project == null) { throw new ArgumentNullException(nameof(project)); } if (peekResultFactory == null) { throw new ArgumentNullException(nameof(peekResultFactory)); } var results = new List <IPeekableItem>(); var solution = project.Solution; var sourceDefinition = await SymbolFinder.FindSourceDefinitionAsync(symbol, solution, cancellationToken).ConfigureAwait(false); // And if our definition actually is from source, then let's re-figure out what project it came from if (sourceDefinition != null) { var originatingProject = solution.GetProject(sourceDefinition.ContainingAssembly, cancellationToken); project = originatingProject ?? project; } string filePath; int lineNumber; int charOffset; var symbolNavigationService = solution.Workspace.Services.GetService <ISymbolNavigationService>(); if (symbolNavigationService.WouldNavigateToSymbol(symbol, solution, out filePath, out lineNumber, out charOffset)) { var position = new LinePosition(lineNumber, charOffset); results.Add(new ExternalFilePeekableItem(new FileLinePositionSpan(filePath, position, position), PredefinedPeekRelationships.Definitions, peekResultFactory)); } else { var symbolKey = SymbolKey.Create(symbol, cancellationToken); var firstLocation = symbol.Locations.FirstOrDefault(); if (firstLocation != null) { if (firstLocation.IsInSource || _metadataAsSourceFileService.IsNavigableMetadataSymbol(symbol)) { results.Add(new DefinitionPeekableItem(solution.Workspace, project.Id, symbolKey, peekResultFactory, _metadataAsSourceFileService)); } } } return(results); }
public PeekableItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory, ICoreShell shell) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; _shell = shell; }
public XSharpPeekItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory, XFile file) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; _file = file; }
public PeekItemBase(string name, IPeekResultFactory peekResultFactory, ICoreShell shell) { PeekResultFactory = peekResultFactory; Shell = shell; DisplayName = name; }
public PythonPeekResultSource(IPeekResultFactory peekResultFactory, IAnalysisVariable[] variables) { _peekResultFactory = peekResultFactory ?? throw new ArgumentNullException(nameof(peekResultFactory)); _variables = variables ?? throw new ArgumentNullException(nameof(variables)); }
public PeekResultSource(IPeekResultFactory peekResultFactory, INavigationToken navigationToken) { _peekResultFactory = peekResultFactory; _token = navigationToken; }
public XSharpPeekItemSource(ITextBuffer textBuffer, IPeekResultFactory peekResultFactory) { _textBuffer = textBuffer; _peekResultFactory = peekResultFactory; _file = textBuffer.GetFile(); }
public MyPeekItem(IPeekResultFactory peekResultFactory) { this.peekResultFactory = peekResultFactory; }
public PythonPeekResultSource(IPeekResultFactory peekResultFactory, AnalysisLocation[] locations) { _peekResultFactory = peekResultFactory ?? throw new ArgumentNullException(nameof(peekResultFactory)); _locations = locations ?? throw new ArgumentNullException(nameof(locations)); }