GithubHelp home page GithubHelp logo

codeeditapp / codeeditsourceeditor Goto Github PK

View Code? Open in Web Editor NEW
478.0 15.0 72.0 2.09 MB

A code editor view written in Swift powered by tree-sitter.

Home Page: https://codeeditapp.github.io/CodeEditSourceEditor/documentation/codeeditsourceeditor

License: MIT License

Swift 100.00%
swift tree-sitter

codeeditsourceeditor's People

Contributors

angelk90 avatar austincondiff avatar avinizhanov avatar ben-p-commits avatar denil-ct avatar denizak avatar eliulm avatar ezraberch avatar luah5 avatar lukepistrol avatar matthijseikelenboom avatar miguel-arrf avatar neil-and-void avatar prince213 avatar renangreca avatar thecoolwinter avatar wouter01 avatar yusufozgul 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  avatar  avatar  avatar

codeeditsourceeditor's Issues

🐞 Pasted text uses wrong color (black) in dark mode

Description

Pasted text is black despite using dark mode.

To Reproduce

  1. open new CodeEdit window
  2. paste some text

Expected behavior

Text should be white on dark background but is black.

Version information

CodeEdit: 1.0 (1)
macOS: 13.1

Additional context

1

✨ Terraform LSP/Highlighting/Completion Support

I think it would be great to have the terraform language supported with LSP, highlighting and completion if possible.

Another option might be to allow users to make plugins that can be installed/added to add features like this.

✨ Comment out highlighted code

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

No response

Describe the solution you'd like

Ability to comment out code by highlighting some code and pressing: CMD + /

Describe alternatives you've considered

n/a

Additional context

Preview from vscode:

hightlight

🐞 Text doesn't re-wrap on width change

Description

When changing the width of the view the text won't unwrap or wrap lines as the width changes. However, if you scroll away from the text and scroll back to it, it is laid out correctly.

This might just require forcing a layout when the view's width changes.

To reproduce

  • Open a file with a long line of text
  • Change the width of the screen so that the long line should either wrap more or unwrap
  • Scroll away so the text is no longer visible
  • Scroll back up to the original line (it should now be wrapped correctly according to the new width)

Expected Behavior

The lines should update as the view width changes, instead of needing a scroll to re-layout.

Additional Context

Screen.Recording.2022-10-27.at.10.17.41.PM.mov

Relate Issues

This issue should be worked on with the above issue.

✨ Font Ligatures

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

Nope.

Describe the solution you'd like

Using a custom font doesn’t apply the font ligatures. I think it would be nice for all those who use custom fonts to make the editor more personal.

Describe alternatives you've considered

I tried adding a font I really like called Fira Code but it won't apply the ligatures.

Additional context

image

Editor Overscroll from Xcode

In Xcode there is the ability to set Editor Overscroll as shown in the screenshot below. Having this would be helpful.

Β 
Xcode screenshot

🐞 Set a minimum height on the textview

Set a minimum height on the textview so that:

  • Clicking outside of a line with text causes the cursor to appear
  • Clicking on a line in an empty file causes the cursor to show up on the first line

✨ Configuration to toggle line numbers visibility

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

Line numbers make UI bloated, we have line indicator in status bar

Describe the solution you'd like

Please hide line numbers by default

Describe alternatives you've considered

At least there should be an option to hide

Additional context

Screenshot 2023-01-13 at 03 52 24

✨ Incremental Syntax Highlighting

At the moment each keystroke triggers highlighting for the whole document. While this is not an issue for small documents this might bring big performance losses on larger documents.

Though there needs to be some kind of padding of the changed text range since a single character cannot be parsed to anything. Ideally this would be the entire current line.

Ideally:

  • only highlight current scope.

Alternatively:

  • Highlight only current line on text input.
    When this results in an error there should be two options:
    • When no further editing is done (i.e. some small timeout), try highlighting the whole document.
    • When further editing is done, do nothing.
  • When selected text (multi-line) is deleted, also include previous and following line.
  • When multi-line text is inserted highlight those lines.

✨ Toggle Line Wrap

Acceptance Criteria

  • Enable in editor
  • Add option to text editing preference pane
  • Add command to command palette

✨ Sticky Headers from Xcode 14

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

No.

Describe the solution you'd like

In Xcode 14, the headers of Swift code stick to the top of the code editor whilst you can continue scrolling, helping greatly with code navigation. There is an example of this feature here on Twitter. Something like this in CodeEdit would be very helpful.

Describe alternatives you've considered

Instead of sticky headers, a good code outline tool like in VSCode would work well too.

Additional context

https://twitter.com/a_grebenyuk/status/1534359760308424711?s=21&t=Ok1RPHZ0s8iMU6Bf3HYJyA

✨ Column selection

Overview

Place the cursor in one corner and then hold Shift+Option while dragging to the opposite corner to select a column of text like so:

column-select

Related issues

🐞 Clicking empty area where there are no new lines does not clear text selection

If I have a file that does not have enough lines to fill the height of my editor, I have empty space below my lines. If I made a selection and then clicked this empty area, I would expect for the selection to be cleared and that the cursor would be moved to the end of the file. Instead, it does nothing as shown...

Screen.Recording.2022-10-04.at.4.51.34.PM.mov

✨ Indentation Guides

We need verticals lines in the editor indicating indentation level along with the option to turn them on or off. By default it will be off.

4FEE4D5E-BFFE-42F1-8579-EBEB374A7005

A6A5861D-C255-4F76-839D-5889D542B02C

BF70E4F2-0A75-40F2-A155-29D9A3C4B2B8

8BBA4512-2E75-477E-8B64-9AC8C1BE85EE

✨ Language Server Protocol Integration

The Language Server Protocol defines a cross-editor protocol to obtain rich language features from an external source. Adding support for this to CodeEdit would make it far simpler to port language extensions from other IDEs (especially VSCode), making everyone's life easier :p

✨ Minimap

Overview

This view represents your code in a smaller form. The VSCode documentation says in best...

A Minimap (code outline) gives you a high-level overview of your source code, which is useful for quick navigation and code understanding. A file's minimap is shown on the right side of the editor. You can click or drag the shaded area to quickly jump to different sections of your file.

image

Tip: You can move the minimap to the left hand side or disable it completely by respectively setting "editor.minimap.side": "left" or "editor.minimap.enabled": false in your user or workspace settings.

Resources

✨ Markdown: Backlink Support

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

No response

Describe the solution you'd like

It would be nice if CodeEdit support backlinks in markdown: when type [[, a small window hover and show all your markdown file's filename, you can select one of them to create backlink, after [[SOME_MD_FILENAME]] finished, the file SOME_MD_FILENAME.md would also create a backlink that mention the file that linked to it, which might be a snippet of markdown text:

## Backlinks
* [[Something that links here]]
    * The block of text in the referencing note which contains the link to [[Sample note]].
    * Another block in that same note which links to [[Sample note]].
* [[A different note that links here]]
    * This is a paragraph from another note which links to [[Sample note]].

This might be a little dirty to add to a code editor, as this feature is usually supported by Note APPs like Roam Research, Obsidian, Logseq, and Notion, etc. But it would be really cool for a native APP to support this as all these APPs are not macOS native (most of them based on Electron).

Describe alternatives you've considered

Using Note APPs that support backlink feature, like Roam Research, Obsidian, Logseq, and Notion.

Additional context

Examples for backlinks:

  • Notion

image

  • Logseq

image

✨ Matching Tag/Bracket Highlighting

When the cursor moves to a bracket, the matching bracket temporarily highlights to show the user the opposite bracket.

Screen.Recording.2022-10-03.at.2.34.17.AM.mov

🐞 Cursor remains arrow when over editor

Description

Cursor remains an arrow when hovering over editor.

To Reproduce

Hover over the editor.

Expected behavior

When hovering over editor, cursor should change to an I-beam to indicate editable text.

✨ Injected Languages

Injected languages are important for languages like HTML which might embed CSS or JavaScript code blocks.

Example Use Cases

  • HTML implements CSS, JavaScript
  • JavaScript implements regex, jsdoc, HTML/React

Injections.scm

Some grammars that support injections have an additional injections.scm file in their queries folder.

An example is tree-sitter-html:

((script_element
  (raw_text) @injection.content)
 (#set! injection.language "javascript"))

((style_element
  (raw_text) @injection.content)
 (#set! injection.language "css"))

We need to figure out how to parse and load the associated injected languages in addition to the base language itself.

Resources

🐞 Pasted text won't get formatted

Description

Pasted text will just appear black and small instead of formatted.

Screen.Recording.2022-11-03.at.08.32.55.mov

To Reproduce

  1. Open a file inside of a project
  2. Copy some unformatted text from another program
  3. Paste it

Expected behavior

Should just be formatted like any other text.

Version information

CodeEdit: 1.0 (1)
macOS: 13.0 Beta (22A5311f)
Xcode: 14.1 (14B47b)

Additional context

No response

✨ Auto-indent New Lines

When the user presses return to create a new line, we should auto-indent the new line for them.

The amount of indentation to give the new line will be based on the previous line's indentation, or if the previous line ends in a {, [, (, or <, increase the indent.

If there is a matching }, ], ), or >, we need to add it to a new line underneath the new line and indent it the same amount of indentation as the original line the user was on before they created the new line.

Screen.Recording.2022-10-06.at.4.16.58.PM.mp4

Related

How to choose only JSON methods when import this repo?

When I tried to use CodeEditTetView on macOS, and only used to parse JSON, I found that it depends on many parsing libraries in other languages, is there a way to remove other libraries according to personal needs?

Because I only need methods related to json parsing.

image

Thanks!

πŸš€ Binary Frameworks for `tree-sitter` parsers

Current Situation

Currently all tree-sitter parsers are fetched from source every time Swift Package Manager resolves dependencies. This can easily take a couple of minutes even with a good internet connection. This also applies to the CodeEdit repo.

Proposal

Since Languages usually don't need to be updated very often, they could be bundled as pre-built *.xcframework binaries in an extra repository. This would also include the CodeLanguage class. By doing so the fetching occurs only from a single Swift Package which in turn hugely benefits package resolution.

Further Information

Once there are additional languages or updates to existing ones, it's as simple as running a script to re-build the frameworks.

I know this sounds like a lot of overhead but I think in the long term this will pay off since waiting for packages to fetch/resolve on a daily basis definitely adds up.

I'm curious what you guys think about this!

🐞 Font doesn't apply consistently

Description

When using a custom font, the editor appears to only apply that font to select areas when the file has syntax highlighting.

To Reproduce

  1. Open CodeEdit Settings > Text Editing.
  2. Change the font to anything other than the default.
  3. Open a file in CodeEdit.
  4. Notice the inconsistent font application.

Expected behavior

The same font should be used throughout the entire editor view, regardless of syntax highlighting.

Version information

CodeEdit: 1.0
Hash: (Commit) 095abfec2475ca053bb7783572e4ae9a38d514ea
MacOS: 13.0 beta 4 (22A5311f)
Xcode: 14.0 beta 4 (14A5284g)

Additional context

This is an example screenshot demoing the behavior. I've set my font to Fira Code Retina (size 13). Notice that, here, the identifier "Foundation" uses the correct font, as well as the line gutter, whereas everything else doesn't.

image

🐞 Text changes from bold to not bold when typing

Screen.Recording.2022-07-07.at.3.28.53.PM.mov

When typing in a file (doesn't matter what the file extension is, so long as CodeEdit can syntax highlight it), the text changes from bold to non-bold, and/or the font size changes.

✨ Code Folding Ribbon

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

No response

Describe the solution you'd like

One of the features that I love most about XCode specifically is the code folding ribbon to the side. You can fold a level of braces by clicking anywhere in the gradient level that you want.
Screen Shot 2022-04-24 at 8 30 03 AM

Hover:
Screen Shot 2022-04-24 at 8 31 04 AM

Clicked (folded code):
Screen Shot 2022-04-24 at 8 31 40 AM

Here is a short recording of the whole process. There is a fancy animation that is not necessary, but it would be pretty cool to have!

Screen.Recording.2022-04-24.at.8.32.40.AM.mov

Describe alternatives you've considered

n/a

Additional context

For reference, here is a picture of the ribbon in both dark and light mode:
imgonline-com-ua-twotoone-0btV6nX2OfPxYH

✨ Multiple Cursors

Problem:
Sometimes, you have multiple variables or a collection and you want to edit all occurrences at the same time.

Solution:
Other code editors like Atom and even Xcode have added multiple-cursor support to conveniently edit multiple places at once, this can save lots of time. We should add a similar feature here, too. Part of supporting multiple cursors, it's also important that this feature is accompanied by ways to create multiple cursors. I suggest the following two ways:

  1. A shortcut that select other occurrences of the currently selected text within the same file (creating multiple cursors with selection). In Atom that's Cmd+D, in Xcode it's Cmd+Alt+E. I suggest that this comparison is case-sensitive.
  2. A keyboard-command to explicitly specify the places with the mouse cursor where the multiple text cursors should be created. In Xcode, this happens by holding the Alt key and either pressing manually into multiple places or by simply clicking the mouse and dragging it down to create multiple cursors at the same column on multiple lines.
Screen.Recording.2022-06-01.at.4.53.30.PM.mov

Alternatives considered:
Making the search with the shortcut case-insensitive (like Xcode does by default, it changes based on your last search settingS) makes this feature error prone when there's for example a class named String and 5 variables named string and I want to just edit the variables, I might accidentally also select the class.

Atom also supports a shortcut for finding all occurrences of the currently selected text in the file and create multiple cursors for all. This seems to be an extra feature that could be added later on. In the meantime, just holding the last key of the shortcut should select all entries within the same file relatively quickly as an alternative.

🐞 Highlighting slowly disappears as user scrolls down

Description

CodeEdit app isn't highlighting all lines of code. It's highlighting about 85% of lines displayed in the window. To fix this I need to scroll down all the file.(after scrolling all file the highlighting remains).

BUT: there is a scenario when scrolling doesn't help: if last few lines of file are not empty, then the'll not be highlighted. To fix this I need to add some empty lines at the end of file.

To Reproduce

  1. Open a file with an implemented highlighting(i.e .py file). The file must be longer than the CodeEdit app height.

Expected behavior

All the file is highlighted

Version information

CodeEdit: [e.g. 1.0 (1)]
macOS: [e.g. 13.1.0]
Xcode: [e.g. 14.2]

Additional context

No response

🐞 Line number font is incorrect

The line number font does not align with Xcode.

image

Left: Xcode | Right: CodeEdit

The font needs to be sans-serif, narrower, with the color less prominent.

✨ Line Annotations

Description

We need a system in place where we can annotate lines with different styles - Neutral, Info, Warning, Error, etc.

Additional Context

This has been implemented in CodeEditorView here (under Messages) and here. We may adopt a similar API.

Screenshots

Warning
image

Warning Expanded
image

Error
image

Multiple Errors
image

Multiple Errors Expanded
image

✨ Command+Backspace Keyboard Shortcut to delete whole line

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

No.

Describe the solution you'd like

In Xcode, one of the default keyboard shortcuts is ⌘⌫, which deletes to the start of the line. This is used across several text editors and should be implimented in CodeEdit. This allows the user to delete an entire line of code to the start instead of having to either select the line or keep holding the backspace key.

Describe alternatives you've considered

I think this is the simplest solution and has the standard shortcut, although the shortcut could be changed to accommodate CodeEdit's other features. I think that the only other options would be either continuing to hold the delete key or some sort of "delete" icon next to the line in the CodeEditTextView.

Additional context

Here is a video in Xcode of what I am suggesting:

Screen.Recording.2023-01-14.at.12.20.12.PM.mov

In this video, I use the ⌘⌫ shortcut to delete the entire line, which makes editing code much easier.

✨ Shift-Click to Make Text Selection

Users should be able to make a selection by holding down the Shift key and clicking anywhere in the document to highlight text from where the cursor was to where they just clicked.

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.