swiftlang / sourcekit-lsp

Language Server Protocol implementation for Swift and C-based languages
Apache License 2.0
3.26k stars 271 forks source link

Code actions to convert between computed properties and zero-parameter functions #1246

Open DougGregor opened 3 months ago

DougGregor commented 3 months ago

Description

A computed property:

var asJSON: String { ... }

can also be expressed as a zero-parameter function:

func asJSON() -> String { ... }

We could introduce a pair of code actions that convert from the first to second, or second to first.

ahoppen commented 3 months ago

Synced to Apple’s issue tracker as rdar://128016655

antigluten commented 2 months ago

Hi, @ahoppen! I'd like to work on this issue, all work has to be done in this repo or we should add new actions to swift-syntax repo?

ahoppen commented 2 months ago

If it's possible to implement the refactoring in the swift-syntax repo, that would be great.