cpeditor / QCodeEditor

Qt Code Editor widget. Now deprecated and will no longer be maintained by the CP Editor team.
MIT License
21 stars 4 forks source link

Add Auto complete Function Parsing #6

Open ouuan opened 4 years ago

ouuan commented 4 years ago

Is your feature request related to a problem? Please describe.

QCodeEditor has many problems, see the issues.

Describe the solution you'd like

Use QScintilla as the editor.

Describe alternatives you've considered

Improve QCodeEditor.

Additional context

It's been discussed on Telegram, open here just for tracking.

caretaker-claire[bot] commented 4 years ago

Hi ouuan Thanks for Opening a new Issue here. I will also thank you for strictly following the Issue Templates. I will add an appropriate tag to your Issue.

Have Patience, One of our Cool Contributors will help you soon.

ouuan commented 4 years ago

In fact, I'd like to write a Chinese blog to introduce CP Editor to others as soon as the new editor is done. I think QCodeEditor has too many problems that I can't persuade people to use CP Editor.

coder3101 commented 4 years ago

Yeah sure. I will surely work on implementing this ASAP.

coder3101 commented 4 years ago

Work in Progress : On branch scintilla.

There are some features that may not work with scintilla like themes, so for now scintilla will only have Default white theme

ouuan commented 4 years ago

We can add themes manually, though that's a big work. I think it's necessary to support at least one dark theme first.

coder3101 commented 4 years ago

Yeah, first let me make it fully functional then we will work on UI aspect of it

coder3101 commented 4 years ago

QScintilla will be an addition and QCodeEditor will not go anywhere. User will have choice to use one of the two editors, however change of editor will require the restart to take effect.

ouuan commented 4 years ago

image

image

(from Telegram private messages)

coder3101 commented 4 years ago

This needs to become optional, I will still work on this and add as optional feature.

coder3101 commented 4 years ago

We are continuing to use this editor but since language server will offer auto-complete and other stuff, it is better that our editor gets these features now

coder3101 commented 4 years ago

Error highlighting is done!

newly added API to handle error highting are:

    /**
     * @brief squiggle Puts a underline squiggle under text ranges in Editor
     * @param level defines the color of the underline depending upon the severity
     * @param tooltipMessage The tooltip hover message to show when over selection.
     * @note QPair<int, int>: first -> Line number in 1-based indexing
     *                        second -> Character number in 0-based indexing
     */
    void squiggle(QCodeEditor::SeverityLevel level, QPair<int, int> startLocation, QPair<int, int> stopLocation, QString tooltipMessage);

    /**
     * @brief clearSquiggle, Clears complete squiggle from editor
     */
    void clearSquiggle();

If you use Language Server with these API, make sure to increment the line number received by LSP before passing for highlighting because of LSP sends the responses with 0-based indexing.