本文整理汇总了C#中MonoDevelop.Ide.CodeCompletion.CodeCompletionContext类的典型用法代码示例。如果您正苦于以下问题:C# CodeCompletionContext类的具体用法?C# CodeCompletionContext怎么用?C# CodeCompletionContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CodeCompletionContext类属于MonoDevelop.Ide.CodeCompletion命名空间,在下文中一共展示了CodeCompletionContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateCompletionAndUpdate
CSharpCompletionTextEditorExtension CreateCompletionAndUpdate (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, UnderlyingDocumentInfo docInfo,
out CodeCompletionContext codeCompletionContext)
{
var completion = CreateCompletion (editor, context, docInfo, out codeCompletionContext);
completion.UpdateParsedDocument ();
return completion;
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:RazorCSharpCompletionBuilder.cs
示例2: HandleCompletion
public ICompletionDataList HandleCompletion (Document realDocument, CodeCompletionContext completionContext,
UnderlyingDocumentInfo docInfo, char currentChar, ref int triggerWordLength)
{
CodeCompletionContext ccc;
var completion = CreateCompletionAndUpdate (realDocument, docInfo, out ccc);
return completion.HandleCodeCompletion (completionContext, currentChar, ref triggerWordLength);
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:RazorCSharpCompletionBuilder.cs
示例3: ShowWindow
public static bool ShowWindow (char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext, System.Action closedDelegate)
{
try {
if (wnd == null) {
wnd = new CompletionListWindow ();
wnd.WordCompleted += HandleWndWordCompleted;
}
try {
if (!wnd.ShowListWindow (firstChar, list, completionWidget, completionContext, closedDelegate)) {
if (list is IDisposable)
((IDisposable)list).Dispose ();
DestroyWindow ();
return false;
}
if (ForceSuggestionMode)
wnd.AutoSelect = false;
OnWindowShown (EventArgs.Empty);
return true;
} catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
return false;
}
} finally {
ParameterInformationWindowManager.UpdateWindow (completionWidget);
}
}
开发者ID:raufbutt,项目名称:monodevelop-old,代码行数:28,代码来源:CompletionWindowManager.cs
示例4: GetCurrentParameterIndex
// Returns the index of the parameter where the cursor is currently positioned.
// -1 means the cursor is outside the method parameter list
// 0 means no parameter entered
// > 0 is the index of the parameter (1-based)
public int GetCurrentParameterIndex (ICompletionWidget widget, CodeCompletionContext ctx)
{
int cursor = widget.CurrentCodeCompletionContext.TriggerOffset;
int i = ctx.TriggerOffset;
if (i < 0 || i >= editor.Length || editor.GetCharAt (i) == ')')
return -1;
if (i > cursor)
return -1;
else if (i == cursor)
return 0;
int parameterIndex = 1;
while (i++ < cursor) {
if (i >= widget.TextLength)
break;
char ch = widget.GetChar (i);
if (ch == ',')
parameterIndex++;
else if (ch == ')')
return -1;
}
return parameterIndex;
}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:30,代码来源:DataProvider.cs
示例5: CreateCompletionAndUpdate
CSharpCompletionTextEditorExtension CreateCompletionAndUpdate (Document realDocument, UnderlyingDocumentInfo docInfo,
out CodeCompletionContext codeCompletionContext)
{
var completion = CreateCompletion (realDocument, docInfo, out codeCompletionContext);
completion.UpdateParsedDocument ();
return completion;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:7,代码来源:RazorCSharpCompletionBuilder.cs
示例6: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char triggerChar, ref int triggerWordLength)
{
var l = new CompletionDataList();
if (!(triggerChar==' ' ||
char.IsLetter(triggerChar) ||
triggerChar == '@' ||
triggerChar == '(' ||
triggerChar == '_' ||
triggerChar == '.' ||
triggerChar == '\0'))
return l;
triggerWordLength = (char.IsLetter(triggerChar) || triggerChar=='_' || triggerChar=='@') ? 1 : 0;
// Require a parsed D source
var dom = base.Document.ParsedDocument as ParsedDModule;
if (dom != null && dom.DDom!=null)
lock(dom.DDom)
DCodeCompletionSupport.BuildCompletionData(
Document,
dom.DDom,
completionContext,
l,
triggerChar);
return l;
}
开发者ID:robik,项目名称:Mono-D,代码行数:29,代码来源:EditorCompletionExtension.cs
示例7: HandleCompletion
public Task<ICompletionDataList> HandleCompletion (MonoDevelop.Ide.Editor.TextEditor editor, DocumentContext context, CodeCompletionContext completionContext,
UnderlyingDocumentInfo docInfo, char currentChar, CancellationToken token)
{
CodeCompletionContext ccc;
var completion = CreateCompletionAndUpdate (editor, context, docInfo, out ccc);
return completion.HandleCodeCompletionAsync (completionContext, currentChar, token);
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:RazorCSharpCompletionBuilder.cs
示例8: Update
public void Update (CodeCompletionContext completionContext, XmlDocument data)
{
//showCompletion = true;
offset = completionContext.TriggerOffset;
signature = data.FirstChild.InnerText.Trim ();
//MonoDevelop.Ide.MessageService.ShowError (signature);
signature = signature.Replace (" ", "");
signature = signature.Replace ("<", "<");
signature = signature.Replace (">", ">");
string[] splitByOpenParen = signature.Split ('(');
signature = "";
for (int i = 0; i < splitByOpenParen.Length; i++) {
string[] splitByCloseParen = splitByOpenParen[i].Split (')');
for (int j = 0; j < splitByCloseParen.Length; j++) {
if (i > 0 && j == 0) {
signature += splitByCloseParen[0].Replace ("->", "->");
} else {
signature += splitByCloseParen[i];
}
}
}
//string[] splitByColon = signature.Split (':');
//if (splitByColon.Length > 1) {
//parameterName = splitByColon[0];
//signature = splitByColon[1];
//}
//MonoDevelop.Ide.MessageService.ShowError (parameterName);
//MonoDevelop.Ide.MessageService.ShowError (signature);
parameters = signature.Split (new string[] { "->" }, StringSplitOptions.None);
for (int i = 0; i < parameters.Length; i++) {
parameters[i] = parameters[i].Replace ("->", " -> ");
//MonoDevelop.Ide.MessageService.ShowError (parameters[i]);
}
//MonoDevelop.Ide.MessageService.ShowError (parameters.Length.ToString ());
//MonoDevelop.Ide.MessageService.ShowError (parameters.ToString ());
}
开发者ID:igwtech,项目名称:md-haxebinding,代码行数:60,代码来源:HaxeParameterDataProvider.cs
示例9: HandleParameterCompletion
public override IParameterDataProvider HandleParameterCompletion(CodeCompletionContext completionContext, char completionChar)
{
if (mCompletionEnabled)
{
// HandleCodeCompletion is always called first, so we don't need to fetch completion data
if (completionChar == ')' || completionContext.TriggerLine != mCacheTriggerLine)
{
// invalidate cached completion
mCacheXML = null;
}
if (!mCacheIsObject && mCacheXML != null)
{
if (parameterDataProvider == null)
{
parameterDataProvider = new HaxeParameterDataProvider ();
parameterDataProvider.Update (completionContext, mCacheXML);
return parameterDataProvider;
}
}
else
{
if (parameterDataProvider != null)
{
parameterDataProvider.Clear ();
parameterDataProvider = null;
}
}
}
return null;
}
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:33,代码来源:HaxeTextEditorCompletion.cs
示例10: ParameterDataProvider
public ParameterDataProvider(Document doc, CodeCompletionContext context)
{
this.doc = doc;
string basepath = (null == doc.Project)?
doc.FileName.FullPath.ParentDirectory:
doc.Project.BaseDirectory.FullPath;
string contents = doc.Editor.Text;
string line = doc.Editor.GetLineText (context.TriggerLine);
method = RubyCompletion.GetSymbol (contents, context.TriggerOffset-1);
int methodIndex = line.IndexOf (method, 0);
// Console.WriteLine ("HandleParameterCompletion ({0} {1})", line, methodIndex);
if (0 < methodIndex) {
int end = line.LastIndexOfAny (RubyCompletion.wordBreakChars, methodIndex);
int start = -1;
if (0 < end) {
start = line.LastIndexOfAny (RubyCompletion.wordBreakChars, end-1)+1;
if (0 <= start) {
owner = line.Substring (start, end-start);
}
}
// Console.WriteLine ("Owner: {0}-{1}", start, end);
}
if ("def".Equals (owner, StringComparison.Ordinal) || 0 <= Array.IndexOf (RubyCompletion.reservedWords, method)) {
method = owner = string.Empty;
methodParams = new string[0];
return;
}
methodParams = RubyCompletion.GetMethodArguments (basepath, contents, context.TriggerLine-1, owner, method);
Valid = (null != methodParams);
}
开发者ID:nover,项目名称:rubybinding,代码行数:35,代码来源:ParameterDataProvider.cs
示例11: ShowWindow
// ext may be null, but then parameter completion don't work
public static bool ShowWindow (CompletionTextEditorExtension ext, char firstChar, ICompletionDataList list, ICompletionWidget completionWidget, CodeCompletionContext completionContext)
{
try {
if (ext != null) {
int inserted = ext.document.Editor.EnsureCaretIsNotVirtual ();
if (inserted > 0)
completionContext.TriggerOffset = ext.document.Editor.Caret.Offset;
}
if (wnd == null) {
wnd = new CompletionListWindow ();
wnd.WordCompleted += HandleWndWordCompleted;
}
wnd.Extension = ext;
try {
if (!wnd.ShowListWindow (firstChar, list, completionWidget, completionContext)) {
if (list is IDisposable)
((IDisposable)list).Dispose ();
HideWindow ();
return false;
}
if (ForceSuggestionMode)
wnd.AutoSelect = false;
wnd.Show ();
DesktopService.RemoveWindowShadow (wnd);
OnWindowShown (EventArgs.Empty);
return true;
} catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
return false;
}
} finally {
ParameterInformationWindowManager.UpdateWindow (ext, completionWidget);
}
}
开发者ID:harishamdani,项目名称:monodevelop,代码行数:36,代码来源:CompletionWindowManager.cs
示例12: CreateEditorData
public static EditorData CreateEditorData(Document EditorDocument, DModule Ast, CodeCompletionContext ctx, char triggerChar = '\0')
{
bool removeChar = char.IsLetter(triggerChar) || triggerChar == '_';
var deltaOffset = 0;//removeChar ? 1 : 0;
var caretOffset = ctx.TriggerOffset - (removeChar ? 1 : 0);
var caretLocation = new CodeLocation(ctx.TriggerLineOffset - deltaOffset, ctx.TriggerLine);
var codeCache = CreateCacheList(EditorDocument);
var ed = new EditorData
{
CaretLocation = caretLocation,
CaretOffset = caretOffset,
ModuleCode = removeChar ? EditorDocument.Editor.Text.Remove(ctx.TriggerOffset - 1, 1) : EditorDocument.Editor.Text,
SyntaxTree = Ast,
ParseCache = codeCache
};
if (EditorDocument.HasProject)
{
var cfg = EditorDocument.Project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration);
if (cfg is DProjectConfiguration)
{
var dcfg = cfg as DProjectConfiguration;
ed.GlobalDebugIds = dcfg.CustomDebugIdentifiers;
ed.IsDebug = dcfg.DebugMode;
ed.DebugLevel = dcfg.DebugLevel;
ed.GlobalVersionIds = dcfg.GlobalVersionIdentifiers;
double d;
ulong v;
if (Double.TryParse(EditorDocument.Project.Version, out d))
ed.VersionNumber = (ulong)d;
else if (UInt64.TryParse(EditorDocument.Project.Version, out v))
ed.VersionNumber = v;
}
else if (cfg is DubProjectConfiguration)
{
var versions = new List<string>(VersionIdEvaluation.GetOSAndCPUVersions());
var dcfg = cfg as DubProjectConfiguration;
ed.IsDebug = dcfg.DebugMode;
HandleDubSettingsConditionExtraction(versions, (dcfg.ParentItem as DubProject).CommonBuildSettings);
HandleDubSettingsConditionExtraction(versions, dcfg.BuildSettings);
ed.GlobalVersionIds = versions.ToArray();
}
}
if (ed.GlobalVersionIds == null)
{
ed.GlobalVersionIds = VersionIdEvaluation.GetOSAndCPUVersions();
}
return ed;
}
开发者ID:foerdi,项目名称:Mono-D,代码行数:58,代码来源:DResolverWrapper.cs
示例13: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion (CodeCompletionContext completionContext, char completionChar, ref int triggerWordLength)
{
var pathCompletion = HandlePathCompletion ();
if (pathCompletion != null) {
return pathCompletion;
}
return base.HandleCodeCompletion (completionContext, completionChar, ref triggerWordLength);
}
开发者ID:Therzok,项目名称:MonoDevelop.AddinMaker,代码行数:9,代码来源:AddinManifestEditorExtension.cs
示例14: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char completionChar, ref int triggerWordLength)
{
if (mCompletionEnabled && completionContext.TriggerOffset != mCacheTriggerOffset)
{
return GetCompletionList (completionContext);
}
return null;
}
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:9,代码来源:HaxeTextEditorCompletion.cs
示例15: GetCurrentParameterIndex
public int GetCurrentParameterIndex(ICompletionWidget widget, CodeCompletionContext ctx)
{
if (showCompletion)
{
return 0;
}
return -1;
}
开发者ID:tjhei,项目名称:md-haxebinding,代码行数:9,代码来源:HaxeParameterDataProvider.cs
示例16: HandleCodeCompletion
public override ICompletionDataProvider HandleCodeCompletion (
CodeCompletionContext completionContext, char completionChar, ref int triggerWordLength)
{
int pos = completionContext.TriggerOffset;
if (pos > 0 && Editor.GetCharAt (pos - 1) == completionChar) {
return HandleCodeCompletion ((CodeCompletionContext) completionContext, false, ref triggerWordLength);
}
return null;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:9,代码来源:BaseXmlEditorExtension.cs
示例17: HandleCodeCompletionAsync
public override Task<ICompletionDataList> HandleCodeCompletionAsync (CodeCompletionContext completionContext, char completionChar, CancellationToken token = default(CancellationToken))
{
var pathCompletion = HandlePathCompletion ();
if (pathCompletion != null) {
return Task.FromResult (pathCompletion);
}
return base.HandleCodeCompletionAsync (completionContext, completionChar, token);
}
开发者ID:sushihangover,项目名称:MonoDevelop.AddinMaker,代码行数:9,代码来源:AddinManifestEditorExtension.cs
示例18: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char completionChar, ref int triggerWordLength)
{
var completionDataList = new CompletionDataList();
sectionCompletion.FillCompletionList(completionDataList, completionContext, completionChar, ref triggerWordLength);
directives.FillCompletionList(completionDataList, completionContext, completionChar, ref triggerWordLength);
if(completionDataList.Count == 0)
{
return null;
}
return completionDataList;
}
开发者ID:konrad-kruczynski,项目名称:rstcompletion,代码行数:11,代码来源:RstCompletionExtension.cs
示例19: CodeCompletionCommand
public override ICompletionDataProvider CodeCompletionCommand (CodeCompletionContext completionContext)
{
int pos = completionContext.TriggerOffset;
string txt = Editor.GetText (pos - 1, pos);
int triggerWordLength = 0;
ICompletionDataProvider cp = null;
if (txt.Length > 0)
cp = HandleCodeCompletion ((CodeCompletionContext) completionContext, true, ref triggerWordLength);
return cp;
}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:11,代码来源:BaseXmlEditorExtension.cs
示例20: HandleCodeCompletion
public override ICompletionDataList HandleCodeCompletion(CodeCompletionContext completionContext, char triggerChar, ref int triggerWordLength)
{
updater.FinishUpdate();
if (!EnableCodeCompletion)
return null;
if (!EnableAutoCodeCompletion && char.IsLetter(triggerChar))
return null;
if (char.IsLetterOrDigit(triggerChar) || triggerChar == '_')
{
if (completionContext.TriggerOffset > 1){
var prevChar = document.Editor.GetCharAt(completionContext.TriggerOffset - 2);
if(char.IsLetterOrDigit(prevChar) || prevChar == '"' || prevChar == '#') // Don't trigger if we're already typing an identifier or if we're typing a string suffix (kinda hacky though)
return null;
}
}
else if (!(triggerChar==' ' ||
triggerChar == '@' ||
triggerChar == '(' ||
triggerChar == '.' ||
triggerChar == '\0'))
return null;
triggerWordLength = (char.IsLetter(triggerChar) || triggerChar=='_' || triggerChar=='@') ? 1 : 0;
// Require a parsed D source
var dom = base.Document.ParsedDocument as ParsedDModule;
if (dom == null || dom.DDom == null)
return null;
var l = new CompletionDataList();
if (D_Parser.Misc.CompletionOptions.Instance.EnableSuggestionMode)
{
l.AddKeyHandler(new SuggestionKeyHandler());
l.AutoCompleteUniqueMatch = false;
l.AutoCompleteEmptyMatch = false;
l.AutoSelect = true;
}
else
l.AddKeyHandler(new DoubleUnderScoreWorkaroundHandler());
lock(dom.DDom)
DCodeCompletionSupport.BuildCompletionData(
Document,
dom.DDom,
completionContext,
l,
triggerChar);
return l.Count != 0 ? l : null;
}
开发者ID:simendsjo,项目名称:Mono-D,代码行数:54,代码来源:EditorCompletionExtension.cs
注:本文中的MonoDevelop.Ide.CodeCompletion.CodeCompletionContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论