Skip to content

Commit

Permalink
Make a code editor / usdview hybrid.
Browse files Browse the repository at this point in the history
  • Loading branch information
furby-tm committed Apr 16, 2024
1 parent 3b983b1 commit 7fee2ff
Show file tree
Hide file tree
Showing 204 changed files with 1,578 additions and 1,656 deletions.
116 changes: 1 addition & 115 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "c15e8aa8884e5c43573b4c6821e6a2d2a6f33b031aae46b8d3f500da1ae16ba1",
"originHash" : "86ca3573181d97fb51f834cb8c76d8139ea4570c71591717fff34d96048696a1",
"pins" : [
{
"identity" : "aexml",
Expand All @@ -10,15 +10,6 @@
"version" : "4.6.1"
}
},
{
"identity" : "asyncextensions",
"kind" : "remoteSourceControl",
"location" : "https://github.com/lhoward/AsyncExtensions",
"state" : {
"branch" : "linux",
"revision" : "2218eaa30dbdb39b063e92644fc28ed22e2cb942"
}
},
{
"identity" : "graphviz",
"kind" : "remoteSourceControl",
Expand All @@ -37,14 +28,6 @@
"version" : "4.2.0"
}
},
{
"identity" : "lvglswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/PADL/LVGLSwift",
"state" : {
"revision" : "19c19a942153b50d61486faf1d0d45daf79e7be5"
}
},
{
"identity" : "mainoffender",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -81,15 +64,6 @@
"version" : "1.26.2"
}
},
{
"identity" : "opencombine",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenCombine/OpenCombine.git",
"state" : {
"revision" : "8576f0d579b27020beccbccc3ea6844f3ddfc2c2",
"version" : "0.14.0"
}
},
{
"identity" : "pathkit",
"kind" : "remoteSourceControl",
Expand All @@ -108,14 +82,6 @@
"version" : "0.4.2"
}
},
{
"identity" : "qlift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/Longhanks/qlift",
"state" : {
"revision" : "ddab1f1ecc113ad4f8e05d2999c2734cdf706210"
}
},
{
"identity" : "rainbow",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -197,24 +163,6 @@
"version" : "1.1.0"
}
},
{
"identity" : "swift-cross-ui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/stackotter/swift-cross-ui",
"state" : {
"branch" : "f57f7ab",
"revision" : "f57f7abc22c7aee3ba642ef714742776e2b767ed"
}
},
{
"identity" : "swift-cwinrt",
"kind" : "remoteSourceControl",
"location" : "https://github.com/thebrowsercompany/swift-cwinrt",
"state" : {
"branch" : "main",
"revision" : "ad451d31fc7c1c60041c146d177cdaf5aaf1cf47"
}
},
{
"identity" : "swift-format",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -269,42 +217,6 @@
"version" : "509.1.1"
}
},
{
"identity" : "swift-uwp",
"kind" : "remoteSourceControl",
"location" : "https://github.com/thebrowsercompany/swift-uwp",
"state" : {
"branch" : "main",
"revision" : "cfad0a43469211bf7eb58ed23af3d4a176faec07"
}
},
{
"identity" : "swift-windowsappsdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/thebrowsercompany/swift-windowsappsdk",
"state" : {
"branch" : "main",
"revision" : "8d094d4478d0eabcf584fef133b8ce45287ecd72"
}
},
{
"identity" : "swift-windowsfoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/thebrowsercompany/swift-windowsfoundation",
"state" : {
"branch" : "main",
"revision" : "ba7a8b5000ed3f9f077000d1a31f2a0b19907657"
}
},
{
"identity" : "swift-winui",
"kind" : "remoteSourceControl",
"location" : "https://github.com/thebrowsercompany/swift-winui",
"state" : {
"branch" : "main",
"revision" : "4c246a1352accfa5e12f7103bd2725b271730cce"
}
},
{
"identity" : "swiftcli",
"kind" : "remoteSourceControl",
Expand All @@ -314,15 +226,6 @@
"version" : "6.0.3"
}
},
{
"identity" : "swiftterm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/migueldeicaza/SwiftTerm.git",
"state" : {
"revision" : "e2b431dbf73f775fb4807a33e4572ffd3dc6933a",
"version" : "1.2.5"
}
},
{
"identity" : "swifttreesitter",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -350,23 +253,6 @@
"version" : "8.10.1"
}
},
{
"identity" : "termkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/migueldeicaza/TermKit",
"state" : {
"revision" : "3bce85d1bafbbb0336b3b7b7e905c35754cb9adf"
}
},
{
"identity" : "textbufferkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/migueldeicaza/TextBufferKit.git",
"state" : {
"revision" : "7f3ed5b1d7288de34ad853544d802647be11cfcf",
"version" : "0.3.0"
}
},
{
"identity" : "textformation",
"kind" : "remoteSourceControl",
Expand Down
71 changes: 23 additions & 48 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// swift-tools-version: 5.10
import PackageDescription

#if os(macOS)
let crazyToolChainBug: [String: String]? = nil
#else /* os(macOS) */
let crazyToolChainBug: [String: String]? = ["SwiftCrossUI": "SwiftUI"]
#endif /* !os(macOS) */
// #if os(macOS)
// let crazyToolChainBug: [String: String]? = nil
// #else /* os(macOS) */
// let crazyToolChainBug: [String: String]? = ["SwiftCrossUI": "SwiftUI"]
// #endif /* !os(macOS) */

let package = Package(
name: "Kraken",
Expand All @@ -21,11 +21,11 @@ let package = Package(
// --- 🎨 Editors ---
.library(
name: "CosmoEditor",
targets: ["CosmoTextView", "CosmoEditor"]
targets: ["CodeView", "CosmoEditor"]
),
.library(
name: "CosmoLanguages",
targets: ["CosmoLanguagesContainer", "CosmoLanguages"]
name: "CodeLanguages",
targets: ["LanguagesBundle", "CodeLanguages"]
),
// --- 🦑 Kraken ---
.library(
Expand All @@ -36,10 +36,6 @@ let package = Package(
name: "KrakenLib",
targets: ["KrakenLib"]
),
.library(
name: "KrakenUI",
targets: ["KrakenUI"]
),
.executable(
name: "Kraken",
targets: ["Kraken"]
Expand All @@ -54,15 +50,15 @@ let package = Package(
.package(url: "https://github.com/ChimeHQ/TextStory.git", from: "0.8.0"),
.package(url: "https://github.com/apple/swift-collections", from: "1.1.0"),
.package(url: "https://github.com/furby-tm/swift-bundler", from: "2.0.9"),
.package(url: "https://github.com/stackotter/swift-cross-ui", revision: "f57f7ab")
//.package(url: "https://github.com/stackotter/swift-cross-ui", revision: "f57f7ab")
],

// --- 🎯 Package Targets. ---
targets: [
// --- 🎨 Editors ---
.target(
name: "CosmoLanguagesContainer",
path: "Sources/Editors/Code/CosmoLanguagesContainer",
name: "LanguagesBundle",
path: "Sources/Editors/Code/LanguagesBundle",
publicHeadersPath: "include",
cSettings: [
.headerSearchPath("TreeSitterC/include"),
Expand All @@ -76,39 +72,39 @@ let package = Package(
]
),
.target(
name: "CosmoLanguages",
name: "CodeLanguages",
dependencies: [
.target(name: "CosmoLanguagesContainer"),
.target(name: "LanguagesBundle"),
.product(name: "SwiftTreeSitter", package: "SwiftTreeSitter"),
],
path: "Sources/Editors/Code/CosmoLanguages",
path: "Sources/Editors/Code/Languages",
resources: [
.copy("Resources"),
]
),
.testTarget(
name: "CosmoLanguagesTests",
name: "CodeEditorTests",
dependencies: [
.target(name: "CosmoLanguages")
.target(name: "CodeLanguages")
],
path: "Tests/Editors/Code/CosmoLanguagesTests"
path: "Tests/Editors/Code"
),
.target(
name: "CosmoTextView",
name: "CodeView",
dependencies: [
.product(name: "TextStory", package: "TextStory"),
.product(name: "Collections", package: "swift-collections"),
],
path: "Sources/Editors/Code/CosmoTextView"
path: "Sources/Editors/Code/CodeView"
),
.target(
name: "CosmoEditor",
dependencies: [
.target(name: "CosmoLanguages"),
.target(name: "CosmoTextView"),
.target(name: "CodeLanguages"),
.target(name: "CodeView"),
.product(name: "TextFormation", package: "TextFormation"),
],
path: "Sources/Editors/Code/CosmoEditor"
path: "Sources/Editors/Code/Cosmo"
),
// --- 🦑 Kraken ---
.target(
Expand All @@ -129,34 +125,13 @@ let package = Package(
.interoperabilityMode(.Cxx)
]
),
.target(
name: "KrakenUI",
dependencies: [
.target(name: "KrakenKit"),
.target(name: "CosmoEditor"),
.product(
name: "SwiftCrossUI",
package: "swift-cross-ui",
moduleAliases: crazyToolChainBug,
condition: .when(platforms: [.linux, .windows])
),
.product(
name: "GtkBackend",
package: "swift-cross-ui",
condition: .when(platforms: [.linux, .windows])
),
],
swiftSettings: [
.interoperabilityMode(.Cxx)
]
),
.executableTarget(
name: "Kraken",
dependencies: [
.product(name: "PixarUSD", package: "SwiftUSD"),
.target(name: "KrakenKit"),
.target(name: "KrakenLib"),
.target(name: "KrakenUI"),
.target(name: "CosmoEditor"),
],
resources: [
.process("Resources")
Expand Down
37 changes: 37 additions & 0 deletions Sources/Editors/Code/CodeView/CodeView.docc/CodeView.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# ``CodeView``

A text editor designed to edit code documents.

## Overview

A text editor specialized for displaying and editing code documents. Features include basic text editing, extremely fast initial layout, support for handling large documents, customization options for code documents.

> This package contains a text view suitable for replacing `NSTextView` in some, **_specific_** cases.
The `TextView` class is an `NSView` subclass that can be embedded in a scroll view or used standalone. It parses and renders lines of a document and handles mouse and keyboard events for text editing. It also renders styled strings for use cases like syntax highlighting.

## Topics

### Text View

- `TextView`
- `CEUndoManager`

### Text Layout

- `TextLayoutManager`
- `TextLine`
- `LineFragment`

### Text Selection

- `TextSelectionManager`
- `TextSelectionManager/TextSelection`
- `CursorView`

### Supporting Types

- `TextLineStorage`
- `HorizontalEdgeInsets`
- `LineEnding`
- `LineBreakStrategy`
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
* -------------------------------------------------------------- */

import AppKit
// import CosmoTextViewObjC

// import CodeViewObjC

/// Displays a line fragment.
final class LineFragmentView: NSView
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@

import os

let logger = Logger(subsystem: "com.CodeEdit.CosmoTextView", category: "TextView")
let logger = Logger(subsystem: "foundation.wabi.textview", category: "TextView")
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct CursorPosition: Sendable, Codable, Equatable
/// Initialize a cursor position.
///
/// When this initializer is used, ``CursorPosition/range`` will be initialized to `NSNotFound`.
/// The range value, however, be filled when updated by ``CosmoEditor`` via a `Binding`, or when it appears
/// The range value, however, be filled when updated by ``Editor/Code/Cosmo`` via a `Binding`, or when it appears
/// in the``TextViewController/cursorPositions`` array.
///
/// - Parameters:
Expand All @@ -56,7 +56,7 @@ public struct CursorPosition: Sendable, Codable, Equatable
/// Initialize a cursor position.
///
/// When this initializer is used, both ``CursorPosition/line`` and ``CursorPosition/column`` will be initialized
/// to `-1`. They will, however, be filled when updated by ``CosmoEditor`` via a `Binding`, or when it
/// to `-1`. They will, however, be filled when updated by ``Editor/Code/Cosmo`` via a `Binding`, or when it
/// appears in the ``TextViewController/cursorPositions`` array.
///
/// - Parameter range: The range of the cursor position.
Expand Down
Loading

0 comments on commit 7fee2ff

Please sign in to comment.