예제 #1
0
 public AvalonEditCodeEditor()
 {
     completionDatas =
         AutocompletionData.ConvertAutocompleteItemsToCompletionDatas(
             AutocompletionData.GetAutocompleteItemsForScripting());
     InitializeComponent();
     _documents =
         new Dictionary <string, TextDocument>();
     TextArea.TextView.LineTransformers.Add(_offsetColorizer);
 }
예제 #2
0
 public AvalonEditCodeEditor(ISharedViewState sharedViewState, IFunctionsDetails functionsDetails)
 {
     _sharedViewState = sharedViewState;
     completionDatas  =
         CompletionDataConverter.ConvertAutocompleteItemsToCompletionDatas(
             AutocompletionData.GetAutocompleteItemsForScripting(functionsDetails));
     InitializeComponent();
     _documents =
         new Dictionary <string, TextDocument>();
     TextArea.TextView.LineTransformers.Add(_offsetColorizer);
 }
        private void SetupAutocomplete()
        {
            var array = AutocompletionData.GetAutocompleteItemsForScripting(_functionsDetails);


            //if (Sort)
            //   Array.Sort(array2, (a, b) => a.Text.CompareTo(b.Text));
            //_autocompleteMenu.SetAutocompleteItems(array2);

#if SCINTILLA_23
            AutoComplete.List.Clear(); //2.3
            foreach (var t in array2)
            {
                AutoComplete.List.Add(t.Text);
            }
            AutoComplete.List.AddRange(new[]
                                       { "real", "complex", "function", "var", "void", "string", "integer", "natural" });
            AutoComplete.List.Sort();

            AutoComplete.IsCaseSensitive = false;
            AutoComplete.AutoHide        = true;
            //this.AutoComplete.StopCharacters += '·';
            // this.AutoComplete.StopCharacters = this.AutoComplete.StopCharacters.Replace(GlobalConfig.dotSymbol+"","");
            // this.AutoComplete.FillUpCharacters += GlobalConfig.dotSymbol;
            // MessageBox.Show(this.AutoComplete.FillUpCharacters);
            // MessageBox.Show(this.AutoComplete.StopCharacters);

            //this.AutoComplete.StopCharacters = GlobalConfig.dotSymbol+"";
            AutoComplete.FillUpCharacters       = AutoComplete.FillUpCharacters.Trim('[', '(', '.', SpecialSymbols.dotSymbol);
            AutoComplete.AutomaticLengthEntered = true;
#elif SCINTILLA_30
            var acList = new List <string>();
            acList.AddRange(array.Select(t => t.Text));

            var sb = new StringBuilder();
            foreach (var item in acList)
            {
                sb.AppendFormat("{0} ", item);
            }
            sb.Remove(sb.Length - 1, 1);

            _autoCompleteList = sb.ToString();


            AutoCAutoHide   = true;
            AutoCIgnoreCase = true;
#endif
        }
        public AvalonEditCodeEditorControl()
        {
            _codeEditor = new AvalonEditCodeEditor();

            BackColor = Color.White;
            Dock      = DockStyle.Fill;
            Child     = _codeEditor;
            //   codeEditor.TextArea.TextView.GetVisualPosition(new TextViewPosition(5) {Location = }, VisualYPosition.TextMiddle)
            _autocompleteMenu = new AutocompleteMenu.AutocompleteMenu
            {
                TargetControlWrapper = new AvalonWrapper(this)
            };
            _autocompleteMenu.SetAutocompleteItems(AutocompletionData.GetAutocompleteItemsForScripting());
            SetFont(Settings.Default.ScriptingFont);

            _autocompleteMenu.MaximumSize = new Size(500, 180);
            //this.codeEditor.Document.
        }
 public ScintillaCodeEditorControl(ISharedViewState sharedViewState, IFunctionsDetails functionsDetails)
 {
     _sharedViewState  = sharedViewState;
     _functionsDetails = functionsDetails;
     _autocompleteMenu = new AutocompleteMenu.AutocompleteMenu(sharedViewState, _functionsDetails)
     {
         TargetControlWrapper = new ScintillaWrapper(this),
         MaximumSize          = new Size(500, 180)
     };
     _autocompleteMenu.SetAutocompleteItems(AutocompletionData.GetAutocompleteItemsForScripting(_functionsDetails));
     //_autocompleteMenu.CaptureFocus = true;
     InitializeComponent();
     // this.BorderStyle=BorderStyle.None;
     Dock         = DockStyle.Fill;
     _documents   = new Dictionary <string, Document>();
     SizeChanged +=
         (o, e) =>
     {
         _autocompleteMenu.MaximumSize = new Size(Size.Width, _autocompleteMenu.MaximumSize.Height);
     };
 }
        public void TestScripting()
        {
            var content = AutocompletionData.GetAutocompleteItemsForScripting(new FunctionsDetails());

            Assert.IsNotNull(content);
        }