Code Monkey home page Code Monkey logo

qcodeeditor's Introduction

Qt Code Editor Widget

It's a widget for editing/viewing code.

This project uses a resource named qcodeeditor_resources.qrc. The main application must not use a resource file with the same name.

(It's not a project from a Qt example.)

Requirements

  1. C++11 featured compiler.
  2. Qt 5.

Abilities

  1. Auto parentheses.
  2. Different highlight rules.
  3. Auto indentation.
  4. Replace tabs with spaces.
  5. GLSL completion rules.
  6. GLSL highlight rules.
  7. C++ highlight rules.
  8. XML highlight rules.
  9. JSON highligh rules.
  10. Frame selection.
  11. Qt Creator styles.

Build

It's a CMake-based library, so it can be used as a submodule (see the example). But here are the steps to build it as a static library (for external use for example).

  1. Clone the repository: git clone https://github.com/Megaxela/QCodeEditor
  2. Go into the repository: cd QCodeEditor
  3. Create a build folder: mkdir build
  4. Go into the build folder: cd build
  5. Generate a build file for your compiler: cmake ..
    1. If you need to build the example, specify -DBUILD_EXAMPLE=On on this step.
  6. Build the library: cmake --build .

Example

By default, QCodeEditor uses the standard QtCreator theme. But you may specify your own by parsing it with QSyntaxStyle. The example uses Dracula theme. (See the example for more.)

LICENSE

Library is licensed under the MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

qcodeeditor's People

Contributors

coder3101 avatar dov avatar imelker avatar knarfs avatar megaxela avatar ouuan avatar petermortensen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qcodeeditor's Issues

Feature request: Add Java highlighting

C++ and Java have much common keywords. Modifying the C++ Highlighter we can build a Java highlighter. C/C++, Java and Python are most commonly used languages and for a code editor to have three support will be good. Currently it highlights C/C++ and Python. Java is the only missing piece.

Feature request: Add yaml highlighting

YAML is also a poplular data serialization language, just like JSON and XML. I see that the latter two have been supported, could you add support for YAML.

Feature request: multi-line indent using the Tab key

If the user has a selection that spans more than 1 line and presses the Tab key, those lines are indented by 1 TAB (or a number of spaces, depending on how the editor is configured). And Shift+Tab un-indents them.

Language Server Protocol support

I'd love to see this support the Language Server Protocol, so existing LSP clients could be re-used to add intelligence to the editor :)

Remove parenthesis automagically

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

Whenever you delete an opening bracket or parentheses as a typo, it won't delete the corresponding closing bracket.

Describe the solution you'd like

Let's say the cursor is at the |
In a(|)b and a()|b, when you press Backspace, it should become ab. but in a(|bcd)e when you press Backspace it should still be a|bcd)e.

Describe alternatives you've considered
none

Additional context
none

Originally requested here cpeditor/cpeditor#42

Whitespace Visualization

Many modern code editors allow for the visualization of whitespace, in order for programmers to differentiate tabs and spaces (and sometimes carriage returns and line feeds.)

Here's an example from Neovim-qt:

Screenshot from 2020-02-21 10-38-35

Feature request: Improve Auto-indentation

The current auto indent feature only places the cursor back to last line's beginning. Like this:

Assume * represents a space or tab and | represents cursor

int main(){ <enter_key>
| }

As you can see the cursor starts back from beginning. Expected should be:

int main(){ <enter_key>
**** |
}

Such auto indentation should make the end-user less focus on rearranging the brackets and focus more on typing.

Bug: double clicking needs tons of undos

  1. write three "foo;"s in the editor;
  2. double click the word "foo", the three "foo"s will be highlighted.
  3. Press "Ctrl+Z" to undo the double-clicking, you need six "Ctrl+Z"s in total.

Double-clicking for highlighting the same words shouldn't affect the undo history.

OS: Windows 10

I'm using QCodeEditor in coder3101/cp-editor2.

Feature request: Add parameter hints

Parameter hints are very helpful, especially when writing some advanced data structures, or use unfamiliar STL functions.

I'd like something like this:

image

Wrong comment highlighting

/*
CODE HERE
//*/

The highlighting recognizes that this is a block comment and highlights the whole chunk.

However, if we add / at the start

//*
CODE HERE
//*/

CODE HERE is still highlighted even thought it should not be as it is only 2 lines comments at the start and at the end

Find and Replace

Hi, it seems there's a lack of a find + replace ui - this would be needed for any kind of word processing ui and hence this is a feature request for it.

Feature request: Find & Replace

Finding and replacing are basic functions of an editor, but seems not implemented yet.

It would be better if regexp is supported (which should be optional).

Feature Request: Add Brackets matching or highlighting

This will be good feature to add, it really annoys the end-use if they use a code editor which does not highlights which braces closes which blocks in the code, specially in the case of nested blocks.

It should be simple to add, I wish to have a behavior like this:

if(current_code_cursor_is on_braces or on_parenthesis){
    // highlight or make the matching and this current braces or parenthesis bold. 
}

Highlighting for numbers with types in C++

For example, 1ll, 1l, 1u, 1ull, 1e5 are not highlighted, but they should be.

The same for .1 and 1. (the other part omitted).

And hex numbers with letters: 0x3f, 0x3F.

Add a Pyton Keyword

Add on Python.xml under keyword

<name>el if</name>

It is quite common in Python and not listed yet.

Dead project?

I see no updates from an year and half, if so it's a pity, the project looks interesting.

Indentation for single line no braced lines

Is your feature request related to a problem? Please describe.
Whenever I am using the for loop or anything like that and not using the parenthesis then it just goes to the new line .
Like : for( int i = 0 ; i < 10 ; ++i)
*the pointer comes here .

Describe the solution you'd like
If the pointer comes here that would be nice idea .
Like : for( int i = 0 ; i < 10 ; ++i)
*if the pointer comes here that would be nice .

It would be amazing if you add this feature for automatic parenthesis like let's say we are writing some code inside an if Like this .
if( i==10)
update something .

But let's say we missed something and I want to add a new line below the update something then I must use parenthesis
if(i==10)
update something .
again doing something .
Now I need to put bracket on the both ends when in the beginning and in the end
if(i==10){
update something .
again doing something .
}

Now it will be amazing if I add only the beginning bracket and the end bracket automatic comes at the right place .

Originally requested here : cpeditor/cpeditor#63

Comment and Uncomment selection using CTRL+/

Almost all modern editor have a feature to comment and Uncomment a selection of test using CTRL+/. You should provide a default implementation of this behaviour and also a way to change the the toggle key.

Maybe a function like setToggleCommentShortcut(..); would do it. If set to nullptr means that Disable comments toggle otherwise any key combination.

Originally asked here : cpeditor/cpeditor#59

EditorConfig Support

This would probably be a bit of work, but would certainly be a nice-to-have. I think Qt supports this type of config file as well, so hopefully that'd reduce the required work.

In case anyone is unfamiliar, this is EditorConfig.

Java Highlight Support

I'll probably add this if I decide to use this library, but nonetheless it's relevant issue.

Add license file

Even though the README.md describes the license, it is common practice to add a LICENSE.md file in the top directory of the repo as well.

Bug Report : C++ Highligher Issue

For some reasons the current C++ Syntax Highlighter treats anything after / as comment. As a result following expression is mishighlighted.

int a = m/n + c-d;

Everything after, / is highlighted as comment.

A regex, issue maybe.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.