Hello,
We would like to use SyntaxEditor by providing our own programming language definition. It would be great to have the ability to feed SyntaxEditor with a language definition file. This file could be use an EBNF-like format to provide syntax coloration.
Thanks & regards,
We want to have the option to replace texts only in a selected part of the document.
Use Notepad++ as a reference to check this feature.
I do have some feedback on this component. I love it, but of course there are some areas where improvement can be made. For instance, in the screenshot below, I have highlighted some words where improvement can be made.
When using XML Tagger, XML Folding tagger with XML text document, the folding tagger freezes the UI while typing.
Generally in Visual Studio, the XML Folding tagger is processed in background while in SyntaxEditor this is done on the UI thread.
Several optimization options might be applied:
- process xml folding in background
- process folding similar to process search while typing - a period of inactivity time is needed to invalidate the search / folding
- caching - if the edit does not change the folding configuration, no processing and redrawing of folding is required
- some parts for extracting tooltip content and folded content should be optimized
The position of the popup representing the IntelliPrompt is wrong when shown on the monitor with the higher DPI scale, in a setup with two monitors with different DPI settings. For example, if one monitor has 100% DPI scale and the other 125%, the position of the popup will be wrong when the app is on the 125% monitor.
To work this around, use the Caret visual as the PlacementTarget for the popup and set its offsets to 0 after it is shown.
private void RadSyntaxEditor_PreviewKeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{
if (KeyboardModifiers.IsControlDown && e.Key == Key.Space)
{
e.Handled = true;
var editor = (RadSyntaxEditor)sender;
CaretPosition startPosition = new CaretPosition(editor.CaretPosition);
CaretPosition endPosition = new CaretPosition(editor.CaretPosition);
editor.IntelliPrompts.CompletionListWindow.Show(startPosition, endPosition);
editor.IntelliPrompts.CompletionListWindow.HorizontalOffset = 0;
editor.IntelliPrompts.CompletionListWindow.VerticalOffset = 0;
}
}
private void RadSyntaxEditor_Loaded(object sender, System.Windows.RoutedEventArgs e)
{
var editor = (RadSyntaxEditor)sender;
var caret = editor.FindChildByType<Telerik.Windows.Controls.SyntaxEditor.UI.Caret>();
editor.IntelliPrompts.CompletionListWindow.PlacementTarget = caret;
editor.IntelliPrompts.CompletionListWindow.Placement = System.Windows.Controls.Primitives.PlacementMode.Bottom;
}
RadSyntaxEditor, while inside of a virtualized RadGridView, stealings focus immediately upon loading. It appears to do this automatically and there is no configuration to disabling. Meaning when scrolling in a RadGridView with virtualized rows, when a row with the RadSyntaxEditor materializes it will automatically steal focus from other elements.
This can be worked around using custom behavior that discards the first preview keyboard focus event that it receives.
private void onPreviewGotKeyboardFocus(object s, KeyboardFocusChangedEventArgs e)
{
if (!this.SuppressAutoFocus || _wasFocusSuppressed)
{
return;
}
_wasFocusSuppressed = true;
e.Handled = true;
}The offending line of code is this in RadSyntaxEditor.InitActiveEditorPresenter:
if (flag)
{
base.Dispatcher.BeginInvoke((Action)delegate
{
Focus();
});
}Request: Add a dependency property to allow opting-out of this default behavior. The above workaround works, but is a bit hacky for something that should probably be built-in.