Skip to content

Commit

Permalink
refactor: Move Commands Folder to Modules (#811)
Browse files Browse the repository at this point in the history
* refactor: move Commands to Modules

* remove: import Sparkle

* fix: dependency of AppPreferences
  • Loading branch information
NakaokaRei authored Oct 7, 2022
1 parent 71f7ecc commit 88a2934
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 18 deletions.
23 changes: 7 additions & 16 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
474397C52893AC4B00518C8C /* codeedit-midnight.json in Resources */ = {isa = PBXBuildFile; fileRef = 474397C42893AC4B00518C8C /* codeedit-midnight.json */; };
5C403B8F27E20F8000788241 /* WorkspaceClient in Frameworks */ = {isa = PBXBuildFile; productRef = 5C403B8E27E20F8000788241 /* WorkspaceClient */; };
5C4BB1E128212B1E00A92FB2 /* World.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4BB1E028212B1E00A92FB2 /* World.swift */; };
5C7448AC28EF2E2E00F73D21 /* Commands in Frameworks */ = {isa = PBXBuildFile; productRef = 5C7448AB28EF2E2E00F73D21 /* Commands */; };
5CA8776527FC6A95003F5CD5 /* QuickOpen in Frameworks */ = {isa = PBXBuildFile; productRef = 5CA8776427FC6A95003F5CD5 /* QuickOpen */; };
5CAD1B972806B57D0059A74E /* Breadcrumbs in Frameworks */ = {isa = PBXBuildFile; productRef = 5CAD1B962806B57D0059A74E /* Breadcrumbs */; };
5CF38A5E27E48E6C0096A0F7 /* CodeFile in Frameworks */ = {isa = PBXBuildFile; productRef = 5CF38A5D27E48E6C0096A0F7 /* CodeFile */; };
Expand Down Expand Up @@ -108,9 +109,7 @@
DE513F54281DE5D0002260B9 /* TabBarXcode.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE513F53281DE5D0002260B9 /* TabBarXcode.swift */; };
DE6405A62817734700881FDF /* TabBarNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6405A52817734700881FDF /* TabBarNative.swift */; };
DE6F77872813625500D00A76 /* TabBarDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE6F77862813625500D00A76 /* TabBarDivider.swift */; };
FA275791283D61F300FDAFEE /* CommandPaletteView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA275790283D61F300FDAFEE /* CommandPaletteView.swift */; };
FA6BA6F1282ACAD600019309 /* Keybindings in Frameworks */ = {isa = PBXBuildFile; productRef = FA6BA6F0282ACAD600019309 /* Keybindings */; };
FA85159D283F4F800040A467 /* CommandPaletteState.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA85159C283F4F800040A467 /* CommandPaletteState.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -250,8 +249,6 @@
DE513F53281DE5D0002260B9 /* TabBarXcode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarXcode.swift; sourceTree = "<group>"; };
DE6405A52817734700881FDF /* TabBarNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarNative.swift; sourceTree = "<group>"; };
DE6F77862813625500D00A76 /* TabBarDivider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabBarDivider.swift; sourceTree = "<group>"; };
FA275790283D61F300FDAFEE /* CommandPaletteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandPaletteView.swift; sourceTree = "<group>"; };
FA85159C283F4F800040A467 /* CommandPaletteState.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommandPaletteState.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -276,6 +273,7 @@
2864BAAE28117D7C002DBD1A /* TerminalEmulator in Frameworks */,
5C403B8F27E20F8000788241 /* WorkspaceClient in Frameworks */,
5CAD1B972806B57D0059A74E /* Breadcrumbs in Frameworks */,
5C7448AC28EF2E2E00F73D21 /* Commands in Frameworks */,
2803257127F3CF1F009C7DC2 /* AppPreferences in Frameworks */,
2040F0B1280AE96100411B6F /* CodeEditUtils in Frameworks */,
5CA8776527FC6A95003F5CD5 /* QuickOpen in Frameworks */,
Expand Down Expand Up @@ -552,7 +550,6 @@
B658FB2E27DA9E0F00EA4DBD /* CodeEdit */ = {
isa = PBXGroup;
children = (
FA73C664283BEDE6008353ED /* Commands */,
0463E50F27FCC19800806D5C /* Extensions */,
043C321227E31FE8006AE443 /* Documents */,
B6EE988E27E8877C00CDD8AB /* InspectorSidebar */,
Expand Down Expand Up @@ -611,15 +608,6 @@
path = Localization;
sourceTree = "<group>";
};
FA73C664283BEDE6008353ED /* Commands */ = {
isa = PBXGroup;
children = (
FA85159C283F4F800040A467 /* CommandPaletteState.swift */,
FA275790283D61F300FDAFEE /* CommandPaletteView.swift */,
);
path = Commands;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -682,6 +670,7 @@
FA6BA6F0282ACAD600019309 /* Keybindings */,
20AFDC7E28206701001A4FC7 /* Git */,
B69542E028D5788B00EAD898 /* Sparkle */,
5C7448AB28EF2E2E00F73D21 /* Commands */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -908,7 +897,6 @@
2072FA13280D74ED00C7F8D4 /* HistoryInspectorModel.swift in Sources */,
201169E52837B40300F92B46 /* RepositoriesView.swift in Sources */,
DE513F52281B672D002260B9 /* TabBarAccessory.swift in Sources */,
FA85159D283F4F800040A467 /* CommandPaletteState.swift in Sources */,
2813F93927ECC4C300E305E4 /* NavigatorSidebar.swift in Sources */,
DE513F54281DE5D0002260B9 /* TabBarXcode.swift in Sources */,
6C14CEB028777D3C001468FE /* FindNavigatorListViewController.swift in Sources */,
Expand Down Expand Up @@ -967,7 +955,6 @@
043BCF03281DA18A000AC47C /* WorkspaceDocument+Search.swift in Sources */,
04C325512800AC7400C8DA2D /* ExtensionInstallationViewModel.swift in Sources */,
28B0A19827E385C300B73177 /* NavigatorSidebarToolbarTop.swift in Sources */,
FA275791283D61F300FDAFEE /* CommandPaletteView.swift in Sources */,
6CDA84AD284C1BA000C1CC3A /* TabBarContextMenu.swift in Sources */,
0463E51127FCC1DF00806D5C /* CodeEditAPI.swift in Sources */,
04C3255B2801F86400C8DA2D /* OutlineViewController.swift in Sources */,
Expand Down Expand Up @@ -1497,6 +1484,10 @@
isa = XCSwiftPackageProductDependency;
productName = WorkspaceClient;
};
5C7448AB28EF2E2E00F73D21 /* Commands */ = {
isa = XCSwiftPackageProductDependency;
productName = Commands;
};
5CA8776427FC6A95003F5CD5 /* QuickOpen */ = {
isa = XCSwiftPackageProductDependency;
productName = QuickOpen;
Expand Down
1 change: 1 addition & 0 deletions CodeEdit/Documents/CodeEditWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Cocoa
import SwiftUI
import CodeFile
import CodeEditUI
import Commands
import QuickOpen
import Git
import AppPreferences
Expand Down
1 change: 1 addition & 0 deletions CodeEdit/Documents/WorkspaceDocument.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import Search
import QuickOpen
import CodeEditKit
import CodeEditUtils
import Commands
import ExtensionsStore
import StatusBar
import TabBar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ public final class CommandPaletteState: ObservableObject {
@Published var isShowingCommandsList: Bool = true
@Published var filteredCommands: [Command] = []

func reset() {
public init() {}

public func reset() {
commandQuery = ""
selected = nil
filteredCommands = []
}

func fetchMatchingCommands(val: String) {
public func fetchMatchingCommands(val: String) {
if val == "" {
self.filteredCommands = []
return
Expand Down
File renamed without changes.
18 changes: 18 additions & 0 deletions CodeEditModules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ let package = Package(
name: "CodeFile",
targets: ["CodeFile"]
),
.library(
name: "Commands",
targets: ["Commands"]
),
.library(
name: "WelcomeModule",
targets: ["WelcomeModule"]
Expand Down Expand Up @@ -87,6 +91,11 @@ let package = Package(
),
],
dependencies: [
.package(
name: "Sparkle",
url: "https://github.com/sparkle-project/Sparkle.git",
from: "2.0.0"
),
.package(
name: "Highlightr",
url: "https://github.com/lukepistrol/Highlightr.git",
Expand Down Expand Up @@ -164,6 +173,14 @@ let package = Package(
],
path: "Modules/CodeFile/Tests"
),
.target(
name: "Commands",
dependencies: [
"Keybindings",
"CodeEditUI",
],
path: "Modules/Commands/src"
),
.target(
name: "WelcomeModule",
dependencies: [
Expand Down Expand Up @@ -237,6 +254,7 @@ let package = Package(
"CodeEditUtils",
"CodeEditSymbols",
"CodeEditTextView",
"Sparkle"
],
path: "Modules/AppPreferences/src",
resources: [.copy("Resources")]
Expand Down

0 comments on commit 88a2934

Please sign in to comment.