Code actions for attribute accessor creation
Motivation
Closes #2503
Implementation
Selecting the first valid instance variabe from the user's selection and generating an attribute accessor method just below the start of the corresponding class/module definition.
Automated Tests
Added
Manual Tests
Select a line which contains instance variables, click the light bulb and select desired attribute accessor.
I'm unsure whether the calculation of target_range is appropriate.
@vinistock I have made the changes, but the prism test cases are failing. The error happens because it can't find the position in the file. Could you guide me on how to resolve this? Also, Im not sure why the node build is failing
The issue is that our default arguments for code action expectations (which is what is used on Prism fixtures) are assuming that line 1 character 1 exists, but the fixture only has a single line (lines are zero based).
We need to change this line to check if the document actually has two lines and, if not, set the end position of the range as line 0 character 1.
Thank you for your detailed instructions. I followed the same approach for the expectations test.
Regarding the extension build failure, I believe the issue arises from here. However, I'm new to JavaScript, so any guidance would be greatly appreciated.
Yes, you're correct. The range defined here doesn't actually exist in the document.
Switching that to { start: { line: 0, character: 0 }, end: { line: 1, character: 2 } } should do the trick, I believe.
I didn't encounter any issues during manual testing on the client side. I'll set up the VSCode extensions and test again.
Ruby Tests are failed due to build failures.
The test failure is due to the missing character position in the request. My bad, I overlooked it :facepalm: