本文整理汇总了C#中CSharpCompletionTextEditorExtension类的典型用法代码示例。如果您正苦于以下问题:C# CSharpCompletionTextEditorExtension类的具体用法?C# CSharpCompletionTextEditorExtension怎么用?C# CSharpCompletionTextEditorExtension使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CSharpCompletionTextEditorExtension类属于命名空间,在下文中一共展示了CSharpCompletionTextEditorExtension类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
static CSharpTextEditorIndentation Setup (string input, out TestViewContent content)
{
TestWorkbenchWindow tww = new TestWorkbenchWindow ();
content = new TestViewContent ();
content.Data.Options.IndentStyle = IndentStyle.Auto;
tww.ViewContent = content;
content.ContentName = "a.cs";
content.GetTextEditorData ().Document.MimeType = "text/x-csharp";
Document doc = new Document (tww);
var text = input;
int endPos = text.IndexOf ('$');
if (endPos >= 0)
text = text.Substring (0, endPos) + text.Substring (endPos + 1);
content.Text = text;
content.CursorPosition = System.Math.Max (0, endPos);
var compExt = new CSharpCompletionTextEditorExtension ();
compExt.Initialize (doc);
content.Contents.Add (compExt);
var ext = new CSharpTextEditorIndentation ();
CSharpTextEditorIndentation.OnTheFlyFormatting = true;
ext.Initialize (doc);
content.Contents.Add (ext);
doc.UpdateParseDocument ();
return ext;
}
示例2: DelegateDataProvider
public DelegateDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType)
{
this.startOffset = startOffset;
// this.ext = ext;
this.delegateType = delegateType;
this.delegateMethod = delegateType.GetDelegateInvokeMethod ();
}
示例3: ImportSymbolCompletionData
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;
}
示例4: DelegateDataProvider
public DelegateDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType delegateType) : base (ext, startOffset)
{
compilation = ext.UnresolvedFileCompilation;
file = ext.CSharpUnresolvedFile;
// this.delegateType = delegateType;
this.delegateMethod = delegateType.GetDelegateInvokeMethod ();
}
示例5: Setup
static Document Setup (string input)
{
var tww = new TestWorkbenchWindow ();
var content = new TestViewContent ();
var project = new DotNetAssemblyProject ("C#");
project.Name = "test";
project.References.Add (new ProjectReference (ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
project.References.Add (new ProjectReference (ReferenceType.Package, "System.Core"));
project.FileName = "test.csproj";
TypeSystemService.LoadProject (project);
TypeSystemService.GetProjectContentWrapper (project).ReconnectAssemblyReferences ();
content.Project = project;
tww.ViewContent = content;
content.ContentName = "a.cs";
content.GetTextEditorData ().Document.MimeType = "text/x-csharp";
var doc = new Document (tww);
var text = input;
int endPos = text.IndexOf ('$');
if (endPos >= 0)
text = text.Substring (0, endPos) + text.Substring (endPos + 1);
content.Text = text;
content.CursorPosition = Math.Max (0, endPos);
var compExt = new CSharpCompletionTextEditorExtension ();
compExt.Initialize (doc);
content.Contents.Add (compExt);
doc.UpdateParseDocument ();
return doc;
}
示例6: ImportSymbolCompletionData
public ImportSymbolCompletionData (CSharpCompletionTextEditorExtension ext, INamedTypeSymbol type, bool useFullName) : base (null, type.Name)
{
this.ext = ext;
this.useFullName = useFullName;
this.type = type;
this.DisplayFlags |= DisplayFlags.IsImportCompletion;
}
示例7: IndexerParameterDataProvider
public IndexerParameterDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType type, IEnumerable<IProperty> indexers, AstNode resolvedExpression) : base (ext, startOffset)
{
compilation = ext.UnresolvedFileCompilation;
file = ext.CSharpUnresolvedFile;
// this.resolvedExpression = resolvedExpression;
this.indexers = new List<IProperty> (indexers);
}
示例8: Setup
static Document Setup (string input)
{
TestWorkbenchWindow tww = new TestWorkbenchWindow ();
var content = new TestViewContent ();
tww.ViewContent = content;
content.ContentName = "a.cs";
content.GetTextEditorData ().Document.MimeType = "text/x-csharp";
Document doc = new Document (tww);
var text = input;
int endPos = text.IndexOf ('$');
if (endPos >= 0)
text = text.Substring (0, endPos) + text.Substring (endPos + 1);
content.Text = text;
content.CursorPosition = System.Math.Max (0, endPos);
var compExt = new CSharpCompletionTextEditorExtension ();
compExt.Initialize (doc);
content.Contents.Add (compExt);
doc.UpdateParseDocument ();
return doc;
}
示例9: AbstractParameterDataProvider
public AbstractParameterDataProvider (CSharpCompletionTextEditorExtension ext, int startOffset)
{
if (ext == null)
throw new ArgumentNullException ("ext");
this.ext = ext;
this.startOffset = startOffset;
}
示例10: IndexerParameterDataProvider
public IndexerParameterDataProvider (int startOffset, CSharpCompletionTextEditorExtension ext, IType type, AstNode resolvedExpression)
{
this.startOffset = startOffset;
// this.ext = ext;
this.resolvedExpression = resolvedExpression;
indexers = new List<IProperty> (type.GetProperties (p => p.IsIndexer));
}
示例11: RoslynCodeCompletionFactory
public RoslynCodeCompletionFactory (CSharpCompletionTextEditorExtension ext, SemanticModel semanticModel)
{
if (ext == null)
throw new ArgumentNullException ("ext");
if (semanticModel == null)
throw new ArgumentNullException ("semanticModel");
this.semanticModel = semanticModel;
this.ext = ext;
}
示例12: Initialize
public override void Initialize ()
{
CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
isPathSet = false;
UpdatePath (null, null);
caret = Document.Editor.Caret;
caret.PositionChanged += UpdatePath;
ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
}
示例13: NewOverrideCompletionData
public NewOverrideCompletionData (CSharpCompletionTextEditorExtension ext, int declarationBegin, IUnresolvedTypeDefinition type, IMember member) : base (null)
{
this.ext = ext;
this.type = type;
this.member = member;
this.declarationBegin = declarationBegin;
this.GenerateBody = true;
this.Icon = member.GetStockIcon ();
this.DisplayText = ambience.GetString (member, OutputFlags.IncludeParameters | OutputFlags.IncludeParameterName | OutputFlags.IncludeGenerics | OutputFlags.HideExtensionsParameter| OutputFlags.IncludeAccessor);
this.CompletionText = member.EntityType == EntityType.Indexer ? "this" : member.Name;
}
示例14: Initialize
public override void Initialize ()
{
CurrentPath = new PathEntry[] { new PathEntry (GettextCatalog.GetString ("No selection")) { Tag = null } };
isPathSet = false;
UpdateOwnerProjects ();
UpdatePath (null, null);
caret = Document.Editor.Caret;
caret.PositionChanged += UpdatePath;
ext = Document.GetContent<CSharpCompletionTextEditorExtension> ();
ext.TypeSegmentTreeUpdated += HandleTypeSegmentTreeUpdated;
IdeApp.Workspace.FileAddedToProject += HandleProjectChanged;
IdeApp.Workspace.FileRemovedFromProject += HandleProjectChanged;
}
示例15: BuildStub
/// <summary>
/// Builds a compileable stub file out of an entity.
/// </summary>
/// <returns>
/// A string representing the stub
/// </returns>
/// <param name='memberStartOffset'>
/// The offset where the member starts in the returned text.
/// </param>
static string BuildStub (MonoDevelop.Ide.Gui.Document data, CSharpCompletionTextEditorExtension.TypeSystemTreeSegment seg, int startOffset, int endOffset, out int memberStartOffset)
{
var pf = data.ParsedDocument.ParsedFile as CSharpUnresolvedFile;
if (pf == null) {
memberStartOffset = 0;
return null;
}
var sb = new StringBuilder ();
int closingBrackets = 0;
// use the member start location to determine the using scope, because this information is in sync, the position in
// the file may have changed since last parse run (we have up 2 date locations from the type segment tree).
var scope = pf.GetUsingScope (seg.Entity.Region.Begin);
while (scope != null && !string.IsNullOrEmpty (scope.NamespaceName)) {
// Hack: some syntax errors lead to invalid namespace names.
if (scope.NamespaceName.EndsWith ("<invalid>")) {
scope = scope.Parent;
continue;
}
sb.Append ("namespace Stub {");
sb.Append (data.Editor.EolMarker);
closingBrackets++;
while (scope.Parent != null && scope.Parent.Region == scope.Region)
scope = scope.Parent;
scope = scope.Parent;
}
var parent = seg.Entity.DeclaringTypeDefinition;
while (parent != null) {
sb.Append ("class " + parent.Name + " {");
sb.Append (data.Editor.EolMarker);
closingBrackets++;
parent = parent.DeclaringTypeDefinition;
}
memberStartOffset = sb.Length;
sb.Append (data.Editor.GetTextBetween (seg.Offset, endOffset));
// Insert at least caret column eol markers otherwise the reindent of the generated closing bracket
// could interfere with the current indentation.
var endLocation = data.Editor.OffsetToLocation (endOffset);
for (int i = 0; i <= endLocation.Column; i++) {
sb.Append (data.Editor.EolMarker);
}
sb.Append (data.Editor.EolMarker);
sb.Append (new string ('}', closingBrackets));
return sb.ToString ();
}