Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Auto complete Function Parsing #6

Open
ouuan opened this issue Jan 19, 2020 · 11 comments
Open

Add Auto complete Function Parsing #6

ouuan opened this issue Jan 19, 2020 · 11 comments
Assignees
Labels
enhancement New feature or request

Comments

@ouuan
Copy link
Member

ouuan commented Jan 19, 2020

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
Copy link

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
Copy link
Member Author

ouuan commented Jan 19, 2020

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
Copy link
Member

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

@coder3101
Copy link
Member

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
Copy link
Member Author

ouuan commented Jan 21, 2020

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
Copy link
Member

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

@coder3101
Copy link
Member

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
Copy link
Member Author

ouuan commented Jan 29, 2020

image

image

(from Telegram private messages)

coder3101 referenced this issue in cpeditor/cpeditor Feb 5, 2020
The submodule is changed to ouuan/QCodeEditor. See its commit messages
for more information. It took the place of ExtendedEditorFeatures.

Basically, some improvements, incluing these actions are added:

/**
 * @brief Slot, that indent the selected lines.
 */
void indent();

/**
 * @brief Slot, that unindent the selected lines.
 */
void unindent();

/**
 * @brief Slot, that swap the selected lines up.
 */
void swapLineUp();

/**
 * @brief Slot, that swap the selected lines down.
 */
void swapLineDown();

/**
 * @brief Slot, that delete the selected lines.
 */
void deleteLine();

/**
 * @brief Slot, that toggle single line comment of the
 * selected lines.
 */
void toggleComment();

/**
 * @brief Slot, that toggle block comment of the selection.
 */
void toggleBlockComment();

The responding actions are added in appwindow in this commit.

The name of some widgets are also corrected in `appwindow.ui`.
@coder3101
Copy link
Member

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

@coder3101 coder3101 changed the title Use QScintilla as the editor Enable auto-complete and Error in the editor Feb 23, 2020
@coder3101
Copy link
Member

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 coder3101 transferred this issue from cpeditor/cpeditor Feb 23, 2020
@coder3101 coder3101 added the enhancement New feature or request label Feb 23, 2020
@coder3101
Copy link
Member

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.

@coder3101 coder3101 changed the title Enable auto-complete and Error in the editor Add Auto complete Function Parsing Jun 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants