本文整理汇总了C#中CompletionItem.PrettyFormatType方法的典型用法代码示例。如果您正苦于以下问题:C# CompletionItem.PrettyFormatType方法的具体用法?C# CompletionItem.PrettyFormatType怎么用?C# CompletionItem.PrettyFormatType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CompletionItem
的用法示例。
在下文中一共展示了CompletionItem.PrettyFormatType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAutoComplete
public void UpdateAutoComplete(string text, bool isBackspace)
{
if (!isEnabled) return;
if (text == "\n" || text == "\b" || (text == "" && !isBackspace)) {
return;
}
if (text.Length > 1) {
HideBox();
return;
}
UIDELine line = editor.doc.LineAt(editor.cursor.posY);
UIDEElement element = GetCursorElement();
if (!genericMode) {
if (text == "(") {
StartShowTooltip(editor.cursor.GetVectorPosition(),true);
dontShowToolTipAgain = true;
cancelTooltip = false;
}
if (text == ")" || isBackspace) {
if (isShowingMethodOverloadTooltip) {
HideToolTip();
}
if (!isBackspace) {
cancelTooltip = true;
}
}
if (text == " " && (editor.extension == ".cs" || editor.extension == ".js")) {
Vector2 lastWordPos = editor.doc.IncrementPosition(editor.cursor.GetVectorPosition(),-1);
lastWordPos = editor.doc.IncrementPosition(lastWordPos,-1);
//lastWordPos = editor.doc.GoToEndOfWhitespace(lastWordPos,-1);
UIDEElement newElement = editor.doc.GetElementAt(lastWordPos);
if (newElement != null && newElement.rawText == "new") {
Vector2 newWordStart = lastWordPos;
newWordStart.x = line.GetElementStartPos(newElement);
Vector2 leadingCharPos = editor.doc.IncrementPosition(newWordStart,-1);
leadingCharPos = editor.doc.GoToEndOfWhitespace(leadingCharPos,-1);
char leadingChar = editor.doc.GetCharAt(leadingCharPos);
if (leadingChar == '=') {
Vector2 wordStartPos = editor.doc.IncrementPosition(leadingCharPos,-1);
wordStartPos = editor.doc.GoToEndOfWhitespace(wordStartPos,-1);
string str = "";
UIDEElement firstNonWhitespaceElement = line.GetFirstNonWhitespaceElement();
if (editor.extension == ".js" && firstNonWhitespaceElement != null && firstNonWhitespaceElement.rawText == "var") {
Vector2 typeStart = editor.doc.GoToNextRealChar(wordStartPos,':',-1);
if (typeStart.y == wordStartPos.y) {
typeStart = editor.doc.IncrementPosition(typeStart,1);
typeStart = editor.doc.GoToEndOfWhitespace(typeStart,1);
if (typeStart.x < wordStartPos.x) {
str = line.rawText.Substring((int)typeStart.x,(int)wordStartPos.x-(int)typeStart.x+1);
str = str.Replace(" ","");
str = str.Replace("\t","");
str = str.Replace(".<","<");
}
}
}
else {
str = editor.syntaxRule.ResolveExpressionAt(wordStartPos,-1);
}
ChainResolver sigChainResolver = new ChainResolver(editor,editor.cursor.GetVectorPosition());
ChainItem item = null;
item = sigChainResolver.ResolveChain(str,false);
if (item != null && item.finalLinkType != null) {
CompletionItem cItem = new CompletionItem(item.finalLinkType);
if (cItem != null) {
string[] usingNamespaces = editor.syntaxRule.GetNamespacesVisibleInCurrentScope(editor.cursor.GetVectorPosition());
string[] chainNamespaces = editor.syntaxRule.GetNamespaceChain(editor.cursor.GetVectorPosition());
cItem.name = cItem.PrettyFormatType(false,usingNamespaces,chainNamespaces);
//Debug.Log(cItem.genericArguments[0].resultingType);
itemList = new List<CompletionItem>();
itemList.Add(cItem);
selectedIndex = 0;
ShowBox();
}
}
return;
}
}
}
}
if (element != null) {
isDot = element.tokenDef.HasType("Dot");
isWord = element.tokenDef.HasType("Word");
isWhiteSpace = element.tokenDef.HasType("WhiteSpace");
bool isDotOrWord = isDot||isWord;
autoCompleteKey = element.rawText;
int elementPos = line.GetElementStartPos(element);
bool isChain = false;
if (isDot) {
isChain = true;
//.........这里部分代码省略.........