ENIGMA Forums

Contributing to ENIGMA => Proposals => Topic started by: polygone on February 19, 2011, 11:16:46 pm

Title: Script Editor Features
Post by: polygone on February 19, 2011, 11:16:46 pm
While Josh and Ism are currently working on the script editor post any features or suggestions for it here.

Please number your suggestions so they are easier to reply to.

If you come up with more suggestions after you have already posted, start a new post and continue your numbering where you left off. This way, suggestions can be identified by Username#SuggestionNumber.
Title: Re: Script Editor Features
Post by: polygone on February 19, 2011, 11:48:48 pm
1) Options for all features, very important for me. Like being able to turn off line numbering, any highlighting features added, change highlighting colours etc.

2) Automatic syntax checking when closing the editor, warns user upon syntax error.

3) Bracket highlight colouring feature. For example upon hotkey it would look like this:

{
  text, text, text
  {
    text, text, text
    text
    {
       text, text, text, text
    }
  }
  text
  text
  {
     text
  }
}

Also an alternative for brackets and strings. This is perhaps the best way to visually see things in my opinion.

4) Smart code snippet feature. For example you can put whatever common code snippet pieces in a text file you wish, like:

for (i = 0; i < $; i += 1)
{
$
}

then upon a hotkey it insert the code snippet into the editor, like:

for (i = 0; i < ; i += 1)
{

}

and moves the cursor automatically to the first $ sign for typing, then upon another hotkey it moves to the second $ sign then to the end of the snippet piece. Not sure how it's best to choose from different code snippets from the hotkey, ideally upon the hotkey press the user should be able to see the different code snippet choices (without it getting in the way) then can press corresponding key to insert a snippet.

5) Add a help menu so a user can see all the script editor hotkeys easily.

6) Feature to indent/unindent selected lines a certain amount of space

7) CTRL selecting, allowing to select multiple text at once.

8) Math calculations. For example you highlight 2 + 3 press a hotkey it changes it to 5, or highlight 34*5 it changes it to 170.

I'll probably think of more things. Feel free to shoot them down, I don't think any suggestions through :)
Title: Re: Script Editor Features
Post by: IsmAvatar on February 20, 2011, 02:11:58 am
1) Line numbering very easy to turn off. Will certainly be an option. Syntax colors will be customizable.
2) This is a LGM feature request, and is not relevant to the code editor. Fairly easy to implement regardless of how the editor is coded.
3) I think we'll be sure to highlight matching brackets at the least. Your suggestion will be considered.
4) Inserting snippets is mostly an LGM feature request, as is adjusting the caret to the first auto-caret. However, dealing with the next auto-caret points may be tricky. Namely, whatever symbol you use would need to either be left in, or removed and remembered somehow.
5) Help stuff won't be implemented until near completion, but your suggestion will be considered.
6) Probably already in the works.
7) Hmm... Might be possible.
8) Interesting one. I believe this would mostly be an LGM feature request.
Title: Re: Script Editor Features
Post by: Fede-lasse on February 20, 2011, 04:50:23 am
I have some suggestions. Note that they should be options, not enforced.

1. When you copy and paste a code from somewhere, the editor automatically formats the code according to the rules set by the user in LateralGM.

2. Allow the user to use tabs in the auto-formatting script rather than spaces.

3. When you select several lines of code and start from the longest line, the editor shouldn't violently jump all the way back to the left when moving the mouse out of the long line. What if I just wanted to select a snippet of the code in that line? This happens all the time in GM. It should only move left or right when you move the mouse to the side of editor window. Moving up and down is still done the traditional way, though.

4. The code editor checks the syntax X seconds after the user stops typing.
Title: Re: Script Editor Features
Post by: luiscubal on February 20, 2011, 09:18:31 am
Some of these are LGM, some are code editor, some are a combination:
Title: Re: Script Editor Features
Post by: RetroX on February 20, 2011, 10:56:13 am
At this point, can we just have an external code editor option?  Geany has all of these and it would be nice to have them before they're actually implemented.
Title: Re: Script Editor Features
Post by: IsmAvatar on February 20, 2011, 12:44:12 pm
I have some suggestions. Note that they should be options, not enforced.

1. When you copy and paste a code from somewhere, the editor automatically formats the code according to the rules set by the user in LateralGM.

2. Allow the user to use tabs in the auto-formatting script rather than spaces.

3. When you select several lines of code and start from the longest line, the editor shouldn't violently jump all the way back to the left when moving the mouse out of the long line. What if I just wanted to select a snippet of the code in that line? This happens all the time in GM. It should only move left or right when you move the mouse to the side of editor window. Moving up and down is still done the traditional way, though.

4. The code editor checks the syntax X seconds after the user stops typing.

1: This is a later-down-the-road suggestion. We'll consider it.
2: Probably will be implemented as an option when we get there.
3: I think we resolved this by allowing the caret to remain in virtual post-line space, but be drawn at min(caret.x,line.length).
4: Sounds easy enough.

Some of these are LGM, some are code editor, some are a combination:
  • Expand/Collapse brackets (), {}, [], begin/end
  • Fix indenting
  • Refactoring(Rename variable, Rename Script, Extract Method)
  • Auto-complete - see MonoDevelop for ideas(for instance, in MD "Case" matches "camelCase", etc.)
    • If the above situation about camelCase is accepted, then some customization would be nice(camelCase vs underline_separated, etc.)
  • Breakpoints
  • Tab indents selection(in GM, tab doesn't indent selection, it replaces it)
    • Shift+Tab unindents selection(or current line, or whatever)
  • Script documentation support(Like /** @argument0 Instance to receive foobar */)
  • Code style editing(replace begin/end by {} and vice-versa, remove all then statements, add ; to the end of lines where a ; is implicit, remove all unneeded ;, option to convert all "if (foo) stmt;" to "if (foo) { stmt; }", etc.) Note that after applying ANY of these changes, the code effect should be EXACTLY the same. This is an important detail to consider when implementing ; addition/removal.
  • Code warnings like Eclipse and NetBeans and auto-fix.
  • Option to auto-remove whitespaces at end of lines

1: Obviously planned.
2: Define "fix"
3: In consideration for later.
4: Will require clarification/investigation. The LGM code editor already has Ctrl+Space which looks for function names matching the typed text or abbreviated by it (e.g. sm<ctrl+space> suggests show_message)
5: Will consider for later.
6: Obviously planned.
7: Will consider for later.
8: In consideration for later. Will mostly be the job of ENIGMA, I believe.
9: In consideration for later.
10: Good idea.

At this point, can we just have an external code editor option?  Geany has all of these and it would be nice to have them before they're actually implemented.
Already an option. Preferences property "externalScriptEditorCommand" in LateralGM. By default, it's set to NULL indicating 'use internal'. Can be overridden by Java preferences (I posted a tutorial on how to do that manually somewhere. Not sure where now, though.)
Title: Re: Script Editor Features
Post by: luiscubal on February 20, 2011, 12:52:05 pm
2. As in, right click to open the popup menu, click "Fix Indenting", then LGM just fixes the document indentation to fit the user preferences.
4. Auto-complete should additionally recognize local variables. Having it recognize other variables(such as self.foo and global.bar) would be nice, but I understand this could be incredibly hard to implement.
Title: Re: Script Editor Features
Post by: RetroX on February 20, 2011, 02:26:04 pm
Already an option. Preferences property "externalScriptEditorCommand" in LateralGM. By default, it's set to NULL indicating 'use internal'. Can be overridden by Java preferences (I posted a tutorial on how to do that manually somewhere. Not sure where now, though.)
So, erm, is there a way to actually make a menu to change this? :V
Title: Re: Script Editor Features
Post by: Rusky on February 20, 2011, 03:23:56 pm
Continuous syntax checking, as in GM8's code editor and many IDEs, rather than just on close.
Title: Re: Script Editor Features
Post by: IsmAvatar on February 20, 2011, 07:27:14 pm
luiscubal
2: What you are describing sounds like an aspect of Code Formatting. It's already in consideration for the later stages.
4: Good idea for the later stages.

RetroX
Too lazy to make one. Get me a Java code monkey to write one. Until then: http://enigma-dev.org/docs/Wiki/Overriding_settings

Rusky
Please see Fede-lasse #4
Title: Re: Script Editor Features
Post by: Fede-lasse on February 22, 2011, 12:25:06 pm
A few more suggestions:
5. "Start screen" somewhat like the ones seen in Flash (http://flashthusiast.com/wp-content/uploads/2008/09/full-interface-with-start-screen.jpg), Flash Builder (http://www.codeproject.com/KB/books/Flex/01fig06.jpg), and Visual Studio (http://geekswithblogs.net/images/geekswithblogs_net/hancheng/Visual%20Studio%202010%20Beta%202/VisualStudio2010_StartPage.jpg). EDIT: Woops, not a code editor suggestion. Oh well, thou shall remember.
6. Code snippets feature, kind of like the one in GM. The snippets (title + code) should be stored in an easy-to-find text file and you should be able to insert more snippets.
7. Being able to minimize code into single lines that you can unzip by clicking the plus, like in Notepad++.
7a. #region
8. Tabs, like in Notepad++ and Visual Studio. This will allow for multiple code windows to be open and maximized at the same time.
8a. Save, Save all, Cancel, Cancel all, Minimize, Minimize all, etc. if the above suggestion is implemented.
Title: Re: Script Editor Features
Post by: luiscubal on February 22, 2011, 02:45:07 pm
Quote
8. Tabs, like in Notepad++ and Visual Studio. This will allow for multiple code windows to be open and maximized at the same time.
I think it would be a mistake to add this to the code editor. Tabs shouldn't be a code editor feature, but rather LGM.
So any "tabs" system should be shared with room editors, object editors, etc.
Title: Re: Script Editor Features
Post by: IsmAvatar on February 23, 2011, 02:06:49 pm
Fede-lasse
6: Please see Polygon#4 (http://enigma-dev.org/forums/index.php?topic=758.msg8637#msg8637")
7: Code folding is already planned.
7a: Wut?
8: This is an already existing LGM feature request, and it would extend to all maximized resource frames, not just code editors.
Title: Re: Script Editor Features
Post by: luiscubal on February 23, 2011, 03:05:06 pm
Quote
7a: Wut?
MSDN documentation (http://msdn.microsoft.com/en-us/library/9a1ybwek%28v=vs.71%29.aspx)
Title: Re: Script Editor Features
Post by: IsmAvatar on February 23, 2011, 03:25:17 pm
Ah, ok. We'll consider custom indentation folding. Usually this would be simply achieved by surrounding the code with curly brackets.
Title: Re: Script Editor Features
Post by: luiscubal on February 23, 2011, 04:45:22 pm
You mean custom folding.
Title: Re: Script Editor Features
Post by: RetroX on February 25, 2011, 12:18:52 pm
Ah, ok. We'll consider custom indentation folding. Usually this would be simply achieved by surrounding the code with curly brackets.
Code: [Select]
{
  int x;
  int main(int argc, char** argv)
  {
    return 0;
  }
}
Doesn't work.

Better idea:
Code: [Select]
#if 1
  int x;
  int main(int argc, char** argv)
  {
    return 0;
  }
#endif
Title: Re: Script Editor Features
Post by: IsmAvatar on February 25, 2011, 12:40:23 pm
That's only applicable in Definitions.
Title: Re: Script Editor Features
Post by: RetroX on February 25, 2011, 12:49:30 pm
Well, you still have scope errors.  What if you initialise a variable and want to use it after the block?
Title: Re: Script Editor Features
Post by: IsmAvatar on February 25, 2011, 03:04:08 pm
That's a good point. Ok, we'll consider custom folding around #something.
Title: Re: Script Editor Features
Post by: Josh @ Dreamland on February 25, 2011, 05:59:52 pm
We may as well run with #region for ENIGMA's use, but we'll want to generalize it. Maybe with an interface for seeking to different regions.
Title: Re: Script Editor Features
Post by: polygone on July 17, 2011, 07:43:49 pm
actually never mind make it default :p
Title: Re: Script Editor Features
Post by: IsmAvatar on July 18, 2011, 11:34:29 pm
Personally I was thinking Ctrl+I to indent and Ctrl+Shift+I to unindent, but I guess the key bindings could be negotiable.

Also, despite the indefinite postponement of this particular project, it's on the backburner, but not totally dead. It may yet see a resurrection, and I figured if it does, it'd be nice to have a guideline of features the users would like to see all gathered in a nice centralized location.

After all, it's a feature of LGM that is sorely lacking. At some point, it will have to be dealt with.
Title: Re: Script Editor Features
Post by: RetroX on July 19, 2011, 12:49:49 pm
Indenting should be possible with Tab and Shift+Tab.  At least, via preference.