Skip to content

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
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