public CallHierarchyProvider( [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners, IGlyphService glyphService) { _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.CallHierarchy); this.GlyphService = glyphService; }
public override CompletionSet GetCompletions(IGlyphService glyphService) { if (_noCompletions) { return null; } if (_importKeywordOnly) { var completion = new[] { JCompletion(glyphService, "import", null, StandardGlyphGroup.GlyphKeyword) }; return new FuzzyCompletionSet("JImportKeyword", "J", Span, completion, _options, CompletionComparer.UnderscoresLast); } var start = _stopwatch.ElapsedMilliseconds; var completions = GetModules(_namespace, _modulesOnly).Select(m => JCompletion(glyphService, m)); if (_includeStar) { var completion = new[] { JCompletion(glyphService, "*", "Import all members from the module", StandardGlyphGroup.GlyphArrow) }; completions = completions.Concat(completion); } var res = new FuzzyCompletionSet("JFromImports", "J", Span, completions, _options, CompletionComparer.UnderscoresLast); var end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ end - start > TooMuchTime) { Trace.WriteLine(String.Format("{0} lookup time {1} for {2} imports", this, end - start, res.Completions.Count)); } return res; }
/// <summary> /// Constructor used by IPy declarations retrieved from the IPy engine /// </summary> internal PyCompletion(Declaration declaration, IGlyphService glyphService) : base(declaration.Title) { this.InsertionText = declaration.Title; this.Description = declaration.Description; this.IconSource = glyphService.GetGlyph(GetGroupFromDeclaration(declaration), GetScopeFromDeclaration(declaration)); }
/// <summary> /// Default ctor /// </summary> protected XmlResourceCompletionSource(ITextBuffer textBuffer, SVsServiceProvider serviceProvider, IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService, IGlyphService glyphService) { this.textBuffer = textBuffer; this.serviceProvider = serviceProvider; this.vsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService; this.glyphService = glyphService; }
public SymbolGlyphDeferredContent(Glyph glyph, IGlyphService glyphService) { Contract.ThrowIfNull(glyphService); _glyph = glyph; _glyphService = glyphService; }
public RegistryCompletionSource(ITextBuffer buffer, IGlyphService glyphService) { _buffer = buffer; _versionGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphKeyword, StandardGlyphItem.GlyphItemPublic); _keyGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphClosedFolder, StandardGlyphItem.GlyphItemPublic); _dataTypeGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupStruct, StandardGlyphItem.GlyphItemPublic); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var start = _stopwatch.ElapsedMilliseconds; var analysis = GetAnalysisEntry(); if (analysis == null) { return null; } var index = VsProjectAnalyzer.TranslateIndex( Span.GetEndPoint(TextBuffer.CurrentSnapshot).Position, TextBuffer.CurrentSnapshot, analysis ); var completions = analysis.GetAllAvailableMembers(index, GetMemberOptions.None) .Where(IsExceptionType) .Select(member => PythonCompletion(glyphService, member)) .OrderBy(completion => completion.DisplayText); var res = new FuzzyCompletionSet("PythonExceptions", "Python", Span, completions, _options, CompletionComparer.UnderscoresLast); var end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ end - start > TooMuchTime) { Trace.WriteLine(String.Format("{0} lookup time {1} for {2} classes", this, end - start, res.Completions.Count)); } return res; }
internal static DynamicallyVisibleCompletion PythonCompletion(IGlyphService service, MemberResult memberResult) { return new DynamicallyVisibleCompletion(memberResult.Name, memberResult.Completion, () => memberResult.Documentation, () => service.GetGlyph(memberResult.MemberType.ToGlyphGroup(), StandardGlyphItem.GlyphItemPublic), Enum.GetName(typeof(PythonMemberType), memberResult.MemberType) ); }
internal static DynamicallyVisibleCompletion JsCompletion(IGlyphService service, MemberResult memberResult, bool quote) { return new DynamicallyVisibleCompletion(memberResult.Name, GetInsertionQuote(quote, memberResult.Completion), memberResult.Documentation, service.GetGlyph(GetGlyphGroup(memberResult), StandardGlyphItem.GlyphItemPublic), String.Empty ); }
public CSharpGraphProvider( IGlyphService glyphService, SVsServiceProvider serviceProvider, IProgressionPrimaryWorkspaceProvider workspaceProvider, [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners) : base(glyphService, serviceProvider, workspaceProvider.PrimaryWorkspace, asyncListeners) { }
public CmdCompletionSource(ITextBuffer buffer, IClassifierAggregatorService classifier, IGlyphService glyphService, ITextStructureNavigator textStructureNavigator) { _buffer = buffer; _classifier = classifier.GetClassifier(buffer); _keywordGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic); _environmentGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphAssembly, StandardGlyphItem.GlyphItemPublic); _labelGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphArrow, StandardGlyphItem.GlyphItemPublic); _textStructureNavigator = textStructureNavigator; }
/// <summary> /// Constructor used by IPy snippets retrieved from the expansion manager /// </summary> internal PyCompletion(VsExpansion vsExpansion, IGlyphService glyphService) : base(vsExpansion.title) { this.InsertionText = vsExpansion.title; this.Description = vsExpansion.description; this.IconSource = glyphService.GetGlyph(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic); this.VsExpansion = vsExpansion; }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var text = PrecedingExpression; var completions = GetModules().Select(m => JsCompletion(glyphService, m, _quote)); var res = new FuzzyCompletionSet(CompletionSource.NodejsRequireCompletionSetMoniker, "Node.js", Span, completions, CompletionComparer.UnderscoresFirst, true); return res; }
public PkgdefCompletionSource(ITextBuffer buffer, IClassifierAggregatorService classifier, ITextStructureNavigatorSelectorService navigator, IGlyphService glyphService) { _buffer = buffer; _classifier = classifier.GetClassifier(buffer); _navigator = navigator; _glyphService = glyphService; _defaultGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupField, StandardGlyphItem.GlyphItemPublic); _snippetGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphCSharpExpansion, StandardGlyphItem.GlyphItemPublic); }
internal SpringCompletion(IGlyphService glyphService, string shortcut, string title, string description, SpringCompletionType type) : base(title) { this.DisplayText = shortcut; this.InsertionText = title; this.Description = description; this.IconSource = this.GetIconSource(glyphService, type); this.Type = type; }
internal SpringCompletion(IGlyphService glyphService, VsExpansion vsExpansion) : base(vsExpansion.title) { this.DisplayText = vsExpansion.shortcut; this.InsertionText = vsExpansion.title; this.Description = vsExpansion.description; this.IconSource = this.GetIconSource(glyphService, SpringCompletionType.Snippet); this.VsExpansion = vsExpansion; }
public AbstractSemanticQuickInfoProvider( IProjectionBufferFactoryService projectionBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ITextEditorFactoryService textEditorFactoryService, IGlyphService glyphService, ClassificationTypeMap typeMap) : base(projectionBufferFactoryService, editorOptionsFactoryService, textEditorFactoryService, glyphService, typeMap) { }
public VsctCompletionSource(ITextBuffer buffer, IClassifierAggregatorService classifier, ITextStructureNavigatorSelectorService navigator, IGlyphService glyphService) { _buffer = buffer; _classifier = classifier.GetClassifier(buffer); _navigator = navigator; _glyphService = glyphService; _defaultGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupField, StandardGlyphItem.GlyphItemPublic); _builtInGlyph = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupProperty, StandardGlyphItem.TotalGlyphItems); _imageService = ExtensibilityToolsPackage.GetGlobalService(typeof(SVsImageService)) as IVsImageService2; }
private AlloyEditorNavigationSourceWalker(ITreeNodeStream input, ITextSnapshot snapshot, ReadOnlyCollection<IToken> tokens, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService, IGlyphService glyphService, IOutputWindowService outputWindowService) : base(input, snapshot, outputWindowService) { Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService"); Contract.Requires<ArgumentNullException>(glyphService != null, "glyphService"); _tokens = tokens; _editorNavigationTypeRegistryService = editorNavigationTypeRegistryService; _glyphService = glyphService; }
internal SpringCompletionSource(ITextBuffer textBuffer, IGlyphService glyphService, IVsEditorAdaptersFactoryService vsEditorAdaptersFactoryService, ITextStructureNavigatorSelectorService textStructureNavigatorSelectorService, System.IServiceProvider serviceProvider) { this.textBuffer = textBuffer; this.glyphService = glyphService; this.vsEditorAdaptersFactoryService = vsEditorAdaptersFactoryService; this.textStructureNavigatorSelectorService = textStructureNavigatorSelectorService; this.serviceProvider = serviceProvider; }
internal static DynamicallyVisibleCompletion PythonCompletion(IGlyphService service, string name, string tooltip, StandardGlyphGroup group) { var icon = new IconDescription(group, StandardGlyphItem.GlyphItemPublic); var result = new DynamicallyVisibleCompletion(name, name, tooltip, service.GetGlyph(group, StandardGlyphItem.GlyphItemPublic), Enum.GetName(typeof(StandardGlyphGroup), group)); result.Properties.AddProperty(typeof(IconDescription), icon); return result; }
public SemanticQuickInfoProvider( ITextBufferFactoryService textBufferFactoryService, IContentTypeRegistryService contentTypeRegistryService, IProjectionBufferFactoryService projectionBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ITextEditorFactoryService textEditorFactoryService, IGlyphService glyphService, ClassificationTypeMap typeMap) : base(textBufferFactoryService, contentTypeRegistryService, projectionBufferFactoryService, editorOptionsFactoryService, textEditorFactoryService, glyphService, typeMap) { }
protected AbstractQuickInfoProvider( IProjectionBufferFactoryService projectionBufferFactoryService, IEditorOptionsFactoryService editorOptionsFactoryService, ITextEditorFactoryService textEditorFactoryService, IGlyphService glyphService, ClassificationTypeMap typeMap) { _projectionBufferFactoryService = projectionBufferFactoryService; _editorOptionsFactoryService = editorOptionsFactoryService; _textEditorFactoryService = textEditorFactoryService; _glyphService = glyphService; _typeMap = typeMap; }
public NavigateToItemProvider( Workspace workspace, IGlyphService glyphService, IAsynchronousOperationListener asyncListener) { Contract.ThrowIfNull(workspace); Contract.ThrowIfNull(glyphService); Contract.ThrowIfNull(asyncListener); _workspace = workspace; _asyncListener = asyncListener; _displayFactory = new ItemDisplayFactory(new NavigateToIconFactory(glyphService)); }
public RegistryQuickInfoSource( ITextBuffer buffer, IGlyphService glyphService, IClassificationFormatMapService classificationFormatMapService, IClassificationTypeRegistryService classificationRegistry ) { _buffer = buffer; _glyphService = glyphService; _classificationFormatMapService = classificationFormatMapService; _classificationRegistry = classificationRegistry; }
public FileCompletionProviderTest(REditorMefCatalogFixture catalog) { _catalog = catalog; _exportProvider = _catalog.CreateExportProvider(); _imagesProvider = Substitute.For<IImagesProvider>(); _glyphService = Substitute.For<IGlyphService>(); var myDocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); _testFolder = Path.Combine(myDocs, _testFolderName); if (!Directory.Exists(_testFolder)) { Directory.CreateDirectory(_testFolder); } }
public CompletionPresenterSession( ICompletionBroker completionBroker, IGlyphService glyphService, ITextView textView, ITextBuffer subjectBuffer) { _completionBroker = completionBroker; this.GlyphService = glyphService; _textView = textView; _subjectBuffer = subjectBuffer; _completionSet = new CompletionSet2(this, textView, subjectBuffer); _completionSet.SelectionStatusChanged += OnCompletionSetSelectionStatusChanged; }
public PackageFunctionCompletionProvider( ILoadedPackagesProvider loadedPackagesProvider, [Import(AllowDefault = true)] ISnippetInformationSourceProvider snippetInformationSource, IPackageIndex packageIndex, IFunctionIndex functionIndex, IGlyphService glyphService) { _loadedPackagesProvider = loadedPackagesProvider; _snippetInformationSource = snippetInformationSource; _packageIndex = packageIndex; _functionIndex = functionIndex; _functionGlyph = glyphService.GetGlyphThreadSafe(StandardGlyphGroup.GlyphGroupMethod, StandardGlyphItem.GlyphItemPublic); _constantGlyph = glyphService.GetGlyphThreadSafe(StandardGlyphGroup.GlyphGroupConstant, StandardGlyphItem.GlyphItemPublic); }
public NavigateToItemProviderFactory( IGlyphService glyphService, [ImportMany] IEnumerable<Lazy<INavigateToHostVersionService, VisualStudioVersionMetadata>> hostServices, [ImportMany] IEnumerable<Lazy<IAsynchronousOperationListener, FeatureMetadata>> asyncListeners) { if (asyncListeners == null) { throw new ArgumentNullException(nameof(asyncListeners)); } _glyphService = glyphService ?? throw new ArgumentNullException(nameof(glyphService)); _hostServices = hostServices; _asyncListener = new AggregateAsynchronousOperationListener(asyncListeners, FeatureAttribute.NavigateTo); }
protected override void Initialize() { base.Initialize(); IComponentModel model = (IComponentModel)this.GetService(typeof(SComponentModel)); _glyphService = model.GetService<IGlyphService>(); _imageService = GetService(typeof(SVsImageService)) as IVsImageService2; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; CommandID cmdGlyphId = new CommandID(GuidList.guidGlyphExporterCmdSet, (int)PkgCmdIDList.cmdidGlyph); MenuCommand menuGlyph = new MenuCommand(ButtonClicked, cmdGlyphId); mcs.AddCommand(menuGlyph); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var completion = new[] { PythonCompletion(glyphService, "import", null, StandardGlyphGroup.GlyphKeyword) }; return(new FuzzyCompletionSet("PythonImportKeyword", "Python", Span, completion, _options, CompletionComparer.UnderscoresLast)); }
public PowerShellCompletionSource(IGlyphService glyphService) { Log.Debug("Constructor"); _glyphs = glyphService; }
public StaDynCompletionSource(ITextBuffer buffer, IGlyphService glyphService) { _buffer = buffer; this._glyphService = glyphService; }
public PythonNavigateToItemProviderFactory(IGlyphService glyphService) { _glyphService = glyphService; }
public DefineCompletionSource(IGlyphService glyphService, ModulesIndex index) { this.index = index; this.moduleIcon = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupClass, StandardGlyphItem.GlyphItemPublic); this.namespaceIcon = glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupNamespace, StandardGlyphItem.GlyphItemPublic); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var start1 = _stopwatch.ElapsedMilliseconds; IEnumerable <CompletionResult> members = null; IEnumerable <CompletionResult> replMembers = null; var interactiveWindow = _snapshot.TextBuffer.GetInteractiveWindow(); var pyReplEval = interactiveWindow?.Evaluator as IPythonInteractiveIntellisense; var analysis = GetAnalysisEntry(); var analyzer = analysis?.Analyzer; if (analyzer == null) { return(null); } string text; SnapshotSpan statementRange; if (!GetPrecedingExpression(out text, out statementRange)) { return(null); } if (string.IsNullOrEmpty(text)) { var expansionCompletionsTask = pyReplEval == null?EditorServices.Python?.GetExpansionCompletionsAsync() : null; if (analysis != null) { members = GetAvailableCompletions(analysis, statementRange.Start); } if (pyReplEval != null) { replMembers = pyReplEval.GetMemberNames(string.Empty); } if (expansionCompletionsTask != null) { var expansions = analyzer.WaitForRequest(expansionCompletionsTask, "GetCompletions.GetExpansionCompletions", null, 5); if (expansions != null) { // Expansions should come first, so that they replace our keyword // completions with the more detailed snippets. if (members != null) { members = expansions.Union(members, CompletionComparer.MemberEquality); } else { members = expansions; } } } } else { Task <IEnumerable <CompletionResult> > analyzerTask = null; if (pyReplEval == null || !pyReplEval.LiveCompletionsOnly) { lock (analyzer) { var location = VsProjectAnalyzer.TranslateIndex( statementRange.Start.Position, statementRange.Snapshot, analysis ); // Start the task and wait for it below - this allows a bit more time // when there is a REPL attached, so we are more likely to get results. analyzerTask = analyzer.GetMembersAsync(analysis, text, location, _options.MemberOptions); } } if (pyReplEval != null && pyReplEval.Analyzer.ShouldEvaluateForCompletion(text)) { replMembers = pyReplEval.GetMemberNames(text); } if (analyzerTask != null) { members = analyzer.WaitForRequest(analyzerTask, "GetCompletions.GetMembers"); } } if (replMembers != null) { if (members != null) { members = members.Union(replMembers, CompletionComparer.MemberEquality); } else { members = replMembers; } } var end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ (end - start1) > TooMuchTime) { if (members != null) { var memberArray = members.ToArray(); members = memberArray; Trace.WriteLine(String.Format("{0} lookup time {1} for {2} members", this, end - start1, members.Count())); } else { Trace.WriteLine(String.Format("{0} lookup time {1} for zero members", this, end - start1)); } } if (members == null) { // The expression is invalid so we shouldn't provide // a completion set at all. return(null); } var start = _stopwatch.ElapsedMilliseconds; var result = new FuzzyCompletionSet( "Python", "Python", Span, members.Select(m => PythonCompletion(glyphService, m)), _options, CompletionComparer.UnderscoresLast, matchInsertionText: true ); end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ (end - start1) > TooMuchTime) { Trace.WriteLine(String.Format("{0} completion set time {1} total time {2}", this, end - start, end - start1)); } return(result); }
internal static void LoadDefaultCompletions(IGlyphService glyphService, IClassificationFormatMapService formatMapService, IClassificationTypeRegistryService typeRegistry) { IClassificationFormatMap formatMap = formatMapService.GetClassificationFormatMap("text"); ImageSource keywordIcon = glyphService.GetGlyph(StandardGlyphGroup.GlyphKeyword, StandardGlyphItem.GlyphItemPublic); for (SyntaxType syntaxType = SyntaxType.AttributeKeyword; syntaxType <= SyntaxType.LinePreprocessorKeyword; syntaxType++) { string text = syntaxType.GetText(); TextBlock textBlock = new TextBlock(); if (syntaxType.IsPreprocessor()) { textBlock.Inlines.Add(text.ToRun(formatMap, typeRegistry.GetClassificationType(GLSLConstants.PreprocessorKeyword))); } else { textBlock.Inlines.Add(text.ToRun(formatMap, typeRegistry.GetClassificationType(GLSLConstants.Keyword))); } textBlock.Inlines.Add(new Run(" Keyword")); keywords.Add(new GLSLCompletion(textBlock, text, text + "Keyword", keywordIcon)); } for (int j = 1; j <= 32; j *= 2) { builtIn.Add((ShaderType)j, new List <Completion>()); } foreach (List <Definition> definitions in BuiltInData.Instance.Definitions.Values) { for (int i = 0; i < definitions.Count; i++) { GLSLCompletion completion = new GLSLCompletion(definitions[i].ToTextBlock(formatMap, typeRegistry, definitions.Count), definitions[i], definitions[i].GetImageSource(glyphService)); if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.Compute)) { builtIn[ShaderType.Compute].Add(completion); } if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.Vertex)) { builtIn[ShaderType.Vertex].Add(completion); } if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.Geometry)) { builtIn[ShaderType.Geometry].Add(completion); } if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.TessellationControl)) { builtIn[ShaderType.TessellationControl].Add(completion); } if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.TessellationEvaluation)) { builtIn[ShaderType.TessellationEvaluation].Add(completion); } if (definitions[i].ShaderType.HasFlag <ShaderType>(ShaderType.Fragment)) { builtIn[ShaderType.Fragment].Add(completion); } } } }
public Dev14NavigateToHostVersionService( IGlyphService glyphService) { _glyphService = glyphService; }
public VisualStudioPullMemberUpService(IGlyphService glyphService, IWaitIndicator waitIndicator) { _glyphService = glyphService; _waitIndicator = waitIndicator; }
public DjangoCompletionSource(IGlyphService glyphService, VsProjectAnalyzer analyzer, IServiceProvider serviceProvider, ITextBuffer textBuffer) : base(glyphService, analyzer, textBuffer) { _serviceProvider = serviceProvider; }
public virtual CompletionSet GetCompletions(IGlyphService glyphService) { return(null); }
public CompletionPresenter(ICompletionBroker completionBroker, IGlyphService glyphService) { _completionBroker = completionBroker; _glyphService = glyphService; }
public ImageService(IServiceContainer services) { _services = services; _glyphService = services.GetService <IGlyphService>(); }
public MemberSymbolViewModel(ISymbol symbol, IGlyphService glyphService) { this.MemberSymbol = symbol; _glyphService = glyphService; _isChecked = true; }
public ClauTextCompletionSourceProvider(IGlyphService glyphService) { _glyphService = glyphService; }
public CompletionSource(ITextBuffer textBuffer, NodejsClassifier classifier, IServiceProvider serviceProvider, IGlyphService glyphService) { _textBuffer = textBuffer; _classifier = classifier; _serviceProvider = serviceProvider; _glyphService = glyphService; }
public PythonNavigateToItemProvider(IServiceProvider serviceProvider, IGlyphService glyphService) { _serviceProvider = serviceProvider; _glyphService = glyphService; }
public static ImageSource GetImageSource(this Glyph glyph, IGlyphService glyphService) { return(glyphService.GetGlyph(glyph.GetStandardGlyphGroup(), glyph.GetStandardGlyphItem())); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var start = _stopwatch.ElapsedMilliseconds; var line = Span.GetStartPoint(TextBuffer.CurrentSnapshot).GetContainingLine(); var startPos = line.Start.Position + line.GetText().IndexOf("def"); var analysis = GetAnalysisEntry(); if (analysis == null) { return(null); } var span = Span.GetSpan(TextBuffer.CurrentSnapshot); int defIndent = span.Start.GetContainingLine().GetText().IndexOf("def"); string indentation; if (_options.ConvertTabsToSpaces) { indentation = new string(' ', defIndent + _options.IndentSize); } else { indentation = new string('\t', defIndent / 8 + 1); } var snapshot = TextBuffer.CurrentSnapshot; var pos = VsProjectAnalyzer.TranslateIndex(startPos, snapshot, analysis); var completions = analysis.Analyzer.GetOverrideCompletionsAsync( analysis, TextBuffer, pos, indentation ).WaitOrDefault(1000)?.overrides; CompletionSet res; if (completions != null && completions.Any()) { var set = new FuzzyCompletionSet( "PythonOverrides", "Python", Span, completions.Select( x => PythonCompletion( glyphService, x.name, x.completion, x.doc, StandardGlyphGroup.GlyphGroupOverload ) ).ToArray(), _options, CompletionComparer.UnderscoresLast ); set.CommitByDefault = false; res = set; } else { res = new CompletionSet(); } var end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ end - start > TooMuchTime) { Trace.WriteLine(String.Format("{0} lookup time {1} for {2} classes", this, end - start, res.Completions.Count)); } return(res); }
public static ImageSource GetImageSource(this Glyph?glyph, IGlyphService glyphService) { return(glyph.HasValue ? glyph.Value.GetImageSource(glyphService) : null); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { // TODO: implement return(null); }
public NitraNavigateToItemProviderFactory(IGlyphService glyphService) { _glyphService = glyphService; }
public void GetMap(XML_TYPE xmltype, out List <Completion> list, MAPTYPE mapttype, IGlyphService gs, string key = null) { list = new List <Completion>(); ImageSource ico = gs.GetGlyph(StandardGlyphGroup.GlyphKeyword, StandardGlyphItem.GlyphItemPublic); switch (mapttype) { case MAPTYPE.C: { foreach (KeyValuePair <string, CtrlInf> pair in m_controlMap) { //第一个是显示的单词,第二个是插入的单词,第三个说明 list.Add(new Completion(pair.Key, pair.Key, pair.Value.getdes(), ico, "c")); } } break; case MAPTYPE.P: { addProToList(ref list, key, ref ico); } break; } }
internal static System.Windows.Media.ImageSource GetGlyph(StandardGlyphGroup group, StandardGlyphItem item) { IGlyphService service = GetService <IGlyphService>(); return(service.GetGlyph(group, item)); }
public CompletionSource(ITextBuffer buffer, ITextStructureNavigatorSelectorService navigation, IGlyphService glyphService) { _buffer = buffer; _navigation = navigation; _glyphService = glyphService; var keywordImage = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupNamespace, StandardGlyphItem.GlyphItemPublic); foreach (var str in _poorMansKeywords) { _completions.Add(new Completion(str, str, str, keywordImage, null)); } var extensionImage = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupClass, StandardGlyphItem.GlyphItemPublic); foreach (var str in _poorMansExtensionIntellisense) { _completions.Add(new Completion(str, str, str, extensionImage, null)); } var localVariableImage = _glyphService.GetGlyph(StandardGlyphGroup.GlyphGroupVariable, StandardGlyphItem.GlyphItemPublic); foreach (var localVar in new[] { "$localVar1", "$localVar2", "$anotherLocalVar" }) { _completions.Add(new Completion(localVar, localVar, localVar, localVariableImage, null)); } _completions = _completions.OrderBy(x => x.DisplayText).ToList(); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var start1 = _stopwatch.ElapsedMilliseconds; IEnumerable <MemberResult> members = null; IEnumerable <MemberResult> replMembers = null; IInteractiveEvaluator eval; IPythonReplIntellisense pyReplEval = null; if (_snapshot.TextBuffer.Properties.TryGetProperty(typeof(IInteractiveEvaluator), out eval)) { pyReplEval = eval as IPythonReplIntellisense; } var analysis = GetAnalysisEntry(); string text; SnapshotSpan statementRange; if (!GetPrecedingExpression(out text, out statementRange)) { return(null); } else if (string.IsNullOrEmpty(text)) { if (analysis != null) { lock (_analyzer) { var location = VsProjectAnalyzer.TranslateIndex( statementRange.Start.Position, statementRange.Snapshot, analysis ); var parameters = Enumerable.Empty <MemberResult>(); var sigs = VsProjectAnalyzer.GetSignatures(_serviceProvider, _snapshot, Span); if (sigs.Signatures.Any()) { parameters = sigs.Signatures .SelectMany(s => s.Parameters) .Select(p => p.Name) .Distinct() .Select(n => new MemberResult(n, PythonMemberType.Field)); } members = analysis.GetAllAvailableMembers(location, _options.MemberOptions) .Union(parameters, CompletionComparer.MemberEquality); } } if (pyReplEval != null) { replMembers = pyReplEval.GetMemberNames(string.Empty); } } else { if (analysis != null && (pyReplEval == null || !pyReplEval.LiveCompletionsOnly)) { lock (_analyzer) { var location = VsProjectAnalyzer.TranslateIndex( statementRange.Start.Position, statementRange.Snapshot, analysis ); members = analysis.GetMembers(text, location, _options.MemberOptions); } } if (pyReplEval != null && _snapshot.TextBuffer.GetAnalyzer(_serviceProvider).ShouldEvaluateForCompletion(text)) { replMembers = pyReplEval.GetMemberNames(text); } } if (replMembers != null) { if (members != null) { members = members.Union(replMembers, CompletionComparer.MemberEquality); } else { members = replMembers; } } var end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ (end - start1) > TooMuchTime) { if (members != null) { var memberArray = members.ToArray(); members = memberArray; Trace.WriteLine(String.Format("{0} lookup time {1} for {2} members", this, end - start1, members.Count())); } else { Trace.WriteLine(String.Format("{0} lookup time {1} for zero members", this, end - start1)); } } if (members == null) { // The expression is invalid so we shouldn't provide // a completion set at all. return(null); } var start = _stopwatch.ElapsedMilliseconds; var result = new FuzzyCompletionSet( "Python", "Python", Span, members.Select(m => PythonCompletion(glyphService, m)), _options, CompletionComparer.UnderscoresLast, matchInsertionText: true ); end = _stopwatch.ElapsedMilliseconds; if (/*Logging &&*/ (end - start1) > TooMuchTime) { Trace.WriteLine(String.Format("{0} completion set time {1} total time {2}", this, end - start, end - start1)); } return(result); }
public override CompletionSet GetCompletions(IGlyphService glyphService) { var snapshot = TextBuffer.CurrentSnapshot; var span = snapshot.GetApplicableSpan(Span.GetStartPoint(snapshot)); var classifier = snapshot.TextBuffer.GetPythonClassifier(); if (span == null || classifier == null) { // Not a valid Python text buffer, which should not happen Debug.Fail("Getting completions for non-Python buffer"); return(null); } var text = span.GetText(snapshot); var token = classifier.GetClassificationSpans(span.GetSpan(snapshot)).LastOrDefault(); if (token == null) { // Not a valid line of tokens return(null); } bool quoteBackslash = !token.Span.GetText().TakeWhile(c => !QuoteChars.Contains(c)).Any(c => c == 'r' || c == 'R'); if (quoteBackslash) { text = text.Replace("\\\\", "\\"); } string cwd; var replEval = TextBuffer.GetInteractiveWindow()?.GetPythonEvaluator(); if (replEval != null) { cwd = replEval.CurrentWorkingDirectory; } else if (!string.IsNullOrEmpty(cwd = TextBuffer.GetFilePath())) { cwd = PathUtils.GetParent(cwd); } else { cwd = Environment.CurrentDirectory; } var completions = GetEntryInfo(text, cwd, Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)) .Select(e => new DynamicallyVisibleCompletion( e.Caption, quoteBackslash ? e.InsertionText.Replace("\\", "\\\\") : e.InsertionText, e.Tooltip, glyphService.GetGlyph( e.IsFile ? StandardGlyphGroup.GlyphLibrary : StandardGlyphGroup.GlyphClosedFolder, StandardGlyphItem.GlyphItemPublic ), e.IsFile ? "File" : "Directory" )).ToArray(); if (completions.Length == 0) { return(null); } return(new FuzzyCompletionSet( "PythonFilenames", "Files", Span, completions, _options, CompletionComparer.UnderscoresLast, matchInsertionText: true )); }
public MemberSymbolViewModel(ISymbol symbol, IGlyphService glyphService) : base(symbol, glyphService) { }
public EpochCompletionSource(EpochCompletionSourceProvider sourceProvider, ITextBuffer textBuffer, IGlyphService glyphService) { m_sourceProvider = sourceProvider; m_textBuffer = textBuffer; m_glyphService = glyphService; m_parsedProject = textBuffer.Properties.GetProperty <Parser.Project>(typeof(Parser.Project)); }