craftercms / craftercms

Parent project for Crafter CMS. Issue tracking across all repositories and global builds.
GNU General Public License v3.0
287 stars 98 forks source link

[studio-ui] code editor autocomplete is too greedy #3536

Closed russdanner closed 2 years ago

russdanner commented 4 years ago

Describe the bug

Code editor auto complete is too aggressive and replaces in code that user is typing. This is hard to describe in written form but I have captured a video of some of the basic issues.

https://www.loom.com/share/cc851300487342278b1b3c2e56420622

To Reproduce

Steps to reproduce the behavior:

  1. Go to any site with a freemarker template
  2. Open the template editor and work with the code editor. See video for basic scenarios.

Expected behavior

Screenshots

https://www.loom.com/share/cc851300487342278b1b3c2e56420622

Specs

Version

Build Number: 31df362f307966926633b458806695069f844f77
Build Date/Time: 10-15-2019 13:54:42 -0400

OS

Any

Browser

Any

jvega190 commented 4 years ago

https://github.com/craftercms/studio-ui/pull/1350

jvega190 commented 4 years ago

@russdanner autocomplete issues were because of the editor version, I updated it to the newest version and issues like the autocomplete options still showing after closing a tag are gone. Also the autocomplete for studio examples is better (it was not accurate before), now you can type something like if, loop, studio-support etc and it will show better matches (it looks for studio snippets labels). Since we're completely relying on editor config things like <@ <# or ${ can't be added yet (unless they're part of the snippet label).

Please give it a try with the new version and let me know how it goes (I'll assign when PR is merged)

russdanner commented 4 years ago

https://www.loom.com/share/a7d0daa50a3f4532ba837e80cedf4aa3 Jose have a look at this feedback. I still feel like the autocomplete needs work. I think if we are going to make suggestions they need to be contextually and syntactically correct otherwise we're create too much noise and it's more harmful than helpful.

Much better though!

jvega190 commented 4 years ago

studio-ui: https://github.com/craftercms/studio-ui/pull/1359 studio: https://github.com/craftercms/studio/pull/1798

jvega190 commented 4 years ago

@russdanner Issue when trying to add a specific variable is fixed now. After a discussion with @rart, we decided to make the autocomplete options configurable from the code-editor-config.xml file, adding the option to disable the live autocomplete and leave autocomplete only on Ctrl + space, or disabled autocomplete at all.

rart commented 4 years ago

Latest version of ace breaks studio due to the publishing of require/define to the global scope. 😕

@jvega190 please update to use the no conflict min build of ace: https://github.com/ajaxorg/ace-builds/

jvega190 commented 4 years ago

@rart done, updated to min no conflict build https://github.com/craftercms/studio-ui/pull/1362

sumerjabri commented 4 years ago

@jvega190 please check in with @rart regarding the commenting out of settings in BPs, we would like them to be commented out and the light|dark comment removed, as shown below:

<code-editor-config>
  <!--
  <theme>light</theme>
  <enable-basic-autocompletion>true</enable-basic-autocompletion>
  <enable-live-autocompletion>true</enable-live-autocompletion>
  <font-size>11pt</font-size>
  <tab-size>4</tab-size>
  -->
  <snippets>
    <!--
    <snippet>
      <key>freemarker-example</key>
      <label>Freemarker Example</label>
      <type>freemarker</type>
      <content>
        <![CDATA[
        <#assign imageSrc = contentModel.image!"" />
        ]]>
      </content>
    </snippet> 
    -->
  </snippets>
</code-editor-config>
jvega190 commented 4 years ago

https://github.com/craftercms/studio/pull/1807 Editor configuration updated

russdanner commented 4 years ago

I don't think giving the blueprint the ability to configure the feature solves the issue (although that is a useful feature.) I think we should move this ticket to 3.1.5 and continue to improve the type-ahead rules.

russdanner commented 4 years ago

I've lowered the priority and changed the type of issue to enhancement now that we've added the ability to configure the feature on/off.

russdanner commented 2 years ago

This feature has been disabled