public ImportSymbolCompletionData (CSharpCompletionTextEditorExtension ext, RoslynCodeCompletionFactory factory, ISymbol type, bool useFullName) : base (null, factory, type)
		{
			this.completionExt = ext;
			this.useFullName = useFullName;
			this.type = type;
			this.DisplayFlags |= DisplayFlags.IsImportCompletion;
		}
		public EventCreationCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ITypeSymbol delegateType, string varName, INamedTypeSymbol curType) : base (factory, keyHandler)
		{
			this.DisplayText = varName;
			this.delegateType = delegateType;
			this.factory = factory;
			this.Icon = "md-newmethod";
		}
		public CreatePartialCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, int declarationBegin, ITypeSymbol currentType, ISymbol member, bool afterKeyword) : base (keyHandler, factory, member)
		{
			this.afterKeyword = afterKeyword;
			this.currentType = currentType;
			this.declarationBegin = declarationBegin;
			this.GenerateBody = true;
		}
		public CreateOverrideCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, int declarationBegin, ITypeSymbol currentType, Microsoft.CodeAnalysis.ISymbol member, bool afterKeyword) : base (keyHandler, factory, member, member.ToDisplayString ())
		{
			this.afterKeyword = afterKeyword;
			this.currentType = currentType;
			this.declarationBegin = declarationBegin;
			this.GenerateBody = true;
		}
		public RoslynSymbolCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ISymbol symbol, string text = null) : base (keyHandler)
		{
			this.factory = factory;
			this.text = text;
			Symbol = symbol;
			if (IsObsolete (Symbol))
				DisplayFlags |= DisplayFlags.Obsolete;
		}
		public CastCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, SemanticModel semanticModel, ISymbol member, SyntaxNode nodeToCast, ITypeSymbol targetType) : base(keyHandler)
		{
			this.targetType = targetType;
			this.nodeToCast = nodeToCast;
			this.member = member;
			this.semanticModel = semanticModel;
			this.factory = factory;
			this.DisplayText = member.Name;
		}
		public RoslynSymbolCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ISymbol symbol, string text = null) : base (keyHandler)
		{
			this.factory = factory;
			this.text = text;
			Symbol = symbol;
			if (IsObsolete (Symbol))
				DisplayFlags |= DisplayFlags.Obsolete;
			rightSideDescription = new Lazy<string> (delegate {
				var returnType = symbol.GetReturnType ();
				if (returnType == null || factory == null)
					return null;
				try {
					return "<span font='Sans 10'>" + GLib.Markup.EscapeText (SafeMinimalDisplayString (returnType, factory.SemanticModel, ext.Editor.CaretOffset)) + "</span>";
				} catch (Exception e) {
					LoggingService.LogError ("Format error.", e);
				}
				return null;
			});
		}
		async Task<string> Test(string input, string type, string member, Gdk.Key key = Gdk.Key.Return, bool isDelegateExpected = false)
		{
			var s = await Setup (input);
			var ext = s.Item1;
			TestViewContent content = s.Item2;

			var listWindow = new CompletionListWindow ();
			var widget = new TestCompletionWidget (ext.Editor, ext.DocumentContext);
			listWindow.CompletionWidget = widget;
			listWindow.CodeCompletionContext = widget.CurrentCodeCompletionContext;
			var model = ext.DocumentContext.ParsedDocument.GetAst<SemanticModel> ();
			Ide.IdeApp.Preferences.AddParenthesesAfterCompletion.Set (true);
			Ide.IdeApp.Preferences.AddOpeningOnly.Set (false);

			var t = model.Compilation.GetTypeByMetadataName (type); 
			var method = member != null ? t.GetMembers().First (m => m.Name == member) : t.GetMembers ().OfType<IMethodSymbol> ().First (m => m.MethodKind == MethodKind.Constructor);
			var factory = new RoslynCodeCompletionFactory (ext, model);
			var data = new RoslynSymbolCompletionData (null, factory, method);
			data.IsDelegateExpected = isDelegateExpected;
			KeyActions ka = KeyActions.Process;
			data.InsertCompletionText (listWindow, ref ka, KeyDescriptor.FromGtk (key, (char)key, Gdk.ModifierType.None)); 

			return widget.CompletedWord;
		}
		public RoslynSymbolCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ISymbol symbol, string text = null) : base (keyHandler)
		{
			this.factory = factory;
			this.text = text;
			Symbol = symbol;
		}
		async Task<string> Test(string input, string type, string member, Gdk.Key key = Gdk.Key.Return)
		{
			var s = await Setup (input);
			var ext = s.Item1;
			TestViewContent content = s.Item2;

			var listWindow = new CompletionListWindow ();
			var widget = new TestCompletionWidget (ext.Editor, ext.DocumentContext);
			listWindow.CompletionWidget = widget;
			listWindow.CodeCompletionContext = widget.CurrentCodeCompletionContext;
			var sm = ext.DocumentContext.ParsedDocument.GetAst<SemanticModel> ();

			var t = sm.Compilation.GetTypeByMetadataName (type); 
			var foundMember = t.GetMembers().First (m => m.Name == member);
			var factory = new RoslynCodeCompletionFactory (ext, sm);
			var data = new RoslynSymbolCompletionData (null, factory, foundMember);
			data.DisplayFlags |= DisplayFlags.NamedArgument;
			KeyActions ka = KeyActions.Process;
			data.InsertCompletionText (listWindow, ref ka, KeyDescriptor.FromGtk (key, (char)key, Gdk.ModifierType.None)); 

			return widget.CompletedWord;
		}
		void IExtensionContextHandler.Init (RoslynCodeCompletionFactory factory)
		{
			this.factory = factory;
		}
		public AnonymousMethodCompletionData (RoslynCodeCompletionFactory factory, ICompletionDataKeyHandler keyHandler) : base (keyHandler)
		{
			this.factory = factory;
			this.Icon = "md-newmethod";
		}
			/*
			#region IListData implementation

			CSharpCompletionDataList list;
			public CSharpCompletionDataList List {
				get {
					return list;
				}
				set {
					list = value;
				}
			}

			#endregion*/

			public XmlDocCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory ext, string title, string description, string insertText) : base (keyHandler, title, "md-keyword", description, insertText ?? title)
			{
				// this.ext = ext;
				this.title = title;
			}
Exemple #14
0
 void IExtensionContextHandler.Init(RoslynCodeCompletionFactory factory)
 {
     this.factory = factory;
 }
		public CastCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, SemanticModel semanticModel, ISymbol symbol, SyntaxNode nodeToCast, ITypeSymbol targetType) : base(keyHandler, factory, symbol)
		{
			this.targetType = targetType;
			this.nodeToCast = nodeToCast;
			this.semanticModel = semanticModel;
		}
		public ObjectCreationCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, SemanticModel semanticModel, ITypeSymbol type, ISymbol symbol, int declarationBegin, bool afterKeyword) : base(keyHandler, factory, symbol)
		{
			this.type = type;
			this.semanticModel = semanticModel;
			this.afterKeyword = afterKeyword;
			this.declarationBegin = declarationBegin;
			this.symbol = insertSymbol = symbol;
		}
Exemple #17
0
 public CastCompletionData(ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, SemanticModel semanticModel, ISymbol symbol, SyntaxNode nodeToCast, ITypeSymbol targetType) : base(keyHandler, factory, symbol)
 {
     this.targetType    = targetType;
     this.nodeToCast    = nodeToCast;
     this.semanticModel = semanticModel;
 }
 public AnonymousMethodCompletionData(RoslynCodeCompletionFactory factory, ICompletionDataKeyHandler keyHandler) : base(keyHandler)
 {
     this.factory = factory;
     this.Icon    = "md-newmethod";
 }
			public KeywordCompletionData (ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, SyntaxKind kind) : base (keyHandler)
			{
				this.kind = kind;
				this.factory = factory;
			}
Exemple #20
0
 public RoslynSymbolCompletionData(ICompletionDataKeyHandler keyHandler, RoslynCodeCompletionFactory factory, ISymbol symbol, string text = null) : base(keyHandler)
 {
     this.factory = factory;
     this.text    = text;
     Symbol       = symbol;
 }