Skip to content

Latest commit

 

History

History
123 lines (99 loc) · 5.88 KB

File metadata and controls

123 lines (99 loc) · 5.88 KB

CodeEditSourceEditor

An Xcode-inspired code editor view written in Swift powered by tree-sitter for CodeEdit. Features include syntax highlighting (based on the provided theme), code completion, find and replace, text diff, validation, current line highlighting, minimap, inline messages (warnings and errors), bracket matching, and more.

social-cover-textview

GitHub release Github Tests GitHub Repo stars GitHub forks Discord Badge

Important

CodeEditSourceEditor is currently in development and it is not ready for production use.
Please check back later for updates on this project. Contributors are welcome as we build out the features mentioned above!

Documentation

This package is fully documented here.

Usage (SwiftUI)

import CodeEditSourceEditor

struct ContentView: View {
    @State var text = "let x = 1.0"
    
    /// Automatically updates with cursor positions, or update the binding to set the user's cursors.
    @State var cursorPositions: [CursorPosition] = []
    
    /// Configure the editor's appearance, features, and editing behavior...
    @State var theme = EditorTheme(...)
    @State var font = NSFont.monospacedSystemFont(ofSize: 11, weight: .regular)
    @State var indentOption = .spaces(count: 4)

    var body: some View { 
        SourceEditor(
            $text,
            language: language,
            // Tons of customization options, with good defaults to get started quickly.
            configuration: SourceEditorConfiguration(
                appearance: .init(theme: theme, font: font),
                behavior: .init(indentOption: indentOption)
            ),
            cursorPositions: $cursorPositions
        )
    }
}

An AppKit API is also available.

Currently Supported Languages

See this issue CodeEditApp/CodeEditLanguages#10 on CodeEditLanguages for more information on supported languages.

Dependencies

Special thanks to Matt Massicotte for the great work he's done!

Package Source Author
SwiftTreeSitter GitHub Matt Massicotte

License

Licensed under the MIT license.

Related Repositories

        CodeEdit        

CodeEditTextView

CodeEditLanguages

CodeEditCLI

     CodeEditKit