本文整理汇总了C#中IHighlightingDefinition类的典型用法代码示例。如果您正苦于以下问题:C# IHighlightingDefinition类的具体用法?C# IHighlightingDefinition怎么用?C# IHighlightingDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHighlightingDefinition类属于命名空间,在下文中一共展示了IHighlightingDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PythonConsoleHighlightingColorizer
/// <summary>
/// Creates a new HighlightingColorizer instance.
/// </summary>
/// <param name="ruleSet">The root highlighting rule set.</param>
public PythonConsoleHighlightingColorizer(IHighlightingDefinition highlightingDefinition, TextDocument document)
: base(new DocumentHighlighter(document, highlightingDefinition ))
{
if (document == null)
throw new ArgumentNullException("document");
this.document = document;
}
开发者ID:jmd,项目名称:ironlab,代码行数:11,代码来源:PythonConsoleHighlightingColorizer.cs
示例2: GetCompletionDatas
public IList<ICompletionData> GetCompletionDatas(IHighlightingDefinition language) {
if (language == null) return null;
if (dataDict.ContainsKey(language)) return dataDict[language];
dataDict.Add(language, new List<ICompletionData>());
var datas = dataDict[language];
//以后ecp格式改用自己定义的xml格式
string path = Path.Combine( _cfgPath,language.Name);
if (Directory.Exists(path) == false) return datas;
foreach(string file in Directory.GetFiles(path)) {
using (StreamReader sr = new StreamReader(file)) {
//这里改用xmlSerialize
//To Do
try {
LoadData(datas, sr);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
continue;
}
}
}
return datas;
}
开发者ID:kaluluosi,项目名称:YGOProDevelop,代码行数:26,代码来源:SmartIntelisenceService.cs
示例3: CodeBlock
public CodeBlock(FsiSession session, IHighlightingDefinition syntaxHighlighting)
{
this.Document = new TextDocument("");
this.session = session;
this.syntaxHighlighting = syntaxHighlighting;
this.run = new RelayCommand(OnRun, CanRun);
}
开发者ID:mathias-brandewinder,项目名称:FsiRunner,代码行数:7,代码来源:CodeBlock.cs
示例4: MainWindow
public MainWindow()
{
// Load our custom highlighting definition
//IHighlightingDefinition customHighlighting;
using (Stream s = typeof(MainWindow).Assembly.GetManifestResourceStream("TestWpfC.CustomHighlighting.xshd"))
{
if (s == null)
throw new InvalidOperationException("Could not find embedded resource");
using (XmlReader reader = new XmlTextReader(s))
{
customHighlighting = ICSharpCode.AvalonEdit.Highlighting.Xshd.
HighlightingLoader.Load(reader, HighlightingManager.Instance);
}
}
// and register it in the HighlightingManager
HighlightingManager.Instance.RegisterHighlighting("Custom Highlighting", new string[] { ".cool" }, customHighlighting);
InitializeComponent();
textEditor.SyntaxHighlighting = customHighlighting;
HighlightingComboBox_SelectionChanged(null, null);
//textEditor.TextArea.TextEntering += textEditor_TextArea_TextEntering;
//textEditor.TextArea.TextEntered += textEditor_TextArea_TextEntered;
DispatcherTimer foldingUpdateTimer = new DispatcherTimer();
foldingUpdateTimer.Interval = TimeSpan.FromSeconds(2);
foldingUpdateTimer.Tick += foldingUpdateTimer_Tick;
foldingUpdateTimer.Start();
}
开发者ID:zvrkan5,项目名称:DotNetSiemensPLCToolBoxLibrary,代码行数:33,代码来源:MainWindow.xaml.cs
示例5: GetDefinition
IHighlightingDefinition GetDefinition()
{
Func<IHighlightingDefinition> func;
lock (lockObj) {
if (this.definition != null)
return this.definition;
func = this.lazyLoadingFunction;
}
Exception exception = null;
IHighlightingDefinition def = null;
try {
using (var busyLock = BusyManager.Enter(this)) {
if (!busyLock.Success)
throw new InvalidOperationException("Tried to create delay-loaded highlighting definition recursively. Make sure the are no cyclic references between the highlighting definitions.");
def = func();
}
if (def == null)
throw new InvalidOperationException("Function for delay-loading highlighting definition returned null");
} catch (Exception ex) {
exception = ex;
}
lock (lockObj) {
this.lazyLoadingFunction = null;
if (this.definition == null && this.storedException == null) {
this.definition = def;
this.storedException = exception;
}
if (this.storedException != null)
throw new HighlightingDefinitionInvalidException("Error delay-loading highlighting definition", this.storedException);
return this.definition;
}
}
开发者ID:bbqchickenrobot,项目名称:AvalonEdit,代码行数:32,代码来源:HighlightingManager.cs
示例6: Decompile
void Decompile(ModuleDef module, BamlDocument document, Language lang,
ITextOutput output, out IHighlightingDefinition highlight, CancellationToken token) {
var decompiler = new XamlDecompiler();
var xaml = decompiler.Decompile(module, document, token);
output.Write(xaml.ToString(), TextTokenType.Text);
highlight = HighlightingManager.Instance.GetDefinitionByExtension(".xml");
}
开发者ID:arkanoid1,项目名称:dnSpy,代码行数:8,代码来源:BamlResourceNode.cs
示例7: ThemedHighlightingColorizer
/// <summary>
/// Creates a new HighlightingColorizer instance.
/// </summary>
/// <param name="definition">The highlighting definition.</param>
public ThemedHighlightingColorizer(IHighlightingDefinition definition)
: this()
{
if (definition == null)
throw new ArgumentNullException("definition");
this.definition = definition;
}
开发者ID:peterschen,项目名称:SMAStudio,代码行数:12,代码来源:ThemedHighlightingColorizer.cs
示例8: ScriptEditorViewModel
public ScriptEditorViewModel(string name, string content, IHighlightingDefinition highlighting)
{
Name = name;
Content = content;
CurrentText = new StringText(content);
Highlighting = highlighting;
References = new BindableCollection<string>();
UsingStatements = new BindableCollection<string>();
}
开发者ID:Wagnerp,项目名称:scriptcs-editor,代码行数:9,代码来源:ScriptEditorViewModel.cs
示例9: ConvertTextDocumentToBlock
/// <summary>
/// Converts a readonly TextDocument to a Block and applies the provided highlighting definition.
/// </summary>
public static Block ConvertTextDocumentToBlock(ReadOnlyDocument document, IHighlightingDefinition highlightingDefinition)
{
IHighlighter highlighter;
if (highlightingDefinition != null)
highlighter = new DocumentHighlighter(document, highlightingDefinition);
else
highlighter = null;
return ConvertTextDocumentToBlock(document, highlighter);
}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:12,代码来源:DocumentPrinter.cs
示例10: SetFolding
/// <summary>
/// Determine whether or not highlighting can be
/// suppported by a particular folding strategy.
/// </summary>
/// <param name="syntaxHighlighting"></param>
public void SetFolding(IHighlightingDefinition syntaxHighlighting)
{
if (syntaxHighlighting == null)
{
this.mFoldingStrategy = null;
}
else
{
switch (syntaxHighlighting.Name)
{
case "XML":
case "HTML":
mFoldingStrategy = new XmlFoldingStrategy() { ShowAttributesWhenFolded = true };
this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
break;
case "C#":
this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
mFoldingStrategy = new CSharpBraceFoldingStrategy();
break;
case "C++":
case "PHP":
case "Java":
this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
mFoldingStrategy = new CSharpBraceFoldingStrategy();
break;
case "VBNET":
this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(this.Options);
mFoldingStrategy = new VBNetFoldingStrategy();
break;
default:
this.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.DefaultIndentationStrategy();
mFoldingStrategy = null;
break;
}
if (mFoldingStrategy != null)
{
if (this.Document != null)
{
if (mFoldingManager == null)
mFoldingManager = FoldingManager.Install(this.TextArea);
this.mFoldingStrategy.UpdateFoldings(mFoldingManager, this.Document);
}
else
this.mInstallFoldingManager = true;
}
else
{
if (mFoldingManager != null)
{
FoldingManager.Uninstall(mFoldingManager);
mFoldingManager = null;
}
}
}
}
开发者ID:joazlazer,项目名称:ModdingStudio,代码行数:62,代码来源:EdiTextEditor_Folding.cs
示例11: DocumentHighlighter
/// <summary>
/// Creates a new DocumentHighlighter instance.
/// </summary>
public DocumentHighlighter(ReadOnlyDocument document, IHighlightingDefinition definition)
{
if (document == null)
throw new ArgumentNullException("document");
if (definition == null)
throw new ArgumentNullException("definition");
this.document = document;
this.definition = definition;
InvalidateHighlighting();
}
开发者ID:AkshayVats,项目名称:SuperShell,代码行数:13,代码来源:DocumentHighlighter.cs
示例12: DocumentHighlighter
/// <summary>
/// Creates a new DocumentHighlighter instance.
/// </summary>
public DocumentHighlighter(TextDocument document, IHighlightingDefinition definition)
{
if (document == null)
throw new ArgumentNullException("document");
if (definition == null)
throw new ArgumentNullException("definition");
this.document = document;
this.definition = definition;
this.engine = new HighlightingEngine(definition.MainRuleSet);
document.VerifyAccess();
weakLineTracker = WeakLineTracker.Register(document, this);
InvalidateSpanStacks();
}
开发者ID:bbqchickenrobot,项目名称:AvalonEdit,代码行数:16,代码来源:DocumentHighlighter.cs
示例13: GetCompletionDatas
public IList<ICompletionData> GetCompletionDatas(IHighlightingDefinition language) {
if (language == null) return null;
if (datas!=null) return datas;
datas = new List<ICompletionData>();
//以后ecp格式改用自己定义的xml格式
string path = _cfgPath;
using (StreamReader sr = new StreamReader(string.Format(path, language.Name, language.Name))) {
while (sr.EndOfStream == false) {
string line = sr.ReadLine();
string[] snappets = line.Split('|');
DefaultCompletionData data;
if (snappets.Length == 2)
data = new DefaultCompletionData() { Text=snappets[0],Description=snappets[1],Content=snappets[0]};
else
data = new DefaultCompletionData() { Text = snappets[0], Content = snappets[0] };
datas.Add(data);
}
}
return datas;
}
开发者ID:kaluluosi,项目名称:YGOProDevelop,代码行数:22,代码来源:DefaultIntelisenceService.cs
示例14: RegisterHighlighting
/// <summary>
/// Registers a highlighting definition.
/// </summary>
/// <param name="name">The name to register the definition with.</param>
/// <param name="extensions">The file extensions to register the definition for.</param>
/// <param name="highlighting">The highlighting definition.</param>
public void RegisterHighlighting(string name, string[] extensions, IHighlightingDefinition highlighting)
{
if (highlighting == null)
throw new ArgumentNullException("highlighting");
lock (lockObj) {
allHighlightings.Add(highlighting);
if (name != null) {
highlightingsByName[name] = highlighting;
}
if (extensions != null) {
foreach (string ext in extensions) {
highlightingsByExtension[ext] = highlighting;
}
}
}
}
开发者ID:hazama-yuinyan,项目名称:BVEEditor,代码行数:23,代码来源:HighlightingManager.cs
示例15: SetHighlighter
/// <summary>
/// Sets the Syntax Highlighter to a specific Highlighter
/// </summary>
/// <param name="def">Highlighting Definition</param>
public void SetHighlighter(IHighlightingDefinition def)
{
String syntax;
if (this._enableHighlighting)
{
this._editor.SyntaxHighlighting = def;
syntax = (this._editor.SyntaxHighlighting == null) ? "None" : def.Name;
}
else
{
syntax = def.Name;
}
this._currSyntax = syntax;
this.SetCurrentHighlighterChecked(syntax);
this.SetCurrentValidator(syntax);
this.SetCurrentAutoCompleter(syntax);
}
开发者ID:jbunzel,项目名称:MvcRQ_git,代码行数:21,代码来源:EditorManager.cs
示例16: CreateColorizer
protected override IVisualLineTransformer CreateColorizer(IHighlightingDefinition highlightingDefinition)
{
return new NitraHighlightingColorizer(this);
}
开发者ID:hwwang,项目名称:Nitra,代码行数:4,代码来源:NitraTextEditor.cs
示例17: CreateColorizer
/// <summary>
/// Creates the highlighting colorizer for the specified highlighting definition.
/// Allows derived classes to provide custom colorizer implementations for special highlighting definitions.
/// </summary>
/// <returns></returns>
protected virtual IVisualLineTransformer CreateColorizer(IHighlightingDefinition highlightingDefinition)
{
if (highlightingDefinition == null)
throw new ArgumentNullException("highlightingDefinition");
return new HighlightingColorizer(highlightingDefinition);
}
开发者ID:rtnm,项目名称:AvalonEdit,代码行数:11,代码来源:TextEditor.cs
示例18: OnSyntaxHighlightingChanged
void OnSyntaxHighlightingChanged(IHighlightingDefinition newValue)
{
if (colorizer != null) {
this.TextArea.TextView.LineTransformers.Remove(colorizer);
colorizer = null;
}
if (newValue != null) {
colorizer = CreateColorizer(newValue);
if (colorizer != null)
this.TextArea.TextView.LineTransformers.Insert(0, colorizer);
}
}
开发者ID:rtnm,项目名称:AvalonEdit,代码行数:12,代码来源:TextEditor.cs
示例19: CreateColorizer
protected override IVisualLineTransformer CreateColorizer(IHighlightingDefinition highlightingDefinition)
{
return new CustomizableHighlightingColorizer(
highlightingDefinition.MainRuleSet,
FetchCustomizations(highlightingDefinition.Name));
}
开发者ID:OmerRaviv,项目名称:SharpDevelop,代码行数:6,代码来源:CodeEditorView.cs
示例20: OnSyntaxHighlightingChanged
void OnSyntaxHighlightingChanged(IHighlightingDefinition newValue)
{
if (colorizer != null) {
this.TextArea.TextView.LineTransformers.Remove(colorizer);
colorizer = null;
}
if (newValue != null) {
TextView textView = this.TextArea.TextView;
colorizer = new HighlightingColorizer(textView, newValue.MainRuleSet);
textView.LineTransformers.Insert(0, colorizer);
}
}
开发者ID:pusp,项目名称:o2platform,代码行数:12,代码来源:TextEditor.cs
注:本文中的IHighlightingDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论