Discord
Login
Community
DARK THEME

CODE COMPLETION

Hey guys, I wanted to implement the code completion. The basics didnt sound crazy to implement.

Add:

@editor.getSession().setOptions
      tabSize: 2 
      useSoftTabs: true
      useWorker: false # disables lua autocorrection ; preserves syntax coloring
      enableBasicAutocompletion: true
      enableSnippets: true
      enableLiveAutocompletion: true

but -> not working

So I was asking Copilot, GPT and found some Stackoverflow answers (https://stackoverflow.com/questions/13545433/autocompletion-in-ace-editor)

The main things always said:

  • <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.12/ext-language_tools.js"></script> (Copilot/GPT)
  • require('ace/ext/language_tools'); (Stack)
  • <script src="ace/ext-language_tools.js"></script>; (Stack)
  • <script src="ace/ext-language_tools.js"></script>; (Stack)

-> Changes have to be inside the HTML (-> here I was lost, bc microscript uses pugs mostly)

unfortunatly, I'm not too deep into the microscript code. I hope some of u guys can fix the error.

Addive "cool to know": You can create own variables for codeCompletion

enableBasicAutocompletion: [{
    getCompletions: (editor, session, pos, prefix, callback) => {
      // note, won't fire if caret is at a word that does not have these letters
      callback(null, [
        {value: 'hello', score: 1, meta: 'some comment'},
        {value: 'world', score: 2, meta: 'some other comment'},
      ]);
    },
  }],

in tag textarea - it's possible that it doesn't work because of the lack of an attribute called "autocomplete="on"" because I don't see it in the page code >>> https://www.dofactory.com/html/textarea/autocomplete

https://phuoc.ng/collection/mirror-a-text-area/add-autocomplete-to-your-text-area/ << here is an example for a static word list.

Hey, I got it working on my pc. PR is on github so Auto Compilation will be part of Microstudio soon.

@KingLauri200

enter the github name of the project

official microstudio? https://github.com/pmgl/microstudio

to your fork - if you already have .

Go on my github :) I'm currently on mobile sry. Edit this later on

@Logginus

https://github.com/haase-laurenz/microstudio

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community