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

Remove label from ServerConnection commands, since all methods take a single composite param struct #16

Merged
merged 3 commits into from
Dec 22, 2023

Conversation

koliyo
Copy link
Contributor

@koliyo koliyo commented Dec 22, 2023

Makes the client usage a bit cleaner imo. But is a breaking API change.

@mattmassicotte
Copy link
Contributor

You know, I have noticed this too and I agree. Label probably never should have been there.

There's actually a way to do this in a less-disruptive way. You add an overload, make the original call the new one, and mark the original as deprecated.

@available(*, deprecated, renamed: "initialize(_:)")
public func initialize(params: InitializeParams) async throws -> InitializationResponse {
    try await self.initialize(params)
}

I'm kind of torn here because that's a lot of work. But I do think its worth it.

@koliyo
Copy link
Contributor Author

koliyo commented Dec 22, 2023

Fixed!
Got to practice my regex-foo in VSCode

Search:

(public func (\w+)\(_ params:((\n|[^{])*))

Replace:

@available(*, deprecated, renamed: "$2(_:)")
	public func $2(params:$3{
		try await $2(params)
	}

	$1

The search expression was a bit complicated by some signatures being more than one line, but I got it working!

@mattmassicotte
Copy link
Contributor

🫨 that's incredible

@mattmassicotte mattmassicotte merged commit c896a88 into ChimeHQ:main Dec 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants