📄 attributesdataprovider.cs
字号:
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision: 915 $</version>
// </file>
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.TextEditor.Document;
using ICSharpCode.TextEditor;
using ICSharpCode.SharpDevelop.Dom;
using ICSharpCode.TextEditor.Gui.CompletionWindow;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
{
/// <summary>
/// Provides code completion for attribute names.
/// </summary>
public class AttributesDataProvider : CtrlSpaceCompletionDataProvider
{
public AttributesDataProvider()
: this(ExpressionContext.TypeDerivingFrom(ProjectContentRegistry.Mscorlib.GetClass("System.Attribute"), true))
{
}
public AttributesDataProvider(ExpressionContext context) : base(context)
{
this.ForceNewExpression = true;
}
bool removeAttributeSuffix = true;
public bool RemoveAttributeSuffix {
get {
return removeAttributeSuffix;
}
set {
removeAttributeSuffix = value;
}
}
public override ICompletionData[] GenerateCompletionData(string fileName, TextArea textArea, char charTyped)
{
ICompletionData[] data = base.GenerateCompletionData(fileName, textArea, charTyped);
if (removeAttributeSuffix) {
foreach (ICompletionData d in data) {
if (d.Text.EndsWith("Attribute")) {
d.Text = d.Text.Substring(0, d.Text.Length - 9);
}
}
}
return data;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -