Vs 5 Suggestion - Code editor improvements

Post Reply
Caled
Posts: 399
Joined: Thu Apr 09, 2009 4:45 am

Vs 5 Suggestion - Code editor improvements

Post by Caled » Tue Aug 06, 2019 12:57 am

Vadi suggested if I have any feature requests that are relevant to the version 5 theme of "newbie friendliness" that I post them here.

Code editor: Currently it's functional but a bit bland. The autoformat feature is great, and the tab-completion feature... eh, well it does help me remember some of the longer commands, like registerAnonymousEve.... etc, but it gets in the way as often as it helps me.

While I am wary of suggesting that the wheel be reinvented and the script editor become a behemoth like VScode, I do feel that a few more features could help a lot, both for experienced users and newbies.
  1. Could tab-completion be a bit more intuitive? Make me hit TAB to actually complete. If I press enter, I want what I have written already, not a random one of the 6 other partial matches.
    .
  2. Could tab-completion put the ( ) on the end of the function name, with the cursor in the middle? Feels like a missed opportunity
    .
  3. Could we implement code snippets? A cleverly crafted snippet could make creating Geyser objects very quick for an experienced user, and disengage new users from the syntax, focussing them on dimensions, messages and styling it.
    .
  4. A link to the API help file for a particular command, from the command itself (i.e. maybe right-clicking 'gsub' brings up a 'open in mudlet wiki' option that opens it in a browser?
    .
  5. I very tentatively mention this: linters (is this a good idea? Is the code formatter enough? Is adding a linter just bloat?)

xanthia
Posts: 7
Joined: Wed Apr 10, 2019 10:51 am

Re: Vs 5 Suggestion - Code editor improvements

Post by xanthia » Tue Aug 06, 2019 1:16 am

Would code snippets be something like block coding (MIT Scratch etc)? Maybe without all the GUI blocks...

Caled
Posts: 399
Joined: Thu Apr 09, 2009 4:45 am

Re: Vs 5 Suggestion - Code editor improvements

Post by Caled » Tue Aug 06, 2019 1:46 am

For anyone unfamiliar with the term, I believe most IDEs have them in some form or another now. I've looked into them on sublime, atom and VScode.

Here is a gif of one in use, that I made this morning as a test, for sublime. The Sublime format snippet creation isn't too bad; it helps that there is a snippet for new snippet creation, meaning I didn't need to learn the xml-ish bits of it, just the ${3:dfdfdf} part of the syntax. Each time I have filled out a bit of information, I press TAB and it moves me to the next defined location. If something is repeated, I only have to type it once and the snippet code inserts it everywhere it has been told to do so.

I'm not actually suggesting that hundreds of snippets be created - just the framework and a selection of snippets. Other interested people like myself will no doubt create lots of snippets to flesh it out, and make them available to others. They could possibly be distributed as part of a package - you want to install my GUI package for Starmourn? I've included snippets so you can add new action bar buttons for your character's abilities.
code snippet for geyser label.gif
code snippet for geyser label.gif (383.2 KiB) Viewed 173 times
The code for the snippet itself is:

Code: Select all

<snippet>
  <content><![CDATA[
${1:label} = Geyser.Label:new({
  name = "${1:string_name}",
  x = "${3:xpos}",  y = "${4:ypos}",
  width = "${5:width}",  height = "${6:height}",
  }, ${7: container})
${1:label}:setText(${8: text on label here})
${1:label}:setStyleSheet(${9:css_here})
]]></content>
  <tabTrigger>g lab</tabTrigger>
  <description>Geyser Label</description>
  <!-- Optional: Set a scope to limit where the snippet will trigger -->
  <!-- <scope >source.python</scope > -->
</snippet>

xanthia
Posts: 7
Joined: Wed Apr 10, 2019 10:51 am

Re: Vs 5 Suggestion - Code editor improvements

Post by xanthia » Tue Aug 06, 2019 2:21 am

Nice! As someone new to it, I might not know to use TAB to move, so that could be part of the learning curve. I was thinking that if the snippet also autogenerated comments, that might help a person new to it and also help with making the code more readable as a whole?

Without additional guidance, it might still be intimidating to code with snippets, especially for someone coming with little or no background. If we are into the UX of things, context-specific comments and maybe even a different colour to highlight all the bits the user needs to fill out might go a long way.

User avatar
Vadi
Posts: 4703
Joined: Sat Mar 14, 2009 3:13 pm

Re: Vs 5 Suggestion - Code editor improvements

Post by Vadi » Tue Aug 06, 2019 4:20 am

There are all very good ideas I think that would help advanced users a good deal! We should have all of this. Language Server Support would help a good deal too.

From the perspective of a newbie though, auto-completion on a function isn't going to help because you don't know what any of those mean.

I think for the newbie focus we should have the examples we have on the wiki right inside the client so people have to search less for them. Perhaps as snippet-based, that makes sense.

A linter is good too, but most messages they'd give - just like error messages from Lua - make zero sense to your usual newbie. I want to have one though.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests