Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LSP Document Content Sync #1887

Merged
merged 24 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
5e9c5ea
Rework LSP To Use Workspace Files, Standardize Errors
thecoolwinter Sep 9, 2024
f9000c5
Shutdown Servers When Workspace Closes
thecoolwinter Sep 10, 2024
ccad260
Add Document Sync Tests
thecoolwinter Sep 12, 2024
47fb7b2
Docs
thecoolwinter Sep 12, 2024
2f59b50
Begin Sync Work, Need To Fix Status Bar Label
thecoolwinter Sep 16, 2024
e4fca1a
Clean Up Documentation
thecoolwinter Sep 16, 2024
4d7d3c0
Merge branch 'lsp-use-workspace-files' into lsp/document-content-sync
thecoolwinter Sep 16, 2024
cc33c64
Fixed Cursor Position Label
thecoolwinter Sep 16, 2024
3127468
Merge branch 'CodeEditApp:main' into lsp-use-workspace-files
thecoolwinter Sep 17, 2024
f7e0253
Fix Subtle FileManager Bug, Fix Duplicate File Reads
thecoolwinter Sep 17, 2024
3af0370
Remove code causing a malloc exception, See #1886
thecoolwinter Sep 17, 2024
ebcae90
Move Coordinator
thecoolwinter Sep 17, 2024
5fe849f
Merge branch 'lsp-use-workspace-files' into lsp/document-content-sync
thecoolwinter Sep 17, 2024
ee18f87
Fix File Opening Bug, Finish Cursor Fix
thecoolwinter Sep 17, 2024
ecd03c8
Remove Extra Service
thecoolwinter Sep 18, 2024
b22aa6d
Remove Extra `internal`
thecoolwinter Sep 18, 2024
d1a0ec9
Merge branch 'lsp-use-workspace-files' into lsp/document-content-sync
thecoolwinter Sep 18, 2024
7351dee
Merge branch 'main' into lsp/document-content-sync
thecoolwinter Sep 19, 2024
989df27
Throttle Content Updates
thecoolwinter Sep 24, 2024
cd09430
Merge branch 'main' into lsp/document-content-sync
thecoolwinter Sep 24, 2024
94f1b1a
Throttle Edit Notifications, Tests
thecoolwinter Sep 26, 2024
185dc29
Lint
thecoolwinter Sep 27, 2024
249f915
Documentation
thecoolwinter Sep 27, 2024
7a2f0df
Revert Editor Model Changes
thecoolwinter Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 43 additions & 10 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@
6C1CC99B2B1E7CBC0002349B /* FindNavigatorIndexBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C1CC99A2B1E7CBC0002349B /* FindNavigatorIndexBar.swift */; };
6C1F3DA22C18C55800F6DEF6 /* ShellIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C1F3DA12C18C55800F6DEF6 /* ShellIntegrationTests.swift */; };
6C23842F2C796B4C003FBDD4 /* GitChangedFileLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C23842E2C796B4C003FBDD4 /* GitChangedFileLabel.swift */; };
6C278CC72C93971F0066F6D9 /* LSPContentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C278CC62C93971F0066F6D9 /* LSPContentCoordinator.swift */; };
6C2C155829B4F49100EA60A5 /* SplitViewItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C2C155729B4F49100EA60A5 /* SplitViewItem.swift */; };
6C2C155A29B4F4CC00EA60A5 /* Variadic.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C2C155929B4F4CC00EA60A5 /* Variadic.swift */; };
6C2C155D29B4F4E500EA60A5 /* SplitViewReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6C2C155C29B4F4E500EA60A5 /* SplitViewReader.swift */; };
Expand Down Expand Up @@ -444,6 +445,8 @@
6CB446402B6DFF3A00539ED0 /* CodeEditSourceEditor in Frameworks */ = {isa = PBXBuildFile; productRef = 6CB4463F2B6DFF3A00539ED0 /* CodeEditSourceEditor */; };
6CB52DC92AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CB52DC82AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift */; };
6CB9144B29BEC7F100BC47F2 /* (null) in Sources */ = {isa = PBXBuildFile; };
6CB94CFE2C9F1C9A00E8651C /* TextView+LSPRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CB94CFD2C9F1C9A00E8651C /* TextView+LSPRange.swift */; };
6CB94D032CA1205100E8651C /* AsyncAlgorithms in Frameworks */ = {isa = PBXBuildFile; productRef = 6CB94D022CA1205100E8651C /* AsyncAlgorithms */; };
6CBA0D512A1BF524002C6FAA /* SegmentedControlImproved.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBA0D502A1BF524002C6FAA /* SegmentedControlImproved.swift */; };
6CBD1BC62978DE53006639D5 /* Font+Caption3.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */; };
6CBE1CFB2B71DAA6003AC32E /* Loopable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CBE1CFA2B71DAA6003AC32E /* Loopable.swift */; };
Expand Down Expand Up @@ -1048,6 +1051,7 @@
6C1CC99A2B1E7CBC0002349B /* FindNavigatorIndexBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FindNavigatorIndexBar.swift; sourceTree = "<group>"; };
6C1F3DA12C18C55800F6DEF6 /* ShellIntegrationTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShellIntegrationTests.swift; sourceTree = "<group>"; };
6C23842E2C796B4C003FBDD4 /* GitChangedFileLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitChangedFileLabel.swift; sourceTree = "<group>"; };
6C278CC62C93971F0066F6D9 /* LSPContentCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LSPContentCoordinator.swift; sourceTree = "<group>"; };
6C2C155729B4F49100EA60A5 /* SplitViewItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitViewItem.swift; sourceTree = "<group>"; };
6C2C155929B4F4CC00EA60A5 /* Variadic.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Variadic.swift; sourceTree = "<group>"; };
6C2C155C29B4F4E500EA60A5 /* SplitViewReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SplitViewReader.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1103,6 +1107,7 @@
6CA1AE942B46950000378EAB /* EditorInstance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditorInstance.swift; sourceTree = "<group>"; };
6CABB1A029C5593800340467 /* SearchPanelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SearchPanelView.swift; sourceTree = "<group>"; };
6CB52DC82AC8DC3E002E75B3 /* CEWorkspaceFileManager+FileManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CEWorkspaceFileManager+FileManagement.swift"; sourceTree = "<group>"; };
6CB94CFD2C9F1C9A00E8651C /* TextView+LSPRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "TextView+LSPRange.swift"; sourceTree = "<group>"; };
6CBA0D502A1BF524002C6FAA /* SegmentedControlImproved.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SegmentedControlImproved.swift; sourceTree = "<group>"; };
6CBD1BC52978DE53006639D5 /* Font+Caption3.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Font+Caption3.swift"; sourceTree = "<group>"; };
6CBE1CFA2B71DAA6003AC32E /* Loopable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Loopable.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1310,6 +1315,7 @@
6C6BD6F829CD14D100235D17 /* CodeEditKit in Frameworks */,
6C0824A12C5C0C9700A0751E /* SwiftTerm in Frameworks */,
6C81916B29B41DD300B75C92 /* DequeModule in Frameworks */,
6CB94D032CA1205100E8651C /* AsyncAlgorithms in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -1552,7 +1558,6 @@
30B087FB2C0D53080063A882 /* LSP */ = {
isa = PBXGroup;
children = (
6CD26C822C8F8A5F00ADBA38 /* Extensions */,
6CD26C732C8EA71F00ADBA38 /* LanguageServer */,
6CD26C742C8EA79100ADBA38 /* Service */,
30B087FA2C0D53080063A882 /* LSPUtil.swift */,
Expand Down Expand Up @@ -2442,9 +2447,11 @@
5831E3C62933E7E600D5A6D2 /* Color */,
669A504F2C380BFD00304CD8 /* Collection */,
5831E3C82933E80500D5A6D2 /* Date */,
6CB94D002C9F1CF900E8651C /* LanguageIdentifier */,
6C82D6C429C0129E00495C54 /* NSApplication */,
5831E3D02934036D00D5A6D2 /* NSTableView */,
77A01E922BCA9C0400F0EA38 /* NSWindow */,
6CB94CFF2C9F1CB600E8651C /* TextView */,
77EF6C042C57DE4B00984B69 /* URL */,
58D01C8B293167DC00C5B6B4 /* String */,
5831E3CB2933E89A00D5A6D2 /* SwiftTerm */,
Expand Down Expand Up @@ -2968,6 +2975,22 @@
path = WindowCommands;
sourceTree = "<group>";
};
6CB94CFF2C9F1CB600E8651C /* TextView */ = {
isa = PBXGroup;
children = (
6CB94CFD2C9F1C9A00E8651C /* TextView+LSPRange.swift */,
);
path = TextView;
sourceTree = "<group>";
};
6CB94D002C9F1CF900E8651C /* LanguageIdentifier */ = {
isa = PBXGroup;
children = (
6CD26C802C8F8A4400ADBA38 /* LanguageIdentifier+CodeLanguage.swift */,
);
path = LanguageIdentifier;
sourceTree = "<group>";
};
6CBD1BC42978DE3E006639D5 /* Text */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3006,6 +3029,7 @@
6CD26C6D2C8EA1E600ADBA38 /* LanguageServerFileMap.swift */,
6CD26C782C8EA8A500ADBA38 /* LSPCache.swift */,
6CD26C792C8EA8A500ADBA38 /* LSPCache+Data.swift */,
6C278CC62C93971F0066F6D9 /* LSPContentCoordinator.swift */,
30B0881E2C12626B0063A882 /* Capabilities */,
);
path = LanguageServer;
Expand All @@ -3030,14 +3054,6 @@
path = URL;
sourceTree = "<group>";
};
6CD26C822C8F8A5F00ADBA38 /* Extensions */ = {
isa = PBXGroup;
children = (
6CD26C802C8F8A4400ADBA38 /* LanguageIdentifier+CodeLanguage.swift */,
);
path = Extensions;
sourceTree = "<group>";
};
6CD26C882C8F91B600ADBA38 /* LSP */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3678,6 +3694,7 @@
6C4E37FB2C73E00700AEE7B5 /* SwiftTerm */,
6CD3CA542C8B508200D83DCD /* CodeEditSourceEditor */,
6CD26C842C8F907800ADBA38 /* CodeEditSourceEditor */,
6CB94D022CA1205100E8651C /* AsyncAlgorithms */,
);
productName = CodeEdit;
productReference = B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */;
Expand Down Expand Up @@ -3775,6 +3792,7 @@
303E88462C276FD600EEA8D9 /* XCRemoteSwiftPackageReference "LanguageServerProtocol" */,
6C4E37FA2C73E00700AEE7B5 /* XCRemoteSwiftPackageReference "SwiftTerm" */,
6CD26C832C8F907800ADBA38 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */,
6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */,
);
productRefGroup = B658FB2D27DA9E0F00EA4DBD /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -4357,6 +4375,7 @@
5878DA82291863F900DD95A3 /* AcknowledgementsView.swift in Sources */,
587B9E8529301D8F00AC7927 /* GitHubReview.swift in Sources */,
58D01C9A293167DC00C5B6B4 /* CodeEditKeychain.swift in Sources */,
6CB94CFE2C9F1C9A00E8651C /* TextView+LSPRange.swift in Sources */,
B6966A2E2C3056AD00259C2D /* SourceControlCommands.swift in Sources */,
B62AEDAA2A1FCBE5009A9F52 /* AreaTabBar.swift in Sources */,
20D839AB280DEB2900B27357 /* NoSelectionInspectorView.swift in Sources */,
Expand Down Expand Up @@ -4399,6 +4418,7 @@
6C1CC9982B1E770B0002349B /* AsyncFileIterator.swift in Sources */,
587B9E9029301D8F00AC7927 /* BitBucketTokenRouter.swift in Sources */,
B6C6A42E29771A8D00A3D28F /* EditorTabButtonStyle.swift in Sources */,
6C278CC72C93971F0066F6D9 /* LSPContentCoordinator.swift in Sources */,
58822525292C280D00E83CDE /* StatusBarMenuStyle.swift in Sources */,
6C147C4229A328C10089B630 /* Editor.swift in Sources */,
B6C4F2A32B3CA74800B2B140 /* CommitDetailsView.swift in Sources */,
Expand Down Expand Up @@ -5659,12 +5679,20 @@
minimumVersion = 1.2.0;
};
};
6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/apple/swift-async-algorithms.git";
requirement = {
kind = exactVersion;
version = 1.0.1;
};
};
6CD26C832C8F907800ADBA38 /* XCRemoteSwiftPackageReference "CodeEditSourceEditor" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/CodeEditApp/CodeEditSourceEditor";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.8.0;
minimumVersion = 0.8.1;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down Expand Up @@ -5752,6 +5780,11 @@
isa = XCSwiftPackageProductDependency;
productName = CodeEditSourceEditor;
};
6CB94D022CA1205100E8651C /* AsyncAlgorithms */ = {
isa = XCSwiftPackageProductDependency;
package = 6CB94D012CA1205100E8651C /* XCRemoteSwiftPackageReference "swift-async-algorithms" */;
productName = AsyncAlgorithms;
};
6CC17B4E2C432AE000834E2C /* CodeEditSourceEditor */ = {
isa = XCSwiftPackageProductDependency;
productName = CodeEditSourceEditor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "b6e0c892d567c4fb43e4135487752085a69cf403b95ee27c28e9d213dd3bbf5c",
"originHash" : "5c4a5d433333474763817b9804d7f1856ab3b416ed87b190a2bd6e86c0c9834c",
"pins" : [
{
"identity" : "anycodable",
Expand All @@ -13,7 +13,7 @@
{
"identity" : "codeeditkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditKit",
"location" : "https://github.com/CodeEditApp/CodeEditKit.git",
"state" : {
"revision" : "ad28213a968586abb0cb21a8a56a3587227895f1",
"version" : "0.1.2"
Expand All @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/CodeEditApp/CodeEditSourceEditor",
"state" : {
"revision" : "7d08e741c412b6fd30d5eea8bb6c0580e89553cf",
"version" : "0.8.0"
"revision" : "033b68d3e3e845984fbc3d405720d5cc6ce61f71",
"version" : "0.8.1"
}
},
{
Expand Down Expand Up @@ -181,6 +181,15 @@
"version" : "2.3.0"
}
},
{
"identity" : "swift-async-algorithms",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-async-algorithms.git",
"state" : {
"revision" : "6ae9a051f76b81cc668305ceed5b0e0a7fd93d20",
"version" : "1.0.1"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ final class CodeFileDocument: NSDocument, ObservableObject {
/// See ``CodeEditSourceEditor/CombineCoordinator``.
@Published var contentCoordinator: CombineCoordinator = CombineCoordinator()

lazy var languageServerCoordinator: LSPContentCoordinator = {
let coordinator = LSPContentCoordinator()
coordinator.uri = self.languageServerURI
return coordinator
}()

/// Used to override detected languages.
@Published var language: CodeLanguage?

Expand Down
5 changes: 4 additions & 1 deletion CodeEdit/Features/Editor/Views/CodeFileView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ struct CodeFileView: View {

init(codeFile: CodeFileDocument, textViewCoordinators: [TextViewCoordinator] = [], isEditable: Bool = true) {
self._codeFile = .init(wrappedValue: codeFile)
self.textViewCoordinators = textViewCoordinators + [codeFile.contentCoordinator]
self.textViewCoordinators = textViewCoordinators + [
codeFile.contentCoordinator,
codeFile.languageServerCoordinator
]
self.isEditable = isEditable

if let openOptions = codeFile.openOptions {
Expand Down
1 change: 0 additions & 1 deletion CodeEdit/Features/Extensions/ExtensionDiscovery.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ final class ExtensionDiscovery: ObservableObject {
Task { [weak self] in
for await availability in AppExtensionIdentity.availabilityUpdates {
guard !Task.isCancelled && self != nil else { return }
print(availability)
do {
if availability.disabledCount > 0 {
print("Found \(availability.disabledCount) disabled extensions, trying to activate...")
Expand Down
Loading
Loading